de.grogra.xl.impl.simple
Class Graph
java.lang.Object
de.grogra.xl.impl.base.Graph
de.grogra.xl.impl.base.GraphImpl
de.grogra.xl.impl.simple.Graph
- All Implemented Interfaces:
- Graph, java.lang.Cloneable
@HasModel(value=CompiletimeModel.class)
public class Graph
- extends GraphImpl
Method Summary |
void |
addEdgeBits(java.lang.Object source,
java.lang.Object target,
int bits)
Adds a set of edge bits from a source node
to a target node. |
void |
addNode(java.lang.Object node)
Adds a node to this graph extent. |
protected void |
beginModifications()
|
boolean |
canEnumerateEdges(EdgeDirection dir,
boolean constEdge,
java.io.Serializable edge)
|
protected void |
commitModifications()
|
Producer |
createProducer(QueryState match)
Creates an instance of Producer . |
void |
enumerateNodes(Type type,
QueryState qs,
int index,
MatchConsumer consumer,
int arg)
This methods enumerates all nodes of this graph of the given
type to the given MatchConsumer via the given query state. |
java.lang.Object |
getRoot()
Returns the root node of this graph. |
void |
removeEdgeBits(java.lang.Object source,
java.lang.Object target,
int bits)
Removes a set of edge bits from a source node
to a target node. |
void |
removeNode(java.lang.Object node)
|
int |
size()
|
Methods inherited from class de.grogra.xl.impl.base.Graph |
allowNoninjectiveMatchesByDefault, allowNoninjectiveMatchesForNextQuery, canEnumerateNodes, createMatcher, createQueryState, createThreadData, derive, enumerateEdges, getDerivationMode, getModel, getPredecessor, getQueues, getThreadData, setDerivationMode |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Graph
public Graph(RuntimeModel runtime,
boolean canSupplyBackward)
addEdgeBits
public void addEdgeBits(java.lang.Object source,
java.lang.Object target,
int bits)
- Description copied from class:
GraphImpl
- Adds a set of edge bits from a
source
node
to a target
node. This method is invoked
within the right hand sides of XL productions ==>>
,
==>
.
- Specified by:
addEdgeBits
in class GraphImpl
- Parameters:
source
- the source node of the edgetarget
- the target node of the edgebits
- the edge bits that are to be added
addNode
public void addNode(java.lang.Object node)
- Description copied from class:
GraphImpl
- Adds a node to this graph extent. This method is invoked by the
XL runtime system before invocations of
GraphImpl.addEdgeBits(java.lang.Object, java.lang.Object, int)
.
Implementations may perform tasks in preparation of the addition
of edges, if necessary.
- Specified by:
addNode
in class GraphImpl
- Parameters:
node
- the node for which edges will be added later on
beginModifications
protected void beginModifications()
- Specified by:
beginModifications
in class Graph
canEnumerateEdges
public boolean canEnumerateEdges(EdgeDirection dir,
boolean constEdge,
java.io.Serializable edge)
commitModifications
protected void commitModifications()
- Specified by:
commitModifications
in class Graph
createProducer
public Producer createProducer(QueryState match)
- Description copied from interface:
Graph
- Creates an instance of
Producer
. This factory
method creates an instance of a subclass of
Producer
which will be exclusively used later on
in the context of the current match represented by
qs
. The instance must be an
instance of the class returned by
CompiletimeModel.getProducerType()
for the corresponding compile-time model.
The usage of producers is specified by the
XL programming language.
- Parameters:
match
- query state which holds current match for which the producer
shall produce a replacement
- Returns:
- a producer for use in the context of
qs
enumerateNodes
public void enumerateNodes(Type type,
QueryState qs,
int index,
MatchConsumer consumer,
int arg)
- Description copied from interface:
Graph
- This methods enumerates all nodes of this graph of the given
type to the given
MatchConsumer
via the given query state.
I.e., for every
node c
of this extent that has type type
,
the following statement is executed:
qs.amatch (tp, c, consumer, arg);
- Parameters:
type
- the type of nodesqs
- the query state on which the amatch
-method has to be invokedindex
- the index-parameter for the amatch
-methodconsumer
- the consumer-parameter for the amatch
-methodarg
- the arg-parameter for the amatch
-method
getRoot
public java.lang.Object getRoot()
- Description copied from interface:
Graph
- Returns the root node of this graph.
- Returns:
- the root
removeEdgeBits
public void removeEdgeBits(java.lang.Object source,
java.lang.Object target,
int bits)
- Description copied from class:
GraphImpl
- Removes a set of edge bits from a
source
node
to a target
node. This method is invoked
within the right hand sides of XL productions ==>>
,
==>
.
- Specified by:
removeEdgeBits
in class GraphImpl
- Parameters:
source
- the source node of the edgetarget
- the target node of the edgebits
- the edge bits that are to be removed
removeNode
public void removeNode(java.lang.Object node)
- Overrides:
removeNode
in class GraphImpl
size
public int size()