com.moximedia.ows
Class Utilities

java.lang.Object
  extended bycom.moximedia.ows.Utilities
All Implemented Interfaces:
java.io.Serializable

public class Utilities
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
Utilities()
           
 
Method Summary
static java.lang.Integer cloneInteger(java.lang.Integer i)
          Returns a new Integer object that is a clone of another.
static java.lang.String decodeUTF8(java.lang.String inString)
          Returns an decoded string encoded using UTF-8.
static java.lang.String encodeUTF8(java.lang.String inString)
          Returns a string encoded using UTF-8.
static java.lang.String escapeQuery(java.lang.String inString)
          Returns a string with ', ", &, <, and > characters changed to their HTML equivalents.
static java.lang.String fixAmpersands(java.lang.String in)
          Escapes the ampersands in the string.
static java.lang.String formatDD(double dd, boolean isLat, double scaleFactor, java.util.Locale locale)
          Returns the formatted latitude or longitude for the specified decimal degrees.
static double getAngle(java.lang.String angleString)
          Gets the angle from a string containing decimal degrees, degree, minute, seconds separated by spaces, or cardinal notation.
static java.lang.String getArg(java.lang.String argString, java.lang.String key)
          Gets the value of a parameter in a comma separated list of parameters like name1=value,name2=value etc.
static java.lang.String getCardinalAngle(double degrees)
          Returns the cardinal angle for the specified decimal degrees.
static java.util.ArrayList getCopy(java.util.ArrayList o)
          Makes a copy of the object passed as a parameter.
static java.lang.Boolean getCopy(java.lang.Boolean o)
          Makes a copy of the object passed as a parameter.
static java.awt.Color getCopy(java.awt.Color o)
          Makes a copy of the object passed as a parameter.
static Color getCopy(Color o)
          Makes a copy of the object passed as a parameter.
static Envelope getCopy(Envelope o)
          Makes a copy of the object passed as a parameter.
static Feature getCopy(Feature o)
          Makes a copy of the object passed as a parameter.
static java.awt.Font getCopy(java.awt.Font o)
          Makes a copy of the object passed as a parameter.
static java.util.HashMap getCopy(java.util.HashMap o)
          Makes a copy of the object passed as a parameter.
static java.util.HashSet getCopy(java.util.HashSet o)
          Makes a copy of the object passed as a parameter.
static Line getCopy(Line o)
          Makes a copy of the object passed as a parameter.
static Point getCopy(Point o)
          Makes a copy of the object passed as a parameter.
static Points getCopy(Points o)
          Makes a copy of the object passed as a parameter.
static Polygon getCopy(Polygon o)
          Makes a copy of the object passed as a parameter.
static java.lang.String getCopy(java.lang.String o)
          Makes a copy of the object passed as a parameter.
static int getDegrees(double dd)
          Returns the degrees portion of a decimal degree.
static java.lang.String getLatitudeString(double dd)
          Returns the formatted latitude for the specified decimal degrees.
static java.lang.String getLatitudeString(double dd, double scaleFactor, java.util.Locale locale)
          Returns the formatted latitude for the specified decimal degrees.
static java.lang.String getLatitudeString(double dd, java.util.Locale locale)
          Returns the formatted latitude for the specified decimal degrees.
static java.lang.String getLongitudeString(double dd)
          Returns the formatted longitude for the specified decimal degrees.
static java.lang.String getLongitudeString(double dd, double scaleFactor, java.util.Locale locale)
          Returns the formatted longitude for the specified decimal degrees.
static java.lang.String getLongitudeString(double dd, java.util.Locale locale)
          Returns the formatted longitude for the specified decimal degrees.
static int getMinutes(double dd)
          Returns the minutes portion of a decimal degree.
static int getNextObjectId()
          Gets a unique object id.
static java.lang.String getNextParameterSeparator(java.lang.String url)
          Gets the separator (? or &) that will be used when adding the next parameter for a url.
static java.lang.String getRelativeUrl(java.lang.String inUrl, java.lang.String context, java.lang.String framework)
          Returns a URL string representing the path of the URL from the location of an IMF configuration file or from the location of the IMF installation if $IMF is used.
static double getSeconds(double dd)
          Returns the seconds portion of a decimal degree.
static java.lang.String getShortString(java.lang.String inString, int maxLength)
          Returns a string with a maximum specified length.
static java.lang.String initcap(java.lang.String value)
          Returns a string with the first character of each work capitalized.
static java.lang.String intToHex(int number, int length)
          Returns the hext string of the specified length padded by leading zeros.
static java.lang.String removeInvalidCharacters(java.lang.String inStr, java.lang.String validChars)
          Returns a string with invalid characters removed.
static java.lang.String removeSpaces(java.lang.String inString)
          Remove spaces from a string.
static java.lang.String replaceSubstring(java.lang.String str, java.lang.String pattern, java.lang.String replace)
          Replaces all occurances of a substring in a string.
