|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
A Graph
represents a graph-like structure. It consists of
nodes, connected by directed edges. Both nodes and edges are objects,
their classes are not restricted by this interface.
getRootKeys()
returns an array of strings, the
root keys. These are used as arguments to
getRoot(String)
. The returned value is a node, namely the root
of the subgraph identified by the root key. The root key
MAIN_GRAPH
is a predefined root key, it identifies the root
of the main graph which should always be present. Further root keys
may be defined, depending on the Graph
.
getFirstEdge(Object)
with n passed as argument, the
next edges are obtained by getNextEdge(Object, Object)
with
the previous edge as first argument and n as second.
Thus, a loop over all edges of n in a graph g
can be implemented as follows:
for (Object e = g.getFirstEdge(n); e != null; e = g.getNextEdge(e, n)) { // do something with the current edge e }
getSourceNode(Object)
and
getTargetNode(Object)
.
Graph
provides
attribute-like information for nodes and edges:
getId(Object)
.
The inverse method getNodeForId(long)
returns the node identified
by the given id.
getName(Object, boolean)
. The name is not necessarily unique,
the inverse method getObjectForName(boolean, String)
returns
one of the nodes or edges with the given name.
getEdgeBits(Object)
). These are stored in a single
int
-value which is interpreted
as a set of sub-edges in the following way:
SPECIAL_EDGE_MASK
)
represent the edge's special sub-edge.
If these bits, interpreted as a byte, have the value 0, no special
sub-edge is present. Otherwise, the special sub-edge identified by
this byte is present in this edge. The value 255 (all bits set)
is reserved for special purposes. Note that at most one special edge
may exist at a time between an ordered tuple of nodes.
int
-value. It is up to the concrete graph to specify the
meaning of the sub-edges. The Graph
interface provides
three standard meanings: SUCCESSOR_EDGE
, BRANCH_EDGE
,
and CONTAINMENT_EDGE
.
getAttributes(Object, boolean)
. Each attribute is represented by
an instance of Attribute
,
attribute values are read and written
on nodes and edges within the context of a
GraphState
.
getMainState()
), and
only when a write lock has been obtained by
(see Lockable
which is extended by this interface).
Lockable
).
because then it is guaranteed that no other thread may modify the graph
during the invocation (if the other threads conform to these rules).
getTreePattern()
).
Starting at the root of the main graph
(getRoot(String)
, MAIN_GRAPH
), this pattern is used
as a filter to construct a subgraph out of the whole graph. The subgraph
has to be a tree, but it is not necessarily a spanning tree for the whole
graph. The parent attribute (see getParentAttribute()
)
of the graph has to be a derived attribute which has as value for every node
of the tree its parent edge and for every edge of the tree its parent
node. For objects which are not part of the tree the value is
null
.
GraphState
,
Attribute
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.grogra.util.Lockable |
---|
Lockable.DeadLockException |
Field Summary | |
---|---|
static int |
BRANCH_EDGE
The bit mask indicating the presence of a branch edge in edge bits. |
static int |
CONTAINMENT_EDGE
The bit mask indicating the presence of a containment edge in edge bits. |
static int |
CONTAINMENT_END_EDGE
The bit mask indicating the presence in edge bits of an edge signalling "end of containment". |
static int |
EDGENODE_IN_EDGE
|
static int |
EDGENODE_OUT_EDGE
|
static int |
ELLIPSE_SYMBOL
|
static java.lang.String |
MAIN_GRAPH
The predefined root key which identifies the main graph. |
static int |
MARK_EDGE
The bit mask indicating the presence of a mark edge in edge bits. |
static int |
MIN_NORMAL_BIT_INDEX
|
static int |
MIN_UNUSED_EDGE
|
static int |
MIN_UNUSED_EDGE_BIT
|
static int |
NOTIFIES_EDGE
|
static int |
PERSISTENT
Return value for getLifeCycleState(java.lang.Object, boolean) indicating that the object
is persistent, i.e., it belongs the graph. |
static int |
PERSISTENT_DELETED
Return value for getLifeCycleState(java.lang.Object, boolean) indicating that the object
has been persistent and is currently being deleted from the graph. |
static int |
RECTANGLE_SYMBOL
|
static int |
REFINEMENT_EDGE
|
static int |
RHOMBUS_SYMBOL
|
static int |
ROUND_RECTANGLE_SYMBOL
|
static int |
SPECIAL_EDGE_MASK
The bit mask for the special edge in edge bits. |
static int |
SPECIAL_EDGE_OF_SOURCE_BIT
|
static int |
STD_EDGE_5
|
static int |
STD_EDGE_6
|
static int |
SUCCESSOR_EDGE
The bit mask indicating the presence of a successor edge in edge bits. |
static int |
TRANSIENT
Return value for getLifeCycleState(java.lang.Object, boolean) indicating that the object
is transient, i.e., it does not belong to the graph. |
Method Summary | ||
---|---|---|
void |
accept(java.lang.Object startNode,
Visitor visitor,
ArrayPath placeInPath)
|
|
void |
addAttributeChangeListener(AttributeChangeListener l)
|
|
void |
addAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l)
|
|
void |
addChangeBoundaryListener(ChangeBoundaryListener l)
|
|
void |
addEdgeChangeListener(EdgeChangeListener l)
|
|
void |
addEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l)
|
|
BooleanMap |
createBooleanMap()
|
|
|
createObjectMap()
|
|
AttributeAccessor |
getAccessor(java.lang.Object object,
boolean asNode,
Attribute attribute)
Returns an attribute accessor for the given attribute on the given object. |
|
Attribute[] |
getAttributes(java.lang.Object object,
boolean asNode)
Returns the set of attributes which are available for the given object. |
|
int |
getColor(java.lang.Object object,
boolean asNode)
|
|
Attribute[] |
getDependent(java.lang.Object object,
boolean asNode,
Attribute a)
Returns the set of attributes whose values depend on the given attribute a for the given object . |
|
java.lang.Object |
getDescription(java.lang.Object object,
boolean asNode,
java.lang.String type)
Returns a description for the given object. |
|
int |
getEdgeBits(java.lang.Object edge)
Returns the edge bits of an edge. |
|
java.lang.Object |
getFirstEdge(java.lang.Object node)
Returns the first edge of the linked list of edges of node . |
|
long |
getId(java.lang.Object node)
Returns a unique identifier for the given node . |
|
Instantiator |
getInstantiator(java.lang.Object node)
|
|
int |
getLifeCycleState(java.lang.Object object,
boolean asNode)
Returns the life cycle state of the given object as part of this graph. |
|
GraphState |
getMainState()
Returns the main graph state. |
|
java.lang.String |
getName(java.lang.Object object,
boolean asNode)
Returns a name for the given object. |
|
java.lang.Object |
getNextEdge(java.lang.Object edge,
java.lang.Object node)
Returns the edge after edge in the linked list
of edges of node . |
|
java.lang.Object |
getNodeForId(long id)
Returns the node identified by id . |
|
java.lang.Object |
getObjectForName(boolean node,
java.lang.String name)
Returns the object with the given name. |
|
ObjectAttribute |
getParentAttribute()
Defines the derived attribute which has as value the parent object. |
|
java.lang.Object |
getRoot(java.lang.String key)
Returns the root node for the given root key. |
|
java.lang.String[] |
getRootKeys()
Returns the root keys for the graph. |
|
java.lang.Object |
getSourceNode(java.lang.Object edge)
Returns the source node of edge . |
|
SpecialEdgeDescriptor[] |
getSpecialEdgeDescriptors(java.lang.Object node,
boolean asSource)
|
|
int |
getStamp()
Returns a modification stamp for the whole graph. |
|
java.util.Map |
getStateMap()
|
|
int |
getSymbol(java.lang.Object object,
boolean asNode)
|
|
java.lang.Object |
getTargetNode(java.lang.Object edge)
Returns the target node of edge . |
|
EdgePattern |
getTreePattern()
Defines the pattern used for the construction of this graph's tree. |
|
void |
removeAttributeChangeListener(AttributeChangeListener l)
|
|
void |
removeAttributeChangeListener(java.lang.Object object,
boolean asNode,
AttributeChangeListener l)
|
|
void |
removeChangeBoundaryListener(ChangeBoundaryListener l)
|
|
void |
removeEdgeChangeListener(EdgeChangeListener l)
|
|
void |
removeEdgeChangeListener(java.lang.Object object,
boolean asNode,
EdgeChangeListener l)
|
Methods inherited from interface de.grogra.util.Lockable |
---|
execute, execute, executeForcedly, executeForcedly, getMaxWaitingTime, getQueueLength, isLocked |
Field Detail |
---|
static final int BRANCH_EDGE
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int CONTAINMENT_EDGE
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int CONTAINMENT_END_EDGE
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int EDGENODE_IN_EDGE
static final int EDGENODE_OUT_EDGE
static final int ELLIPSE_SYMBOL
static final java.lang.String MAIN_GRAPH
Graph
,
Constant Field Valuesstatic final int MARK_EDGE
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int MIN_NORMAL_BIT_INDEX
static final int MIN_UNUSED_EDGE
static final int MIN_UNUSED_EDGE_BIT
static final int NOTIFIES_EDGE
static final int PERSISTENT
getLifeCycleState(java.lang.Object, boolean)
indicating that the object
is persistent, i.e., it belongs the graph.
static final int PERSISTENT_DELETED
getLifeCycleState(java.lang.Object, boolean)
indicating that the object
has been persistent and is currently being deleted from the graph.
static final int RECTANGLE_SYMBOL
static final int REFINEMENT_EDGE
static final int RHOMBUS_SYMBOL
static final int ROUND_RECTANGLE_SYMBOL
static final int SPECIAL_EDGE_MASK
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int SPECIAL_EDGE_OF_SOURCE_BIT
static final int STD_EDGE_5
static final int STD_EDGE_6
static final int SUCCESSOR_EDGE
Graph
,
getEdgeBits(Object)
,
Constant Field Valuesstatic final int TRANSIENT
getLifeCycleState(java.lang.Object, boolean)
indicating that the object
is transient, i.e., it does not belong to the graph.
Method Detail |
---|
void accept(java.lang.Object startNode, Visitor visitor, ArrayPath placeInPath)
void addAttributeChangeListener(AttributeChangeListener l)
void addAttributeChangeListener(java.lang.Object object, boolean asNode, AttributeChangeListener l)
void addChangeBoundaryListener(ChangeBoundaryListener l)
void addEdgeChangeListener(EdgeChangeListener l)
void addEdgeChangeListener(java.lang.Object object, boolean asNode, EdgeChangeListener l)
BooleanMap createBooleanMap()
<V> ObjectMap<V> createObjectMap()
AttributeAccessor getAccessor(java.lang.Object object, boolean asNode, Attribute attribute)
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgeattribute
- the attribute
Attribute[] getAttributes(java.lang.Object object, boolean asNode)
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edge
int getColor(java.lang.Object object, boolean asNode)
Attribute[] getDependent(java.lang.Object object, boolean asNode, Attribute a)
a
for the given object
.
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgea
- the attribute
java.lang.Object getDescription(java.lang.Object object, boolean asNode, java.lang.String type)
type
; it is interpreted as in
Described.getDescription(String)
.
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edgetype
- the type of description
null
int getEdgeBits(java.lang.Object edge)
edge
- the edge
Graph
java.lang.Object getFirstEdge(java.lang.Object node)
node
.
node
- the common node of the edges of the linked list
Graph
,
getNextEdge(Object, Object)
long getId(java.lang.Object node)
node
.
node
- a node
getNodeForId(long)
Instantiator getInstantiator(java.lang.Object node)
int getLifeCycleState(java.lang.Object object, boolean asNode)
object
- the object to testasNode
- true
if object
is a node,
false
if object
is an edge
PERSISTENT
, PERSISTENT_DELETED
,
TRANSIENT
GraphState getMainState()
Graph
java.lang.String getName(java.lang.Object object, boolean asNode)
object
- the objectasNode
- true
if object
is a node,
false
if object
is an edge
getObjectForName(boolean, String)
java.lang.Object getNextEdge(java.lang.Object edge, java.lang.Object node)
edge
in the linked list
of edges of node
.
edge
- the previous edge in the linked listnode
- the common node of the edges of the linked list
Graph
,
getFirstEdge(Object)
java.lang.Object getNodeForId(long id)
id
.
id
- an identifier
null
if id
identifies no nodegetId(Object)
java.lang.Object getObjectForName(boolean node, java.lang.String name)
null
is returned.
node
- true
if a node of the given name is to be found,
false
if an edge is to be foundname
- the name of the object
null
if no such object existsgetName(Object, boolean)
ObjectAttribute getParentAttribute()
Graph
,
getTreePattern()
java.lang.Object getRoot(java.lang.String key)
key
- a root key, one of getRootKeys()
key
,
or null
if no such root node existsGraph
java.lang.String[] getRootKeys()
Graph
,
getRoot(String)
java.lang.Object getSourceNode(java.lang.Object edge)
edge
.
edge
- an edge
Graph
SpecialEdgeDescriptor[] getSpecialEdgeDescriptors(java.lang.Object node, boolean asSource)
int getStamp()
java.util.Map getStateMap()
int getSymbol(java.lang.Object object, boolean asNode)
java.lang.Object getTargetNode(java.lang.Object edge)
edge
.
edge
- an edge
Graph
EdgePattern getTreePattern()
Graph
,
getParentAttribute()
void removeAttributeChangeListener(AttributeChangeListener l)
void removeAttributeChangeListener(java.lang.Object object, boolean asNode, AttributeChangeListener l)
void removeChangeBoundaryListener(ChangeBoundaryListener l)
void removeEdgeChangeListener(EdgeChangeListener l)
void removeEdgeChangeListener(java.lang.Object object, boolean asNode, EdgeChangeListener l)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |