Package org.cip4.jdflib.core
Class VString
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<String>,Collection<String>,List<String>,RandomAccess
- See Also:
-
Field Summary
FieldsFields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionVString()constructorconvenience - constructs a VString by tokenizing a stringcreates a VString from an array of Stringsconstructs a VString by tokenizing a stringVString(Collection<String> m) constructorVString(Enumeration<String> a) creates a VString from an Enumeration of Stringsconstructorconstructor -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanadd(org.apache.commons.lang.enums.ValuedEnum enumType) appends enumType tothis
if enumType is a ValuedEnum, the name is appendedvoidappends all strings of an array tothisvoidaddNonEmpty(String text) add a string if it is not emptyvoidappendUnique(String string) AppendUnique - append a string but ignore multiple entriesvoidAppendUnique - append a vector but ignore multiple entriesvoidAppendUnique - append a vector but ignore multiple entriesbooleancontainsAny(Collection<String> others) checks whether at least one of a given vector of strings is contained inthisbooleancontainsAny(VString others) elementAt(int index) get(int index) get a string fromthisDeprecated.use getString(JDFConstants.BLANK,null,null)getAllStrings(String strSep) Deprecated.use getString(strSep,null,null)getOverlapping(Collection<String> others) vector of strings that is contained inthisgetSet()gets a set with all entries of the VString
note that the set retains ordering (LinkedHashSet)serialize to a stringserialize to a stringstatic VStringgetVString(String strIn, String strSep) simple static factory - null if strIn is null or emptystatic VStringsimple static factory - null if strIn is null or emptybooleanDeprecated.2005-02-14 use contains ...intindex - get the index of s in the vectorstatic booleanisEmpty(Collection<String> v) are we null or empty or contain only an empty JDFAttributeMapstatic booleanare we null or empty or contain only an empty JDFAttributeMapremove(int index) remove but also implementing the usual neg number syntaxvoidDeprecated.use removeStrings(s, Integer.MAX_VALUE);voidremoveStrings(String s, int nMax) removeStrings - remove nMax occurrences of a stringvoidremoveStrings(Collection<String> v, int nMax) removeStrings - remove all occurrences of a set of stringvoidDeprecated.use removeStrings(v, Integer.MAX_VALUE);voidsetAllStrings(String strIn, String strSep) Method setAllStrings - put a separated string into the vString
e.g.setvString(VString v, String sep, String front, String end) Deprecated.use getStringvoidsort()sortthislexicallystringAt(int index) Deprecated.- simply use gettoString()toStringvoidunify()unify - make VString unique, retaining initial orderMethods inherited from class java.util.Vector
addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elements, ensureCapacity, equals, firstElement, forEach, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Field Details
-
emptyVector
Deprecated.grab your own... this is a potential leak, since it can be modifiedthe empty VString
-
-
Constructor Details
-
VString
public VString()constructor -
VString
constructor- Parameters:
m-
-
VString
constructor- Parameters:
m-
-
VString
constructor- Parameters:
m-
-
VString
convenience - constructs a VString by tokenizing a string- Parameters:
strIn- the string to tokenize by blank
-
VString
constructs a VString by tokenizing a string- Parameters:
strIn- the string to tokenizestrSep- the separator character
-
VString
creates a VString from an array of Strings- Parameters:
a- the array
-
VString
creates a VString from an Enumeration of Strings- Parameters:
a- the Enumeration
-
-
Method Details
-
set
-
add
-
add
-
isEmpty
are we null or empty or contain only an empty JDFAttributeMap- Parameters:
v-- Returns:
-
isEmpty
are we null or empty or contain only an empty JDFAttributeMap- Parameters:
v-- Returns:
-
getVString
simple static factory - null if strIn is null or empty- Parameters:
strIn-strSep-- Returns:
-
getVString
simple static factory - null if strIn is null or empty- Parameters:
strIn-strSep-- Returns:
-
stringAt
Deprecated.- simply use get- Parameters:
index- the index which may be negative to count backwards- Returns:
- the string at index
-
elementAt
-
get
-
toString
toString -
getAllStrings
Deprecated.use getString(strSep,null,null)Method getAllStrings - returns all strings concatenated together- Parameters:
strSep- separation between the strings- Returns:
- String
-
getAllStrings
Deprecated.use getString(JDFConstants.BLANK,null,null)- Returns:
- all strings separated by a blank
-
setAllStrings
Method setAllStrings - put a separated string into the vString
e.g. "asdf asdf asdf asdf"- Parameters:
strIn- separated stringstrSep- string separator
-
index
index - get the index of s in the vector- Parameters:
s-- Returns:
- int the index of a string
-
hasString
Deprecated.2005-02-14 use contains ...hasString - is 's' a member ofthis?- Parameters:
s- string to find- Returns:
- boolean - true, if 's' is included in
this
-
appendUnique
AppendUnique - append a string but ignore multiple entries- Parameters:
string- the string to append, if null nothing is added
-
appendUnique
AppendUnique - append a vector but ignore multiple entries- Parameters:
v- the vector to append, if null nothing is added
-
appendUnique
AppendUnique - append a vector but ignore multiple entries- Parameters:
v- the vector to append, if null nothing is added
-
removeStrings
Deprecated.use removeStrings(v, Integer.MAX_VALUE);removeStrings - remove all occurrences of a string- Parameters:
v-
-
removeStrings
removeStrings - remove all occurrences of a set of string- Parameters:
v- the vector of strings to remove fromthisnMax- the max number of strings to remove
-
removeStrings
Deprecated.use removeStrings(s, Integer.MAX_VALUE);removeStrings - remove all occurrences of a string- Parameters:
s-
-
removeStrings
removeStrings - remove nMax occurrences of a string- Parameters:
s- the string to removenMax- remove s max. nMax times , 0 or negative = infinite
-
getString
serialize to a string- Parameters:
sep- separator between stringsfront- string before the first entryback- string after the last entry- Returns:
- a tokenized string
-
getString
serialize to a string- Parameters:
sep- separator between stringsfront- string before the first entryback- string after the last entry- Returns:
- a tokenized string
-
setvString
Deprecated.use getStringcreate a string from a vector of tokens- Parameters:
v- vector of tokenssep- separator between tokensfront- prefix to string (before the first token)end- suffix to string (after the last token)- Returns:
- condensed string of tokens separated by sep
-
unify
public void unify()unify - make VString unique, retaining initial order -
get
get a string fromthis- Parameters:
s- the String you are looking for- Returns:
- the String if found or null if
thisdoes not contain s
-
getSet
gets a set with all entries of the VString
note that the set retains ordering (LinkedHashSet)- Returns:
- the set corresponding to this
-
sort
public void sort()sortthislexically -
addAll
appends all strings of an array tothis- Parameters:
strings- the array of strings to append tothis
-
containsAny
checks whether at least one of a given vector of strings is contained inthis- Parameters:
others- the VSTring of values to test- Returns:
- true if at least one String in other is in
this
-
containsAny
-
getOverlapping
vector of strings that is contained inthis- Parameters:
others- the VString of values to test- Returns:
- true if at least one String in other is in
this
-
add
public boolean add(org.apache.commons.lang.enums.ValuedEnum enumType) appends enumType tothis
if enumType is a ValuedEnum, the name is appended- Parameters:
enumType- the object to append- Returns:
- true if successfully added
-
remove
remove but also implementing the usual neg number syntax -
addNonEmpty
add a string if it is not empty- Parameters:
text-
-