|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.graph.impl.Edge de.grogra.graph.impl.Node
public class Node
This class represents the base class of nodes in a
GraphManager
. Such a graph is used, e.g.,
as the project graph of the GroIMP software.
Node
extends Edge
: A Node
is
able to represent not only itself, but also a single incoming edge.
The advantage of this feature is the reduced number of instances for
a given graph. E.g., a tree graph with N nodes has
N-1 edges. Assuming that they point from a parent to child,
all these edges can be represented as part of the child node instances.
If a node is part of the graph of GraphManager
,
it can be identified by its unique id. A node also
has a name, however, this may be null
and is not unique. Nevertheless, the graph maintains a
map
from names to nodes which may be used to efficiently obtain nodes
having some specified name.
Nested Class Summary | |
---|---|
static class |
Node.AccessorBridge
|
static class |
Node.FieldAttributeAccessor
|
static class |
Node.NType
|
Nested classes/interfaces inherited from interface de.grogra.util.Map |
---|
Map.Chain |
Field Summary | |
---|---|
static Node.NType |
$TYPE
|
static ObjectAttribute |
ADDITIONAL_FIELDS
|
protected int |
bits
This field packs the information of some boolean
and integral attributes into a single 32-bit value. |
static int |
DELETED
|
static int |
EXTENT_BIT
|
static int |
EXTENT_MASK
|
static Node.NType.Field |
extentIndex$FIELD
|
static Node.NType.Field |
extentTail$FIELD
|
static int |
HAS_OBSERVERS
|
static int |
IS_INTERPRETIVE
|
static Node.NType.Field |
isInterpretive$FIELD
|
static int |
LAST_EXTENT_INDEX
|
static Node.NType.Field |
layer$FIELD
|
static int |
MARK
|
static Node.NType.Field |
mark$FIELD
|
static MimeType |
MIME_TYPE
|
static int |
MIN_UNUSED_SPECIAL_OF_SOURCE
|
static int |
MIN_UNUSED_SPECIAL_OF_TARGET
|
static Node.NType.Field |
name$FIELD
|
static int |
USED_BITS
|
Fields inherited from interface de.grogra.util.Map |
---|
DEFAULT_VALUE, EMPTY_MAP |
Constructor Summary | |
---|---|
Node()
|
Method Summary | |
---|---|
void |
addEdgeBitsTo(Node target,
int edges,
Transaction t)
|
void |
addReference(SharedObjectReference ref)
|
void |
appendBranchNode(Node node)
|
void |
appendBranchNode(Node node,
Transaction xa)
|
void |
appendReferencesTo(java.util.List out)
|
protected java.lang.Object |
clone()
|
Node |
clone(boolean cloneFields)
Creates a clone of this node using the methods newInstance() and dup(de.grogra.graph.impl.Node, boolean, de.grogra.persistence.Transaction) . |
Node |
cloneGraph(EdgePattern edges,
boolean cloneFields)
|
void |
dump()
|
void |
dumpTree()
|
void |
dup(Node original,
boolean cloneFields,
Transaction t)
|
protected void |
dupUnmanagedFields(Node original)
|
protected void |
edgeChanged(Edge set,
int old,
Transaction t)
|
void |
fieldModified(PersistenceField field,
int[] indices,
Transaction t)
|
Node |
findAdjacent(boolean in,
boolean out,
int edgeBits)
Find an adjacent node n to this one. |
java.lang.Object |
get(java.lang.Object key,
java.lang.Object defaultValue)
Returns the value associated with key . |
AttributeAccessor |
getAccessor(Attribute attribute)
|
AttributeAccessor |
getAccessor(java.lang.String name)
|
Attribute[] |
getAttributes()
|
Node |
getAxisParent()
Returns the parent node of this node. |
protected boolean |
getBoolean(BooleanAttribute a,
GraphState gs)
|
Node |
getBranch()
Returns the first child of this node. |
int |
getBranchLength()
|
Node |
getBranchNode(int index)
Returns the index -th child of this node. |
Node |
getBranchTail()
|
protected byte |
getByte(ByteAttribute a,
GraphState gs)
|
protected char |
getChar(CharAttribute a,
GraphState gs)
|
Node |
getCommonAncestor(Node n)
|
GraphState |
getCurrentGraphState()
|
int |
getDirectChildCount()
|
protected double |
getDouble(DoubleAttribute a,
GraphState gs)
|
AttributeAccessor |
getEdgeAttributeAccessor(Attribute attribute)
|
Attribute[] |
getEdgeAttributes(Edge edge)
|
int |
getEdgeBitsTo(Node target)
|
Edge |
getEdgeTo(Node target)
|
int |
getExtentIndex()
Returns the extentIndex property of this node. |
Node |
getFirst(int edgeBits)
|
Edge |
getFirstEdge()
|
protected float |
getFloat(FloatAttribute a,
GraphState gs)
|
GraphManager |
getGraph()
|
long |
getId()
Returns a unique ID for this node. |
int |
getIndex()
Returns the index of this node in the list of children of its parent. |
Instantiator |
getInstantiator()
|
protected int |
getInt(IntAttribute a,
GraphState gs)
|
int |
getLayer()
|
protected long |
getLong(LongAttribute a,
GraphState gs)
|
ManageableType |
getManageableType()
|
java.lang.String |
getName()
Returns the name of this node. |
Node |
getNeighbor(Node start)
|
Edge |
getNext(Node parent)
|
Node.NType |
getNType()
|
protected Node.NType |
getNTypeImpl()
This method returns the Node.NType which describes the managed
fields of the class of this node. |
protected java.lang.Object |
getObject(ObjectAttribute a,
java.lang.Object placeIn,
GraphState gs)
|
Edge |
getOrCreateEdgeTo(Node target)
|
java.lang.Object |
getOrNull(java.lang.Object key)
|
PersistenceManager |
getPersistenceManager()
|
Node |
getPredecessor()
Returns the previous sibling of this node. |
SharedObjectProvider |
getProvider()
|
protected short |
getShort(ShortAttribute a,
GraphState gs)
|
Node |
getSource()
|
int |
getStamp()
Returns a stamp for this object. |
Node |
getSuccessor()
Returns the next sibling of this node. |
int |
getSymbol()
|
int |
getSymbolColor()
|
Node |
getTarget()
|
Transaction |
getTransaction(boolean create)
|
Field |
getUserField(int index)
|
int |
getUserFieldCount()
|
XClass |
getXClass()
|
de.grogra.graph.impl.NodeData |
getXData()
|
boolean |
hasName(java.lang.String name)
Tests if this node has the specified name . |
void |
initProvider(SharedObjectProvider provider)
|
void |
initXClass(XClass cls)
|
void |
insertBranchNode(int index,
Node node)
|
void |
insertBranchNode(int index,
Node node,
Transaction xa)
|
boolean |
instantiateGraph(int edges,
ArrayPath path,
Visitor v)
|
boolean |
isAncestorOf(Node n)
|
boolean |
isDirection(Node source,
Node target)
|
boolean |
isManagingInstance()
|
boolean |
isMarked()
|
boolean |
isRoot()
|
boolean |
isSource(Node node)
|
boolean |
isTarget(Node node)
|
Manageable |
manageableReadResolve()
|
java.lang.Object |
manageableWriteReplace()
|
protected Node |
newInstance()
This method returns a new instance of the class of this node. |
protected java.lang.String |
paramString()
Computes the class-specific part of the string returned by toString() which shall be enclosed in brackets. |
void |
removeAll(Transaction t)
|
void |
removeEdgeBitsTo(Node target,
int edges,
Transaction t)
|
void |
removeFromChain()
|
void |
removeFromChain(Transaction t)
|
void |
removeReference(SharedObjectReference ref)
|
void |
setBranch(Node c)
|
void |
setBranch(Node c,
Transaction xa)
|
void |
setExtentIndex(int index)
Sets the extentIndex property of this node |
GraphManager |
setGraphForDeserialization(GraphManager mgr)
When a serialized stream containing references to already existing nodes is deserialized, the graph to use for resolving the id-based references has to be specified by this method. |
void |
setLayer(int layer)
|
void |
setMark(boolean value)
|
void |
setName(java.lang.String name)
Sets the name of this node. |
void |
setSuccessor(Node s)
|
void |
setSuccessor(Node s,
Transaction xa)
|
protected void |
specialEdgeAdded(Edge set,
Transaction t)
|
protected void |
specialEdgeRefModified(Node ref,
Node.NType.Field edgeField,
PersistenceField field,
int[] indices,
Transaction t)
|
protected void |
specialEdgeRemoved(Edge set,
int old,
Transaction t)
|
java.lang.String |
toString()
|
protected java.lang.Object |
writeReplace()
This method is used by object serialization. |
Methods inherited from class de.grogra.graph.impl.Edge |
---|
addEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.grogra.persistence.PersistenceCapable |
---|
getBitMark, getObjectMark, setBitMark, setObjectMark |
Field Detail |
---|
public static final Node.NType $TYPE
public static final ObjectAttribute ADDITIONAL_FIELDS
protected int bits
boolean
and integral attributes into a single 32-bit value. The bits defined
in the base class Node
are the first
USED_BITS
bits, starting at bit 0.
public static final int DELETED
public static final int EXTENT_BIT
public static final int EXTENT_MASK
public static final Node.NType.Field extentIndex$FIELD
public static final Node.NType.Field extentTail$FIELD
public static final int HAS_OBSERVERS
public static final int IS_INTERPRETIVE
public static final Node.NType.Field isInterpretive$FIELD
public static final int LAST_EXTENT_INDEX
public static final Node.NType.Field layer$FIELD
public static final int MARK
public static final Node.NType.Field mark$FIELD
public static final MimeType MIME_TYPE
public static final int MIN_UNUSED_SPECIAL_OF_SOURCE
public static final int MIN_UNUSED_SPECIAL_OF_TARGET
public static final Node.NType.Field name$FIELD
public static final int USED_BITS
Constructor Detail |
---|
public Node()
Method Detail |
---|
public final void addEdgeBitsTo(Node target, int edges, Transaction t)
public void addReference(SharedObjectReference ref)
addReference
in interface Shareable
public void appendBranchNode(Node node)
public void appendBranchNode(Node node, Transaction xa)
public void appendReferencesTo(java.util.List out)
appendReferencesTo
in interface Shareable
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public Node clone(boolean cloneFields) throws java.lang.CloneNotSupportedException
newInstance()
and dup(de.grogra.graph.impl.Node, boolean, de.grogra.persistence.Transaction)
. The clone is not part of
the graph.
cloneFields
- perform a deep clone of field values?
java.lang.CloneNotSupportedException
public Node cloneGraph(EdgePattern edges, boolean cloneFields) throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public void dump()
public void dumpTree()
public void dup(Node original, boolean cloneFields, Transaction t) throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
protected void dupUnmanagedFields(Node original)
protected void edgeChanged(Edge set, int old, Transaction t)
public void fieldModified(PersistenceField field, int[] indices, Transaction t)
fieldModified
in interface Manageable
public Node findAdjacent(boolean in, boolean out, int edgeBits)
Edge.testEdgeBits(int)
).
If out is true and this node is the source or if in is true and this node
is the target, n is returned. Thus, if in and out is true, any adjacent
node where the connecting edge matches the edgeBits is considered.
in
- true if edges incoming to this node should be consideredout
- true if edges outgoing from this node should be considerededgeBits
- the type/types of edges to consider
public java.lang.Object get(java.lang.Object key, java.lang.Object defaultValue)
Map
key
. If there is
no value associated with key
, defaultValue
is returned.
get
in interface Map
key
- a key for the mapdefaultValue
- the default value
defaultValue
public AttributeAccessor getAccessor(Attribute attribute)
public AttributeAccessor getAccessor(java.lang.String name)
public Attribute[] getAttributes()
public Node getAxisParent()
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
.
getBranch()
protected boolean getBoolean(BooleanAttribute a, GraphState gs)
public Node getBranch()
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
:
The first child of a node is reached by traversing a
Graph.BRANCH_EDGE
in forward direction, its siblings
are reached by traversing Graph.SUCCESSOR_EDGE
in forward
direction from sibling to sibling.
null
public int getBranchLength()
public Node getBranchNode(int index)
index
-th child of this node.
The underlying tree structure is defined by the edges
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
.
index
- an index
index
-th childgetBranch()
public Node getBranchTail()
protected byte getByte(ByteAttribute a, GraphState gs)
protected char getChar(CharAttribute a, GraphState gs)
public Node getCommonAncestor(Node n)
public final GraphState getCurrentGraphState()
public int getDirectChildCount()
protected double getDouble(DoubleAttribute a, GraphState gs)
public AttributeAccessor getEdgeAttributeAccessor(Attribute attribute)
public Attribute[] getEdgeAttributes(Edge edge)
public final int getEdgeBitsTo(Node target)
public final Edge getEdgeTo(Node target)
public int getExtentIndex()
extentIndex
property of this node.
This determines the index of the list of the
Extent
in which this node is inserted.
public Node getFirst(int edgeBits)
public final Edge getFirstEdge()
protected float getFloat(FloatAttribute a, GraphState gs)
public final GraphManager getGraph()
public final long getId()
getId
in interface PersistenceCapable
public int getIndex()
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
.
getBranch()
public Instantiator getInstantiator()
protected int getInt(IntAttribute a, GraphState gs)
public int getLayer()
protected long getLong(LongAttribute a, GraphState gs)
public final ManageableType getManageableType()
getManageableType
in interface Manageable
public final java.lang.String getName()
null
. The graph of this node maintains a map from names
to nodes, see GraphManager.getNodeForName(String)
.
null
public final Node getNeighbor(Node start)
getNeighbor
in class Edge
public final Edge getNext(Node parent)
getNext
in class Edge
public final Node.NType getNType()
protected Node.NType getNTypeImpl()
Node.NType
which describes the managed
fields of the class of this node. This method has to be implemented
in every concrete subclass.
protected java.lang.Object getObject(ObjectAttribute a, java.lang.Object placeIn, GraphState gs)
public final Edge getOrCreateEdgeTo(Node target)
public java.lang.Object getOrNull(java.lang.Object key)
public final PersistenceManager getPersistenceManager()
getPersistenceManager
in interface PersistenceCapable
public Node getPredecessor()
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
.
getBranch()
public SharedObjectProvider getProvider()
getProvider
in interface Shareable
protected short getShort(ShortAttribute a, GraphState gs)
public final Node getSource()
getSource
in class Edge
public int getStamp()
Manageable
getStamp
in interface Manageable
public Node getSuccessor()
Graph.BRANCH_EDGE
and Graph.SUCCESSOR_EDGE
.
getBranch()
public int getSymbol()
public int getSymbolColor()
public final Node getTarget()
getTarget
in class Edge
public final Transaction getTransaction(boolean create)
public Field getUserField(int index)
getUserField
in interface UserFields
public int getUserFieldCount()
getUserFieldCount
in interface UserFields
public final XClass getXClass()
getXClass
in interface XObject
public final de.grogra.graph.impl.NodeData getXData()
getXData
in interface XObject
public final boolean hasName(java.lang.String name)
name
. I.e., both
name
and this node's name are null
, or
they consist of the same sequence of characters.
name
- a name to test
name
?public void initProvider(SharedObjectProvider provider)
initProvider
in interface Shareable
public final void initXClass(XClass cls)
initXClass
in interface XObject
public void insertBranchNode(int index, Node node)
public void insertBranchNode(int index, Node node, Transaction xa)
public boolean instantiateGraph(int edges, ArrayPath path, Visitor v)
public boolean isAncestorOf(Node n)
public boolean isDirection(Node source, Node target)
isDirection
in class Edge
public boolean isManagingInstance()
public boolean isMarked()
public boolean isRoot()
public boolean isSource(Node node)
isSource
in class Edge
public boolean isTarget(Node node)
isTarget
in class Edge
public Manageable manageableReadResolve()
manageableReadResolve
in interface Manageable
public java.lang.Object manageableWriteReplace()
manageableWriteReplace
in interface Manageable
protected Node newInstance()
protected java.lang.String paramString()
toString()
which shall be enclosed in brackets. This
should be used to show important properties of this node.
public final void removeAll(Transaction t)
public final void removeEdgeBitsTo(Node target, int edges, Transaction t)
public void removeFromChain()
public void removeFromChain(Transaction t)
public void removeReference(SharedObjectReference ref)
removeReference
in interface Shareable
public void setBranch(Node c)
public void setBranch(Node c, Transaction xa)
public void setExtentIndex(int index)
extentIndex
property of this node
index
- new value for propertygetExtentIndex()
public GraphManager setGraphForDeserialization(GraphManager mgr)
mgr
- the graph to use for id-resolution within deserialization
null
public void setLayer(int layer)
public void setMark(boolean value)
public void setName(java.lang.String name)
name
- new name of node, may be null
getName()
public void setSuccessor(Node s)
public void setSuccessor(Node s, Transaction xa)
protected void specialEdgeAdded(Edge set, Transaction t)
protected void specialEdgeRefModified(Node ref, Node.NType.Field edgeField, PersistenceField field, int[] indices, Transaction t)
protected void specialEdgeRemoved(Edge set, int old, Transaction t)
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.Object writeReplace()
Serializable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |