|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Provides a universal, graph based, generic data structure.
This is a Node within the graph data structure.
An INode instance contains an identifer and value. It also
provides a named, ordered list of children that can be accessed by either
identifer or index. The index of the children is 0 based. An
INode instance also contains a list of its parents within the
graph structure.
The clone, equals, hashCode, and
iterator methods all operate shallowly. That is, they only look
to this INode instance for their operations. For deep
operations on an INode instance and its children, see the
net.sourceforge.esw.graph.decorators package.
Since INode inhereits ISupportObject abilities,
INode methods that change any value of an INode
instance must fire a PropertyChangeEvent with a property name
of the property being changed.
When creating an INode implementor, you must also provide an
equals and hashCode methods per the
java.lang.Object's equals and
hashCode method contracts. The default Object
implementations do not provide a rich enough definition for equality
among INode instances. It also provides a property scratchpad
to store information related to this INode instance. Properties
are name/value pairs.
To create an instance of this INode, see
NodeFactory.createNode().
Examples:
INode node = NodeFactory.createNode();
IGraphVisitor,
ISupportObject,
NodeFactory,
Object.equals(java.lang.Object),
Object.hashCode()| Method Summary | |
void |
acceptVisitor(IGraphVisitor aVisitor)
Requests that this INode instance accept the specified
IGraphVisitor instance and that visiting of this
INode struture begin. |
void |
add(INode aNode)
Appends the specified INode child instance to the end of this
INode instances child collection. |
void |
add(INode aNode,
boolean bAddParent)
Appends the specified INode child instance to the end of this
INode instance's child collection. |
void |
addParent(INode aParent)
Sets the parent INode instance for this INode
instance. |
void |
clear()
Removes the children from this INode instance. |
boolean |
containsID(java.lang.Object aId)
Indicates whether this INode instance contains the
specified identifer as a child of this INode instance. |
INode |
get(int aIndex)
Returns the INode child instance at the specified index. |
INode |
get(java.lang.Object aId)
Returns the first INode child instance that contains specified
identifer. |
java.util.List |
getList(java.lang.Object aId)
Returns the List of INode child instances with the specified
identifer. |
java.util.Iterator |
getParents()
Returns an Iterator over the INode parent
instances of this INode instance. |
java.lang.Object |
getValue()
Returns the value of this INode instance |
boolean |
isEmpty()
Indicates whether this INode instance has no children. |
java.util.Iterator |
iterator()
Returns an Iterator over this INode instance's
children. |
void |
remove(INode aNode)
Removes the INode child instance for the specified identifer
from this INode instance if present. |
void |
removeParent(INode aParent)
Removes the specified parent INode instance from this
INode instance. |
void |
setValue(java.lang.Object aValue)
Sets the value for this INode instance. |
int |
size()
Returns the number of children in this INode instance. |
| Methods inherited from interface net.sourceforge.esw.util.ISupportObject |
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty |
| Methods inherited from interface net.sourceforge.esw.util.ICloneable |
clone |
| Method Detail |
public java.lang.Object getValue()
INode instanceINode instance.setValue(Object)public void setValue(java.lang.Object aValue)
INode instance.
Fires an INodeResources.VALUE_PROPERTY property change event.
aValue - the value for this INode instance.getValue()public int size()
INode instance. If the
INode contains more than Integer.MAX_VALUE
elements, returns Integer.MAX_VALUE.INode instance.isEmpty()public boolean isEmpty()
INode instance has no children.true if this INode instance contains no
children.size()public void clear()
INode instance.
Fires an INodeResources.CLEAR_PROPERTY property change event
only if there were children that were cleared from this INode
instance.
public boolean containsID(java.lang.Object aId)
INode instance contains the
specified identifer as a child of this INode instance.aId - the identifer of the child INode instance for which
to search.true if this INode instance contains the
specified child.public java.util.List getList(java.lang.Object aId)
INode child instances with the specified
identifer. The list is in insertion order: the first INode
child instance added to this INode instance is the first
INode child instance in the returned List
instance. Returns null if this INode instance
does not contain any INode child instances with the specified
identifier.
The returned List instance is immutable. That is, you cannot
alter the position or size of the returned List instance.
aId - identifer whose associated INode child instances
are returned.List of INode child instances with
the specified identifer, or null if this
INode contains no children with the specified
identifier.get(Object),
get(int),
remove(INode),
add(INode)public INode get(java.lang.Object aId)
INode child instance that contains specified
identifer. Returns null if this INode instance
does not contain children with specified identifer.aId - identifer whose associated INode child instances
are returned.INode child instances with the specified
identifer, or null if this INode
instance contains no children for this identifer.get(int),
remove(INode),
add(INode)public INode get(int aIndex)
INode child instance at the specified index.
Indexes are 0 based.aIndex - the index of the INode child instance to return.INode child instance at the specified index.ArrayIndexOutOfBoundsException - if there is no value at the
specified index. Said differently,
this INode instance's
size is less than the specified
index.get(Object),
remove(INode),
add(INode)public void remove(INode aNode)
INode child instance for the specified identifer
from this INode instance if present.
Fires an INodeResources.REMOVE_PROPERTY property change event.
aNode - INode child instance to be removed from this
INode instance.get(Object),
get(int),
add(INode)public void add(INode aNode)
INode child instance to the end of this
INode instances child collection. This method automatically
adds this INode instance as a parent of the specified child
INode instance.
Fires an INodeResources.ADD_PROPERTY property change event.
aNode - INode child instance to be appended to this
INode instance.add(INode, boolean),
get(Object),
get(int),
remove(INode)
public void add(INode aNode,
boolean bAddParent)
INode child instance to the end of this
INode instance's child collection. Per the value of the
boolean parameter, will add this INode instance as
a parent of the specified child INode instance.
Fires an INodeResources.ADD_PROPERTY property change event.
aNode - INode child instance to be appended to this
INode instance.bAddParent - if true, will add this INode
instance as the parent of the specified child
INode instance, if false, does
not add parent link to the child.add(INode),
get(Object),
get(int),
remove(INode)public void addParent(INode aParent)
INode instance for this INode
instance.
This method is semantically dangerous to client developers. It could
put the graph structure that this INode instance belongs to
into an inconsistant state. Use this method with caution.
Fires an INodeResources.PARENT_PROPERTY property change event.
aParent - the INode parent instance to be set.removeParent(INode),
getParents()public java.util.Iterator getParents()
Iterator over the INode parent
instances of this INode instance.INode instances for this INode
instance.removeParent(INode),
addParent(INode)public void removeParent(INode aParent)
INode instance from this
INode instance.aParent - the Parent to remove from this INode instance.addParent(INode),
getParents()public java.util.Iterator iterator()
Iterator over this INode instance's
children. This is a shallow operation, iterating through this
INode instance's children and no further child generations.
If you wish deep iterators, see the
net.sourceforge.esw.graph.decorators package.INode child instances of this
INode instance.public void acceptVisitor(IGraphVisitor aVisitor)
INode instance accept the specified
IGraphVisitor instance and that visiting of this
INode struture begin. This is a shallow operation, visiting
this INode instance's children and no further child
generations. If you wish deep visits, see the
net.sourceforge.esw.graph.decorators package.aVisitor - the IGraphVisitor instance to visit the
children of this INode instance.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||