org.cip4.jdflib.core
Class VString

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<String>
              extended by org.cip4.jdflib.core.VString
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, List<String>, RandomAccess

public class VString
extends Vector<String>

See Also:
Serialized Form

Field Summary
static VString emptyVector
          the empty VString
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
VString()
          constructor
VString(Enumeration<String> a)
          creates a VString from an Enumeration of Strings
VString(String strIn)
          Deprecated. use VString (String strIn, null)
VString(String[] a)
          creates a VString from an array of Strings
VString(String strIn, String strSep)
          constructs a VString by tokenizing a string
VString(Vector<String> m)
          constructor
 
Method Summary
 boolean add(org.apache.commons.lang.enums.ValuedEnum enumType)
          appends enumType to this
if enumType is a ValuedEnum, the name is appended
 void addAll(String[] strings)
          appends all strings of an array to this
 void appendUnique(String v)
          AppendUnique - append a string but ignore multiple entries
 void appendUnique(VString v)
          AppendUnique - append a vector but ignore multiple entries
 boolean containsAny(VString other)
          checks whether at least one of a given vector of strings is contained in this
 String elementAt(int index)
           
 String get(int index)
           
 String get(String s)
          get a string from this
 String getAllStrings()
          Deprecated. use getString(JDFConstants.BLANK,null,null)
 String getAllStrings(String strSep)
          Deprecated. use getString(strSep,null,null)
 Set<String> getSet()
          gets a set with all entries of the VString
note that the set retains ordering (LinkedHashSet)
 String getString(String sep, String front, String back)
          Deprecated. use StringUtil setVString default: getString(sep, JDFConstants.EMPTYSTRING, JDFConstants.EMPTYSTRING)
static VString getVString(String strIn, String strSep)
          simple static factory
 boolean hasString(String s)
          Deprecated. 2005-02-14 use contains ...
 int index(String s)
          index - get the index of s in the vector
 String remove(int index)
          remove but also implementing the usual neg number syntax
 void removeStrings(String s)
          Deprecated. use removeStrings(s, Integer.MAX_VALUE);
 void removeStrings(String s, int nMax)
          removeStrings - remove nMax occurrences of a string
 void removeStrings(VString v)
          Deprecated. use removeStrings(v, Integer.MAX_VALUE);
 void removeStrings(VString v, int nMax)
          removeStrings - remove all occurrences of a string
 void setAllStrings(String strIn, String strSep)
          Method setAllStrings - put a separated string into the vString
e.g.
 String setvString(VString v, String sep, String front, String end)
          Deprecated. use getString
 void sort()
          sort this lexically
 String stringAt(int index)
           
 String toString()
          toString
 void unify()
          unify - make VString unique, retaining initial order
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elements, ensureCapacity, equals, firstElement, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

emptyVector

public static final VString emptyVector
the empty VString

Constructor Detail

VString

public VString()
constructor


VString

public VString(Vector<String> m)
constructor

Parameters:
m -

VString

@Deprecated
public VString(String strIn)
Deprecated. use VString (String strIn, null)

constructs a VString by tokenizing a string

Parameters:
strIn - the string to tokenize by blank

VString

public VString(String strIn,
               String strSep)
constructs a VString by tokenizing a string

Parameters:
strIn - the string to tokenize
strSep - the separator character

VString

public VString(String[] a)
creates a VString from an array of Strings

Parameters:
a - the array

VString

public VString(Enumeration<String> a)
creates a VString from an Enumeration of Strings

Parameters:
a - the Enumeration
Method Detail

getVString

public static VString getVString(String strIn,
                                 String strSep)
simple static factory

Parameters:
strIn -
strSep -
Returns:

stringAt

public String stringAt(int index)
Parameters:
index - the index which may be negative to count backwards
Returns:
the string at index

elementAt

public String elementAt(int index)
Overrides:
elementAt in class Vector<String>
Parameters:
index - the index which may be negative to count backwards
Returns:
the string at index

