Class VString

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, List<String>, RandomAccess

public class VString extends Vector<String>
See Also:
  • Field Details

    • emptyVector

      @Deprecated public static final VString emptyVector
      Deprecated.
      grab your own... this is a potential leak, since it can be modified
      the empty VString
  • Constructor Details

    • VString

      public VString()
      constructor
    • VString

      public VString(Collection<String> m)
      constructor
      Parameters:
      m -
    • VString

      public VString(Vector<String> v)
      constructor
      Parameters:
      m -
    • VString

      public VString(VString v)
      constructor
      Parameters:
      m -
    • VString

      public VString(String strIn)
      convenience - 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 Details

    • set

      public String set(int index, String e)
      Specified by:
      set in interface List<String>
      Overrides:
      set in class Vector<String>
    • add

      public void add(int index, String element)
      Specified by:
      add in interface List<String>
      Overrides:
      add in class Vector<String>
    • add

      public boolean add(String e)
      Specified by:
      add in interface Collection<String>
      Specified by:
      add in interface List<String>
      Overrides:
      add in class Vector<String>
    • isEmpty

      public static boolean isEmpty(Collection<String> v)
      are we null or empty or contain only an empty JDFAttributeMap
      Parameters:
      v -
      Returns:
    • isEmpty

      public static boolean isEmpty(VString v)
      are we null or empty or contain only an empty JDFAttributeMap
      Parameters:
      v -
      Returns:
    • getVString

      public static VString getVString(String strIn, String strSep)
      simple static factory - null if strIn is null or empty
      Parameters:
      strIn -
      strSep -
      Returns:
    • getVString

      public static VString getVString(Collection<String> c)
      simple static factory - null if strIn is null or empty
      Parameters:
      strIn -
      strSep -
      Returns:
    • stringAt

      @Deprecated public String stringAt(int index)
      Deprecated.
      - simply use get
      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 string)
      AppendUnique - append a string but ignore multiple entries
      Parameters:
      string - 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
    • appendUnique

      public void appendUnique(Collection<String> 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(Collection<String> v, int nMax)
      removeStrings - remove all occurrences of a set of 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

      public String getString(String sep, String front, String back)
      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
    • getString

      public String getString()
      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(Collection<String> others)
      checks whether at least one of a given vector of strings is contained in this
      Parameters:
      others - the VSTring of values to test
      Returns:
      true if at least one String in other is in this
    • containsAny

      public boolean containsAny(VString others)
    • getOverlapping

      public VString getOverlapping(Collection<String> others)
      vector of strings that is contained in this
      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 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:
    • addNonEmpty

      public void addNonEmpty(String text)
      add a string if it is not empty
      Parameters:
      text -