edu.byu.ece.edif.core
Class AbstractNameSpaceResolver

java.lang.Object
  extended by edu.byu.ece.edif.core.AbstractNameSpaceResolver

public abstract class AbstractNameSpaceResolver
extends java.lang.Object

Abstract class that contains methods for name space resolvers. Other name space classes will call the methods of this one. If another data type is desired for the name space then in the constructor of the other name space object _names is instantiated. This class is abstract and doesn't and doesn't implement an interface because interface methods can't be declared abstract.

TODO: this class supports both maps and collections. This should probably be split up.

Version:
$Id: AbstractNameSpaceResolver.java 130 2008-03-31 16:23:42Z jamesfcarroll $

Constructor Summary
AbstractNameSpaceResolver()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static boolean nameClash(java.util.Collection<NamedPropertyObject> list, java.lang.String newName)
          Return true if name clashes with the name space.
static boolean nameClash(java.util.Map map, java.lang.String newName)
          Return true if name clashes with name space.
static java.lang.String returnNextString(java.lang.String orig)
          The algorithm for creating a new unique name is as follows: - If the conflicting name does not have a "_", add one to the end as well as "a" - Change the last character and "increment" by one (i.e.
static java.lang.String returnUniqueName(java.util.Collection list, java.lang.String name)
          If the name is valid, return name.
static java.lang.String returnUniqueName(java.util.Map map, java.lang.String name)
          If the name is valid, return name.
static void test_string(java.lang.String str)
           
static java.lang.String toString(java.util.Collection list)
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNameSpaceResolver

public AbstractNameSpaceResolver()
Method Detail

main

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

nameClash

public static boolean nameClash(java.util.Collection<NamedPropertyObject> list,
                                java.lang.String newName)
Return true if name clashes with the name space.

Parameters:
newName - Name to check if it already exists in the name space.
list - The name space passed to this method.
Returns:
True if the name clashes, false if it doesn't exist in the name space.

nameClash

public static boolean nameClash(java.util.Map map,
                                java.lang.String newName)
Return true if name clashes with name space.

Parameters:
newName - Name to check if it already exists in the name space.
map - The name space passed to this method.
Returns:
True if the name clashes, false if it doesn't exist in the name space.

returnNextString

public static java.lang.String returnNextString(java.lang.String orig)
The algorithm for creating a new unique name is as follows: - If the conflicting name does not have a "_", add one to the end as well as "a" - Change the last character and "increment" by one (i.e. "a->b") -


returnUniqueName

public static java.lang.String returnUniqueName(java.util.Collection list,
                                                java.lang.String name)
If the name is valid, return name. If not, make it valid. It returns the next available name by using the returnNextString method.

Parameters:
name - Name to modify, and make unique for this name space.
list - The name space passed to this method.
Returns:
The string unique to this name space.

returnUniqueName

public static java.lang.String returnUniqueName(java.util.Map map,
                                                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.

Parameters:
name - Name to modify, and make unique for this name space.
map - The name space passed to this method.
Returns:
The string unique to this name space.

test_string

public static void test_string(java.lang.String str)

toString

public static java.lang.String toString(java.util.Collection list)
Return a string representation of this object.

Returns:
String representing this name space object.