Package org.jibx.util
Class UniqueNameSet
java.lang.Object
org.jibx.util.UniqueNameSet
Set of unique names for a context. This assures uniqueness as names are added to the set.
- Author:
- Dennis M. Sosnoski
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.UniqueNameSet
(Collection base) Constructor from existing name collection.UniqueNameSet
(UniqueNameSet original) Copy constructor. -
Method Summary
-
Field Details
-
m_nameSet
Set of names used.
-
-
Constructor Details
-
UniqueNameSet
public UniqueNameSet()Constructor. -
UniqueNameSet
Constructor from existing name collection. Creates a name set initialized to contain all the supplied names.- Parameters:
base
-
-
UniqueNameSet
Copy constructor. Creates a name set initialized to contain all the names from another name set.- Parameters:
original
-
-
-
Method Details
-
contains
Check if a name is already present in context.- Parameters:
name
-- Returns:
true
if present,false
if not
-
addAll
Add all the names from another name set to this set. This does not check for conflicts between the names in the two sets.- Parameters:
other
-
-
add
Add name to set. If the supplied name is already present, it is modified by appending a variable suffix. If the supplied name ends with a digit, the suffix is generated starting with the letter 'a'; otherwise, it's generated starting at '1'. Either way, the suffix is incremented as many times as necessary to obtain a unique name.- Parameters:
base
- name to try adding- Returns:
- assigned name
-
iterator
Get iterator for names in set.- Returns:
- iterator
-