|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--arlut.csd.Util.VectorUtils
Convenience methods for working with Vectors.. provides efficient Union, Intersection, and Difference methods.
| Constructor Summary | |
VectorUtils()
|
|
| 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. |
private static int |
findNextSep(java.lang.String input,
int startDex,
java.lang.String sepChars)
findNextSep() takes a string, a starting position, and a string of characters to be considered field separators, and returns the first index after startDex whose char is in sepChars. |
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. |
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. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public VectorUtils()
| Method Detail |
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.
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.
public static boolean overlaps(java.util.Vector vectA,
java.util.Vector vectB)
Returns true if vectA and vectB have any elements in common.
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.
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.
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.
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.
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.
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.
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.
private static int findNextSep(java.lang.String input,
int startDex,
java.lang.String sepChars)
findNextSep() takes a string, a starting position, and a string of characters to be considered field separators, and returns the first index after startDex whose char is in sepChars.
If there are no chars in sepChars past startdex in input, findNextSep() returns -1.
public static void main(java.lang.String[] args)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||