us.openinternet.luge.util
Class LugeUtilities

java.lang.Object
  |
  +--us.openinternet.luge.util.LugeUtilities

public class LugeUtilities
extends java.lang.Object


Constructor Summary
LugeUtilities()
           
 
Method Summary
static java.util.ArrayList Array2ArrayList(java.lang.Object[] array)
          Converts Object[] to an ArrayList.
static java.util.ArrayList checkRequiredAttrs(java.util.Hashtable ht, java.lang.String[] attrs)
          This method returns a ArrayList of missing keys from a hashatable.
static java.util.ArrayList checkRequiredAttrs(PersonVO pvo, java.lang.String[] attrs)
          This method checks to make sure required attributes are found.
static java.util.Hashtable cleanHashtable(java.util.Hashtable ht)
          This method removes null values and blank strings from the keys of Hasthable.
static java.util.ArrayList Enumeration2ArrayList(java.util.Enumeration e)
          Converts Enumeration to ArrayList.
static java.util.ArrayList getDistinct(java.util.ArrayList al)
          This method returns the distnct members of an Arraylist
static java.lang.String getUserPassword(int minimumLength, int maximumLength)
          This method returns a random password
static java.util.ArrayList GroupIntersection(java.util.ArrayList[] av)
          This method processes an array of input ArrayLists and determines the common elements.
static java.util.ArrayList GroupIntersection(java.util.ArrayList v1, java.util.ArrayList v2)
          This method processes two input ArrayLists and determines the common elements on both.
static java.util.ArrayList GroupSubtraction(java.util.ArrayList v1, java.util.ArrayList v2)
          This method processes two input ArrayLists and returns elements that are present on the first ArrayList but not on the second.
static java.util.ArrayList GroupUnion(java.util.ArrayList groups)
          This method processes an ArrayList of input ArrayList and determines the union of elements.
static java.util.ArrayList GroupUnion(java.util.ArrayList[] av)
          This method processes an array of input ArrayLists and determines the union of elements.
static java.util.ArrayList GroupUnion(java.util.ArrayList v1, java.util.ArrayList v2)
          This method processes two input ArrayListss and determines the union of elements on both.
static java.util.ArrayList lowerCaseArrayList(java.util.ArrayList originalAL)
          Lowercases all elements of an ArrayList--WARNING: Handles only Strings
static java.util.Hashtable LowerCaseKeys(java.util.Hashtable h)
          Returns same Hashtable with keys lowercased.
static java.lang.String trimPrefix(java.lang.String prefix, java.lang.String text)
          This method looks for a certain prefix and trims it off if present (otherwise returns the orginal string.)
static java.lang.String zfill(java.lang.String s, int desiredLength)
          This method adds zero's in front of an string to make it a certain length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LugeUtilities

public LugeUtilities()
Method Detail

Array2ArrayList

public static java.util.ArrayList Array2ArrayList(java.lang.Object[] array)
Converts Object[] to an ArrayList.


Enumeration2ArrayList

public static java.util.ArrayList Enumeration2ArrayList(java.util.Enumeration e)
Converts Enumeration to ArrayList. WARNING:Handles only Strings Returns an ArrayList; NULL if namingEnum is null or empty


LowerCaseKeys

public static java.util.Hashtable LowerCaseKeys(java.util.Hashtable h)
Returns same Hashtable with keys lowercased.

Returns:
fixed Hashtable or empty Hashtable if h is NULL or empty

lowerCaseArrayList

public static java.util.ArrayList lowerCaseArrayList(java.util.ArrayList originalAL)
Lowercases all elements of an ArrayList--WARNING: Handles only Strings

Returns:
ArrayList or empty ArrayList if original ArrayList is null or empty

GroupIntersection

public static java.util.ArrayList GroupIntersection(java.util.ArrayList v1,
                                                    java.util.ArrayList v2)
This method processes two input ArrayLists and determines the common elements on both. It automatically lowercases the elements.

Returns:
ArrayList of Strings (elements) that are available on both.

GroupIntersection

public static java.util.ArrayList GroupIntersection(java.util.ArrayList[] av)
This method processes an array of input ArrayLists and determines the common elements. It automatically lowercases the elements.

Returns:
ArrayList of Strings (elements) that are available on all input ArrayLists.

GroupUnion

public static java.util.ArrayList GroupUnion(java.util.ArrayList v1,
                                             java.util.ArrayList v2)
This method processes two input ArrayListss and determines the union of elements on both.

Returns:
ArrayList of Strings (elements) that are available on both and also those It automatically lowercases the elements. available on each input ArrayList. Duplicate elements are supressed.

GroupUnion

public static java.util.ArrayList GroupUnion(java.util.ArrayList[] av)
This method processes an array of input ArrayLists and determines the union of elements.

Returns:
ArrayList of Strings (elements) that are available on all input ArrayLists and also those available on each input ArrayList. Duplicate elements are supressed. It automatically lowercases the elements.

GroupUnion

public static java.util.ArrayList GroupUnion(java.util.ArrayList groups)
This method processes an ArrayList of input ArrayList and determines the union of elements.

Returns:
ArrayList of Strings (elements) that are available on all input ArrayLists and also those available on each input ArrayList. Duplicate elements are supressed. It automatically lowercases the elements.

GroupSubtraction

public static java.util.ArrayList GroupSubtraction(java.util.ArrayList v1,
                                                   java.util.ArrayList v2)
This method processes two input ArrayLists and returns elements that are present on the first ArrayList but not on the second.

Returns:
ArrayList of Strings (elements). It automatically lowercases the elements.

checkRequiredAttrs

public static java.util.ArrayList checkRequiredAttrs(java.util.Hashtable ht,
                                                     java.lang.String[] attrs)
This method returns a ArrayList of missing keys from a hashatable. Used primarily for internal error checking. Empty Vector means all required attributes are present


checkRequiredAttrs

public static java.util.ArrayList checkRequiredAttrs(PersonVO pvo,
                                                     java.lang.String[] attrs)
This method checks to make sure required attributes are found.

Parameters:
pvo - - PersonVO object to be checked
attrs - - the required attributes you to make sure are present
Returns:
true if all the attributes are found,

cleanHashtable

public static java.util.Hashtable cleanHashtable(java.util.Hashtable ht)
This method removes null values and blank strings from the keys of Hasthable.


zfill

public static java.lang.String zfill(java.lang.String s,
                                     int desiredLength)
This method adds zero's in front of an string to make it a certain length


getUserPassword

public static java.lang.String getUserPassword(int minimumLength,
                                               int maximumLength)
This method returns a random password

Parameters:
minimumLength - - the minimum length that will be returned
maximumLength - - the maximum length that will be returned

getDistinct

public static java.util.ArrayList getDistinct(java.util.ArrayList al)
This method returns the distnct members of an Arraylist


trimPrefix

public static java.lang.String trimPrefix(java.lang.String prefix,
                                          java.lang.String text)
This method looks for a certain prefix and trims it off if present (otherwise returns the orginal string.)


Copyright 2003, Michael Schwartz All Rights Reserved.