gov.nasa.arc.brahms.common.data
Class QualifiedName

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.QualifiedName

public class QualifiedName
extends java.lang.Object

Used to represent qualified names without using string concatenation A name with the string form "name1.name2.name3" would be represented by new QualifiedName("name3", new QualifiedName("name2", new QualifiedName("name1", null))) This representation saves space when many names share the same prefix.

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:26:19 $ $Author: rnado $
Author:
Bob Nado

Constructor Summary
QualifiedName()
          Constructs an empty QualifiedName
QualifiedName(java.lang.String name)
          Constructs a QualifiedName for a simple name with no qualification
QualifiedName(java.lang.String name, QualifiedName parent)
          Constructs a QualifiedName with a simple name and a parent QualifiedName
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests whether two QualifiedNames are the same.
 java.lang.String getName()
          Returns the last identifier of the qualified name
 QualifiedName getParent()
          Returns the parent QualifiedName that represents all but the last identifier in the qualified name.
 int hashCode()
          Returns a hash code value for the qualified name.
 void setName(java.lang.String name)
          Sets the last identifier of the qualified name
 void setParent(QualifiedName parent)
          Sets the parent QualifiedName that represents all but the last identifier in the qualified name
 java.lang.String toString()
          Returns a string representation of the qualified name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QualifiedName

public QualifiedName()
Constructs an empty QualifiedName


QualifiedName

public QualifiedName(java.lang.String name)
Constructs a QualifiedName for a simple name with no qualification

Parameters:
name - the simple name

QualifiedName

public QualifiedName(java.lang.String name,
                     QualifiedName parent)
Constructs a QualifiedName with a simple name and a parent QualifiedName

Parameters:
name - the last identifier String in the qualified name
parent - the parent QualifiedName
Method Detail

setName

public void setName(java.lang.String name)
Sets the last identifier of the qualified name

Parameters:
name - the last identifier of the qualified name

getName

public java.lang.String getName()
Returns the last identifier of the qualified name

Returns:
String

setParent

public void setParent(QualifiedName parent)
Sets the parent QualifiedName that represents all but the last identifier in the qualified name

Parameters:
parent - the parent QualifiedName

getParent

public QualifiedName getParent()
Returns the parent QualifiedName that represents all but the last identifier in the qualified name. May be null for an unqualified name.

Returns:
QualifiedName the parent qualified name, may be null

equals

public boolean equals(java.lang.Object obj)
Tests whether two QualifiedNames are the same. Two qualified names are regarded as the same if they have the same simple name and their parent QualifiedNames are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object to be compared for equality
Returns:
true if the qualified names are equal, false otherwise

hashCode

public int hashCode()
Returns a hash code value for the qualified name. See Object.hashCode() for a complete description.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this qualified name.

toString

public java.lang.String toString()
Returns a string representation of the qualified name.

Overrides:
toString in class java.lang.Object
Returns:
String the string representation


Copyright © 1997-2012 All Rights Reserved.