Esri Geoportal Server
1.0

com.esri.gpt.framework.collection
Class StringSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by java.util.LinkedHashSet<String>
                  extended by com.esri.gpt.framework.collection.StringSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, Set<String>
Direct Known Subclasses:
RoleSet

public class StringSet
extends LinkedHashSet<String>

Maintains an ordered set of strings.

Null values are treated as zero-length strings (empty).
Empty values are only added if flagged as allowed.
Values will be trimmed if flagged.

See Also:
Serialized Form

Constructor Summary
StringSet()
          Default constructor.
StringSet(boolean allowEmptyValues, boolean isCaseSensitive, boolean trimValues)
          Constructs with an empty values allowed flag, a case sensitivity flag and a trimming preference.
 
Method Summary
 boolean add(String value)
          Adds a value to the collection.
 void addDelimited(String demilitedTags)
          Adds a delimited set of tags to the collection.
 void clear()
          Clears the collection.
 boolean contains(Object value)
          Determine if the collection contains a value.
 boolean containsString(String value)
          Determine if the collection contains a value.
protected  boolean getAllowEmptyValues()
          Gets the status indicating whether empty strings are allowed.
protected  boolean getIsCaseSensitive()
          Gets the case sensitive status for a unique list.
protected  boolean getTrimValues()
          Gets the flag indicating whether values will be trimmed.
 boolean remove(Object value)
          Removes a value from the collection.
 boolean remove(String value)
          Removes a value from the collection.
 boolean retainAll(Collection<?> c)
          Retains only those values that are included in the supplied collection.
 
Methods inherited from class java.util.HashSet
clone, isEmpty, iterator, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, isEmpty, iterator, removeAll, size, toArray, toArray
 

Constructor Detail

StringSet

public StringSet()
Default constructor.
Empty values will not be allowed.
The list will not be case sensitive.
Values will be trimmed.


StringSet

public StringSet(boolean allowEmptyValues,
                 boolean isCaseSensitive,
                 boolean trimValues)
Constructs with an empty values allowed flag, a case sensitivity flag and a trimming preference.

Parameters:
allowEmptyValues - true if empty values are allowed
isCaseSensitive - true if the set is case sensitive
trimValues - true if values will be trimmed
Method Detail

getAllowEmptyValues

protected boolean getAllowEmptyValues()
Gets the status indicating whether empty strings are allowed.

Returns:
true if empty strings are allowed

getIsCaseSensitive

protected boolean getIsCaseSensitive()
Gets the case sensitive status for a unique list.
This value is only applicable to a unique list.

Returns:
true if the unique list is case sensitive

getTrimValues

protected boolean getTrimValues()
Gets the flag indicating whether values will be trimmed.

Returns:
true if values will be trimmed

add

public boolean add(String value)
Adds a value to the collection.
Null values are treated as zero-length strings (empty).
Empty values are only added if flagged as allowed.
Values will be trimmed if required.

Specified by:
add in interface Collection<String>
Specified by:
add in interface Set<String>
Overrides:
add in class HashSet<String>
Parameters:
value - the value to add
Returns:
true if the value was added

addDelimited

public void addDelimited(String demilitedTags)
Adds a delimited set of tags to the collection.
The tag is tokenized with the following 3 delimiters:
semi-colon comma space
Tokens are trimmed.
Null or zero length tokens are ignored.
Example: addDelimited("a b,c;d e") results in 5 tags a b c d e

Parameters:
demilitedTags - the tag to add

clear

public void clear()
Clears the collection.

Specified by:
clear in interface Collection<String>
Specified by:
clear in interface Set<String>
Overrides:
clear in class HashSet<String>

contains

public boolean contains(Object value)
Determine if the collection contains a value.

Specified by:
contains in interface Collection<String>
Specified by:
contains in interface Set<String>
Overrides:
contains in class HashSet<String>
Parameters:
value - the value to check
Returns:
true if the value is contained within the collection

containsString

public boolean containsString(String value)
Determine if the collection contains a value.

Parameters:
value - the value to check
Returns:
true if the value is contained within the collection

remove

public boolean remove(Object value)
Removes a value from the collection.

Specified by:
remove in interface Collection<String>
Specified by:
remove in interface Set<String>
Overrides:
remove in class HashSet<String>
Parameters:
value - the value to remove
Returns:
true if the value was removed

remove

public boolean remove(String value)
Removes a value from the collection.

Parameters:
value - the value to remove
Returns:
true if the value was removed

retainAll

public boolean retainAll(Collection<?> c)
Retains only those values that are included in the supplied collection.

Specified by:
retainAll in interface Collection<String>
Specified by:
retainAll in interface Set<String>
Overrides:
retainAll in class AbstractCollection<String>
Parameters:
c - the collection defining the values to retain
Returns:
true if the collection was modified

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.