static boolean sendEmail(java.lang.String mailServer, java.lang.String logon, java.lang.String fromAddress, java.lang.String toAddress, java.lang.String subject, java.lang.String message)
          Sends an e-mail message.
static boolean string2boolean(java.lang.String arg)
          Converts a string to a boolean, defaulting to false.
static java.awt.Color string2color(java.lang.String arg)
          Converts a string in the form "r,g,b" or "r,g,b,a" to a Color object.
static double string2double(java.lang.String arg)
          Converts a string to a double, defaulting to zero.
static int string2int(java.lang.String arg)
          Converts a string to an int, defaulting to zero.
static long string2long(java.lang.String arg)
          Converts a string to a long, defaulting to zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Method Detail

fixAmpersands

public static java.lang.String fixAmpersands(java.lang.String in)
Escapes the ampersands in the string.

Parameters:
in - The string to fix.
Returns:
The fixed string.

getNextParameterSeparator

public static java.lang.String getNextParameterSeparator(java.lang.String url)
Gets the separator (? or &) that will be used when adding the next parameter for a url.

Parameters:
url - The url to test.
Returns:
The separator, "&", "?", or "" if separator already present.

getShortString

public static java.lang.String getShortString(java.lang.String inString,
                                              int maxLength)
Returns a string with a maximum specified length. If the string is truncated, it will be truncated three characters shorter than the specified length, and "..." will be appended to the shortened string. Useful for list boxes.

Parameters:
inString - The string to test.
maxLength - The maximum number of characters.
Returns:
The shortened string, or the original string if not shortened.

getNextObjectId

public static int getNextObjectId()
Gets a unique object id.

Returns:
The object id.

encodeUTF8

public static java.lang.String encodeUTF8(java.lang.String inString)
Returns a string encoded using UTF-8.

Parameters:
inString - The unencoded string.
Returns:
The encoded string.

decodeUTF8

public static java.lang.String decodeUTF8(java.lang.String inString)
Returns an decoded string encoded using UTF-8.

Parameters:
inString - The encoded string.
Returns:
The unencoded string.

cloneInteger

public static java.lang.Integer cloneInteger(java.lang.Integer i)
Returns a new Integer object that is a clone of another.

Parameters:
i - The original Integer.
Returns:
The copy.

getRelativeUrl

public static java.lang.String getRelativeUrl(java.lang.String inUrl,
                                              java.lang.String context,
                                              java.lang.String framework)
Returns a URL string representing the path of the URL from the location of an IMF configuration file or from the location of the IMF installation if $IMF is used.

Parameters:
inUrl - The original URL.
context - The URL path of the configuration document.
framework - The URL path of the IMF instance.
Returns:
The modified URL.

getArg

public static java.lang.String getArg(java.lang.String argString,
                                      java.lang.String key)
Gets the value of a parameter in a comma separated list of parameters like name1=value,name2=value etc.

Parameters:
argString - The argument string to parse.
key - The parameter name.
Returns:
The value.

intToHex

public static java.lang.String intToHex(int number,
                                        int length)
Returns the hext string of the specified length padded by leading zeros.

Parameters:
number - The number to decode.
length - The length of the resulting string.
Returns:
The hex representation of the number.

removeSpaces

public static java.lang.String removeSpaces(java.lang.String inString)
Remove spaces from a string.

Parameters:
inString - The original string.
Returns:
The string without spaces.

escapeQuery

public static java.lang.String escapeQuery(java.lang.String inString)
Returns a string with ', ", &, <, and > characters changed to their HTML equivalents. This routine is used to format where expressions and joins to AXL safe strings.

Parameters:
inString - The string to escape.
Returns:
The escaped string.

removeInvalidCharacters

public static java.lang.String removeInvalidCharacters(java.lang.String inStr,
                                                       java.lang.String validChars)
Returns a string with invalid characters removed.

Parameters:
inStr - The original string.
validChars - The list of valid characters.
Returns:
The string with invalid characters removed.

replaceSubstring

public static java.lang.String replaceSubstring(java.lang.String str,
                                                java.lang.String pattern,
                                                java.lang.String replace)
Replaces all occurances of a substring in a string.

Parameters:
str - The original string.
pattern - The substring to replace.
replace - The text to replace it with.
Returns:
The modified string.

string2double

public static double string2double(java.lang.String arg)
Converts a string to a double, defaulting to zero.

Parameters:
arg - The number string.
Returns:
The number.

string2long

public static long string2long(java.lang.String arg)
Converts a string to a long, defaulting to zero.

Parameters:
arg - The number string.
Returns:
The number.

string2int

public static int string2int(java.lang.String arg)
Converts a string to an int, defaulting to zero.

Parameters:
arg - The number string.
Returns:
The number.

string2boolean

public static boolean string2boolean(java.lang.String arg)
Converts a string to a boolean, defaulting to false.

