ist.palcom.hgraph
Class SiblingFunc

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

public class SiblingFunc
extends java.lang.Object

Sibling functionality for H-Graph nodes. This class provides functionality for holding and maintaining a set of Sibling References.


Field Summary
static java.lang.String CHILDSIBLINGREFERENCES_TAG
           
static java.lang.String SIBLINGREFERENCES_TAG
           
 
Constructor Summary
SiblingFunc(IHgraphNode node)
           
 
Method Summary
 int addChildSiblingReference(java.lang.String referer, java.lang.String referee)
          Creates a new child sibling reference and adds it to the local map.
 int addSiblingReference(SiblingReference ref)
          Adds a sibling reference to the local sibling reference map.
 int childSatName(java.lang.String oldName, java.lang.String newName)
          Called when a child name is sat.
 java.lang.String childSiblingReferenceMapToXML()
           
 IHgraphNode getSiblingReference(java.lang.String name)
           
 java.lang.Object getSiblingReferenceFromGlobalName(java.lang.String name)
           
 java.lang.Object getSiblingReferenceFromLocalName(java.lang.String name)
           
 int removeSiblingReference(SiblingReference ref)
          Removes a specific sibling reference
 int removeSiblingReference(java.lang.String name)
          Removes a sibling reference based on its name.
 java.lang.String siblingReferencesToXML()
           
 void updateChildSiblingReferences(java.lang.String name, IHgraphNode ref)
          Called when the node with some given global name changes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIBLINGREFERENCES_TAG

public static final java.lang.String SIBLINGREFERENCES_TAG
See Also:
Constant Field Values

CHILDSIBLINGREFERENCES_TAG

public static final java.lang.String CHILDSIBLINGREFERENCES_TAG
See Also:
Constant Field Values
Constructor Detail

SiblingFunc

public SiblingFunc(IHgraphNode node)
Method Detail

childSatName

public int childSatName(java.lang.String oldName,
                        java.lang.String newName)
Called when a child name is sat. The method traverses the children referring to the node and updates their naming of it


updateChildSiblingReferences

public void updateChildSiblingReferences(java.lang.String name,
                                         IHgraphNode ref)
Called when the node with some given global name changes

Parameters:
name - The global name of the child whose reference is changed
ref - The new reference of the child

addChildSiblingReference

public int addChildSiblingReference(java.lang.String referer,
                                    java.lang.String referee)
Creates a new child sibling reference and adds it to the local map. These are the primary means for maintaining the sibling references of the children

Parameters:
referer -
referee -
Returns:
an int indicating the status of the method

addSiblingReference

public int addSiblingReference(SiblingReference ref)
Adds a sibling reference to the local sibling reference map. These are maintained across both global name and reference changes

Returns:
a status message
See Also:
SiblingReference

removeSiblingReference

public int removeSiblingReference(java.lang.String name)
Removes a sibling reference based on its name. This name is firstly assumed to be a local name, but if none is found, the method commences searching assuming it to be a global name

Parameters:
name -
Returns:
a status message

removeSiblingReference

public int removeSiblingReference(SiblingReference ref)
Removes a specific sibling reference

Parameters:
ref -
Returns:
a status message

getSiblingReference

public IHgraphNode getSiblingReference(java.lang.String name)
Returns:
the sibling reference with the given name. Naming is scoped, taking frst local then global names. null if none exists

getSiblingReferenceFromLocalName

public java.lang.Object getSiblingReferenceFromLocalName(java.lang.String name)
Returns:
the sibling reference with the given local name. null if none exists

getSiblingReferenceFromGlobalName

public java.lang.Object getSiblingReferenceFromGlobalName(java.lang.String name)
Returns:
the sibling reference with the given global name. null if none exists

siblingReferencesToXML

public java.lang.String siblingReferencesToXML()
Returns:
an hgraphMXL representation of the sibling references of the given node. If no node are present, the string is empty

childSiblingReferenceMapToXML

public java.lang.String childSiblingReferenceMapToXML()
Returns:
an hgraphXML representation of the sibling references of the given nodes children. If node are present, the string is empty