get

public String get(int index)
Specified by:
get in interface List<String>
Overrides:
get in class Vector<String>
Parameters:
index - the index which may be negative to count backwards
Returns:
the string at index

toString

public String toString()
toString

Overrides:
toString in class Vector<String>
Returns:
String

getAllStrings

@Deprecated
public String getAllStrings(String strSep)
Deprecated. use getString(strSep,null,null)

Method getAllStrings - returns all strings concatenated together

Parameters:
strSep - separation between the strings
Returns:
String

getAllStrings

@Deprecated
public String getAllStrings()
Deprecated. use getString(JDFConstants.BLANK,null,null)

Returns:
all strings separated by a blank

setAllStrings

public void setAllStrings(String strIn,
                          String strSep)
Method setAllStrings - put a separated string into the vString
e.g. "asdf asdf asdf asdf"

Parameters:
strIn - separated string
strSep - string separator

index

public int index(String s)
index - get the index of s in the vector

Parameters:
s -
Returns:
int the index of a string

hasString

@Deprecated
public boolean hasString(String s)
Deprecated. 2005-02-14 use contains ...

hasString - is 's' a member of this?

Parameters:
s - string to find
Returns:
boolean - true, if 's' is included in this

appendUnique

public void appendUnique(String v)
AppendUnique - append a string but ignore multiple entries

Parameters:
v - the string to append, if null nothing is added

appendUnique

public void appendUnique(VString v)
AppendUnique - append a vector but ignore multiple entries

Parameters:
v - the vector to append, if null nothing is added

removeStrings

@Deprecated
public void removeStrings(VString v)
Deprecated. use removeStrings(v, Integer.MAX_VALUE);

removeStrings - remove all occurrences of a string

Parameters:
v -

removeStrings

public void removeStrings(VString v,
                          int nMax)
removeStrings - remove all occurrences of a string

Parameters:
v - the vector of strings to remove from this
nMax - the max number of strings to remove

removeStrings

@Deprecated
public void removeStrings(String s)
Deprecated. use removeStrings(s, Integer.MAX_VALUE);

removeStrings - remove all occurrences of a string

Parameters:
s -

removeStrings

public void removeStrings(String s,
                          int nMax)
removeStrings - remove nMax occurrences of a string

Parameters:
s - the string to remove
nMax - remove s max. nMax times , 0 or negative = infinite

getString

@Deprecated
public String getString(String sep,
                                   String front,
                                   String back)
Deprecated. use StringUtil setVString default: getString(sep, JDFConstants.EMPTYSTRING, JDFConstants.EMPTYSTRING)

serialize to a string

Parameters:
sep - separator between strings
front - string before the first entry
back - string after the last entry
Returns:
a tokenized string

setvString

@Deprecated
public String setvString(VString v,
                                    String sep,
                                    String front,
                                    String end)
Deprecated. use getString

create a string from a vector of tokens

Parameters:
v - vector of tokens
sep - separator between tokens
front - 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

public String get(String s)
get a string from this

Parameters:
s - the String you are looking for
Returns:
the String if found or null if this does not contain s

getSet

public Set<String> 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()
sort this lexically


addAll

public void addAll(String[] strings)
appends all strings of an array to this

Parameters:
strings - the array of strings to append to this

containsAny

public boolean containsAny(VString other)
checks whether at least one of a given vector of strings is contained in this

Parameters:
other - 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 to this
if enumType is a ValuedEnum, the name is appended

Parameters:
enumType - the object to append
Returns:
true if successfully added

remove

public String remove(int index)
remove but also implementing the usual neg number syntax

Specified by:
remove in interface List<String>
Overrides:
remove in class Vector<String>
Parameters:
index - if 0, or positive count from front, else if negative from back
See Also:
Vector.remove(int)


Copyright © 2013. All Rights Reserved.