Parameters:
arg - The number string.
Returns:
The number.

string2color

public static java.awt.Color string2color(java.lang.String arg)
Converts a string in the form "r,g,b" or "r,g,b,a" to a Color object.

Parameters:
arg - A comma separated string containing integer red, green, blue and optionally alpha values.
Returns:
A color object, black if an error occurs.

getDegrees

public static int getDegrees(double dd)
Returns the degrees portion of a decimal degree.

Parameters:
dd - The decimal degree value.
Returns:
The degrees.

getMinutes

public static int getMinutes(double dd)
Returns the minutes portion of a decimal degree.

Parameters:
dd - The decimal degree value.
Returns:
The minutes.

getSeconds

public static double getSeconds(double dd)
Returns the seconds portion of a decimal degree.

Parameters:
dd - The decimal degree value.
Returns:
The seconds.

getLatitudeString

public static java.lang.String getLatitudeString(double dd)
Returns the formatted latitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
Returns:
The latitude string.

getLatitudeString

public static java.lang.String getLatitudeString(double dd,
                                                 java.util.Locale locale)
Returns the formatted latitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
locale - The locale used for formatting.
Returns:
The latitude string.

getLatitudeString

public static java.lang.String getLatitudeString(double dd,
                                                 double scaleFactor,
                                                 java.util.Locale locale)
Returns the formatted latitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
scaleFactor - The scale factor, used to limit detail.
locale - The locale used for formatting.
Returns:
The latitude string.

getLongitudeString

public static java.lang.String getLongitudeString(double dd)
Returns the formatted longitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
Returns:
The longitude string.

getLongitudeString

public static java.lang.String getLongitudeString(double dd,
                                                  java.util.Locale locale)
Returns the formatted longitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
locale - The locale used for formatting.
Returns:
The longitude string.

getLongitudeString

public static java.lang.String getLongitudeString(double dd,
                                                  double scaleFactor,
                                                  java.util.Locale locale)
Returns the formatted longitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
scaleFactor - The scale factor, used to limit detail.
locale - The locale used for formatting.
Returns:
The longitude string.

formatDD

public static java.lang.String formatDD(double dd,
                                        boolean isLat,
                                        double scaleFactor,
                                        java.util.Locale locale)
Returns the formatted latitude or longitude for the specified decimal degrees.

Parameters:
dd - The decimal degrees.
isLat - True if latitude formatting is requested, otherwise false.
scaleFactor - The scale factor, used to limit detail.
locale - The locale used for formatting.
Returns:
The latitude or longitude string.

getCardinalAngle

public static java.lang.String getCardinalAngle(double degrees)
Returns the cardinal angle for the specified decimal degrees.

Parameters:
degrees - The input degrees.
Returns:
The cardinal angle string.

getAngle

public static double getAngle(java.lang.String angleString)
Gets the angle from a string containing decimal degrees, degree, minute, seconds separated by spaces, or cardinal notation.

Parameters:
angleString - The angle string.
Returns:
The angle in decimal degrees.

sendEmail

public static boolean sendEmail(java.lang.String mailServer,
                                java.lang.String logon,
                                java.lang.String fromAddress,
                                java.lang.String toAddress,
                                java.lang.String subject,
                                java.lang.String message)
Sends an e-mail message.

Parameters:
mailServer - The mail server name.
logon - The server login to send mail.
fromAddress - The sender's e-mail address.
toAddress - The recipient's e-mail address.
subject - The subject.
message - The message content.
Returns:
True if successful, otherwise false.

getCopy

public static Envelope getCopy(Envelope o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Line getCopy(Line o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Point getCopy(Point o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Points getCopy(Points o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Polygon getCopy(Polygon o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.awt.Color getCopy(java.awt.Color o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Color getCopy(Color o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static Feature getCopy(Feature o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.awt.Font getCopy(java.awt.Font o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.lang.String getCopy(java.lang.String o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.lang.Boolean getCopy(java.lang.Boolean o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.util.ArrayList getCopy(java.util.ArrayList o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object. Only supports arrays of Strings or Features at this time. TODO: Add support for other objects.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.util.HashMap getCopy(java.util.HashMap o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object. Only supports hashmaps with String keys and String or Boolean values at this time. TODO: Add support for other objects.

Parameters:
o - The original object.
Returns:
The copy.

getCopy

public static java.util.HashSet getCopy(java.util.HashSet o)
Makes a copy of the object passed as a parameter. An alternative to cloning the object. Only supports hashsets with Strings at this time. TODO: Add support for other objects.

Parameters:
o - The original object.
Returns:
The copy.

initcap

public static java.lang.String initcap(java.lang.String value)
Returns a string with the first character of each work capitalized.

Parameters:
value - The input string.
Returns:
The capitalized string.


Internet Mapping Framework for OpenGIS Java Object Model API (v1.3.007)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.