ist.palcom.hgraph
Class SiblingReference

java.lang.Object
  extended by ist.palcom.hgraph.SiblingReference

public class SiblingReference
extends java.lang.Object

Sibling references act as a mainteneance structure for mapping between regular objec references and H-graph meta references. Sibling references have a global name, and they may have a local name. Global names change, if the referred IHgraphNode's name change. Local names take precedence over global names, and they are as such overriding when the same


Constructor Summary
SiblingReference(IHgraphNode siblingRef)
          Creates a Sibling Reference from the global name and object reference to the sibling
SiblingReference(java.lang.String localName, IHgraphNode siblingRef)
          Creates a Sibling Reference from a local name and the global name an object reference to the sibling
 
Method Summary
 java.lang.String getGlobalName()
           
 java.lang.String getLocalName()
           
 IHgraphNode getRef()
           
 boolean hasLocalName()
           
 void setGlobalName(java.lang.String globalName)
          Sets the global name.
 void setRef(IHgraphNode ref)
          Sets the object reference.
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SiblingReference

public SiblingReference(IHgraphNode siblingRef)
Creates a Sibling Reference from the global name and object reference to the sibling

Parameters:
siblingRef - The node to be referred

SiblingReference

public SiblingReference(java.lang.String localName,
                        IHgraphNode siblingRef)
Creates a Sibling Reference from a local name and the global name an object reference to the sibling

Parameters:
localName - A local name for the sibling reference. The local name is static and cannot be changed after creation time. It remains the same although the global name is changed.
siblingRef - the node to be referred
Method Detail

hasLocalName

public boolean hasLocalName()
Returns:
True if the sibling reference has a local name. False if not

getLocalName

public java.lang.String getLocalName()
Returns:
The local name of the sibling reference

getGlobalName

public java.lang.String getGlobalName()
Returns:
The global name of the sibling reference

getRef

public IHgraphNode getRef()
Returns:
the Object reference.

setGlobalName

public void setGlobalName(java.lang.String globalName)
Sets the global name. This possibility is required as node names are subject to change

Parameters:
globalName -

setRef

public void setRef(IHgraphNode ref)
Sets the object reference. This possibiliy is required in order to keep the sibling reference up to date if a node is removed and another with the same name is inserted.

Parameters:
ref -

toXML

public java.lang.String toXML()
Returns:
an HgraphXML version of the reference