byucc.edif
Class HashSetNameSpaceResolver

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjava.util.HashSet
              extended bybyucc.edif.HashSetNameSpaceResolver
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, NameSpaceResolver, java.io.Serializable, java.util.Set

public class HashSetNameSpaceResolver
extends java.util.HashSet
implements NameSpaceResolver, java.io.Serializable

Implements an unordered name space using a HashSet.

Version:
$Id: HashSetNameSpaceResolver.java,v 1.10 2004/08/27 19:16:42 tsa6 Exp $
Author:
Eric Johnson, Tyler Anderson
See Also:
AbstractNameSpaceResolver, NameSpaceResolver, Serialized Form

Field Summary
 
Fields inherited from class java.util.HashSet
 
Constructor Summary
HashSetNameSpaceResolver()
          Constructs an empty HashSetNameSpaceResolver Object.
 
Method Summary
 boolean add(NamedPropertyObject name)
          Adds a name if it doesn't clash with an existing name and return true.
static void main(java.lang.String[] args)
           
 boolean nameClash(java.lang.String name)
          Returns true if name does not clash with name space.
 java.lang.String returnUniqueName(java.lang.String name)
          If the name is valid, return name.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
 
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, removeAll, retainAll, toArray, toArray
 

Constructor Detail

HashSetNameSpaceResolver

public HashSetNameSpaceResolver()
Constructs an empty HashSetNameSpaceResolver Object.

Method Detail

add

public boolean add(NamedPropertyObject name)
Adds a name if it doesn't clash with an existing name and return true. If it does clash, return false and don't add.

Parameters:
name - Name to add to the name space.
Returns:
True if the name was added to the name space, otherwise, false.

nameClash

public boolean nameClash(java.lang.String name)
Returns true if name does not clash with name space.

Specified by:
nameClash in interface NameSpaceResolver
Parameters:
name - Name to check if it already exists in the name space.
Returns:
True if the name clashes, false if it doesn't exist in the name space.

returnUniqueName

public java.lang.String returnUniqueName(java.lang.String name)
If the name is valid, return name. If not, make it valid. It grabs a random element from an array and keeps appending it from the array.

Specified by:
returnUniqueName in interface NameSpaceResolver
Parameters:
name - Name to modify, and make unique for this name space.
Returns:
The string unique to this name space.

toString

public java.lang.String toString()
Returns a string representation of this object.

Specified by:
toString in interface NameSpaceResolver
Returns:
String representing this name space object.

main

public static void main(java.lang.String[] args)