com.jaxfront.core.util
Class VectorHelper

java.lang.Object
  extended by com.jaxfront.core.util.VectorHelper

public class VectorHelper
extends java.lang.Object


Constructor Summary
VectorHelper()
           
 
Method Summary
static java.util.Vector difference(java.util.Vector vectA, java.util.Vector vectB)
          This method returns a Vector containing the set of objects contained in vectA that are not contained in vectB.
static java.util.Vector duplicates(java.util.Vector vector)
          This method returns a Vector of items that appeared in the vector parameter more than once.
static java.lang.Object getFirstCommonObject(java.util.Vector vectA, java.util.Vector vectB)
           
static java.util.Vector intersection(java.util.Vector vectA, java.util.Vector vectB)
          This method returns a Vector containing the intersection of the objects contained in vectA and vectB.
static void main(java.lang.String[] args)
           
static java.util.Vector minus(java.util.Vector vectA, java.util.Vector vectB)
          This method returns a Vector containing the elements of vectA minus the elements of vectB.
static boolean overlaps(java.util.Vector vectA, java.util.Vector vectB)
          Returns true if vectA and vectB have any elements in common.
static java.util.Vector stringVector(java.lang.String input, java.lang.String sepChars)
          This method takes a sepChars-separated string and converts it to a vector of fields. i.e., "gomod,jonabbey" -> a vector whose elements are "gomod" and "jonabbey".
static java.util.Vector union(java.util.Vector vectA, java.util.Vector vectB)
          This method returns a Vector containing the union of the objects contained in vectA and vectB.
static void unionAdd(java.util.Vector vect, java.lang.Object obj)
           This method adds obj to vect if and only if vect does not already contain obj.
static java.lang.String vectorString(java.util.Vector vec)
          This method returns a string containing all the elements in vec concatenated together, comma separated.
static java.lang.String vectorString(java.util.Vector vec, java.lang.String method)
          This method returns a string containing all the elements in vec concatenated together, comma separated.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorHelper

public VectorHelper()
Method Detail

union

public static java.util.Vector union(java.util.Vector vectA,
                                     java.util.Vector vectB)
This method returns a Vector containing the union of the objects contained in vectA and vectB. The resulting Vector will not contain any duplicates, even if vectA or vectB themselves contain repeated items. This method will always return a new, non-null Vector, even if vectA and/or vectB are null.


unionAdd

public static void unionAdd(java.util.Vector vect,
                            java.lang.Object obj)

This method adds obj to vect if and only if vect does not already contain obj.


overlaps

public static boolean overlaps(java.util.Vector vectA,
                               java.util.Vector vectB)
Returns true if vectA and vectB have any elements in common.


intersection

public static java.util.Vector intersection(java.util.Vector vectA,
                                            java.util.Vector vectB)
This method returns a Vector containing the intersection of the objects contained in vectA and vectB. This method will always return a new, non-null Vector, even if vectA and/or vectB are null.


getFirstCommonObject

public static java.lang.Object getFirstCommonObject(java.util.Vector vectA,
                                                    java.util.Vector vectB)

difference

public static java.util.Vector difference(java.util.Vector vectA,
                                          java.util.Vector vectB)
This method returns a Vector containing the set of objects contained in vectA that are not contained in vectB. This method will always return a new, non-null Vector, even if vectA and/or vectB are null.


duplicates

public static java.util.Vector duplicates(java.util.Vector vector)
This method returns a Vector of items that appeared in the vector parameter more than once. If no duplicates are found or if vector is null, this method returns null.


minus

public static java.util.Vector minus(java.util.Vector vectA,
                                     java.util.Vector vectB)
This method returns a Vector containing the elements of vectA minus the elements of vectB. If vectA has an element in the Vector 5 times and vectB has it 3 times, the result will have it two times. This method will always return a new, non-null Vector, even if vectA and/or vectB are null.


vectorString

public static java.lang.String vectorString(java.util.Vector vec)
This method returns a string containing all the elements in vec concatenated together, comma separated.


vectorString

public static java.lang.String vectorString(java.util.Vector vec,
                                            java.lang.String method)
This method returns a string containing all the elements in vec concatenated together, comma separated.


stringVector

public static java.util.Vector stringVector(java.lang.String input,
                                            java.lang.String sepChars)
This method takes a sepChars-separated string and converts it to a vector of fields. i.e., "gomod,jonabbey" -> a vector whose elements are "gomod" and "jonabbey". NOTE: this method will omit 'degenerate' fields from the output vector. That is, if input is "gomod,,, jonabbey" and sepChars is ", ", then the result vector will still only have "gomod" and "jonabbey" as elements, even though one might wish to explicitly know about the blanks between commas. This method is intended mostly for creating email list vectors, rather than general file-parsing vectors.

Parameters:
input - the sepChars-separated string to test.
sepChars - a string containing a list of characters which may occur as field separators. Any two fields in the input may be separated by one or many of the characters present in sepChars.

main

public static void main(java.lang.String[] args)