de.grogra.xl.impl.dom
Class Graph

java.lang.Object
  extended by de.grogra.xl.impl.base.Graph
      extended by de.grogra.xl.impl.base.GraphImpl
          extended by de.grogra.xl.impl.dom.Graph
All Implemented Interfaces:
Graph, java.lang.Cloneable

public class Graph
extends GraphImpl


Nested Class Summary
 
Nested classes/interfaces inherited from class de.grogra.xl.impl.base.Graph
Graph.QState, Graph.ThreadData
 
Field Summary
 
Fields inherited from class de.grogra.xl.impl.base.Graph
EXCLUDE_DELETED_FLAG, INTERPRETIVE_FLAG, MODE_MASK, PARALLEL_MODE, PARALLEL_NON_DETERMINISTIC_MODE, SEQUENTIAL_MODE, SEQUENTIAL_NON_DETERMINISTIC_MODE
 
Constructor Summary
Graph(RuntimeModel runtime, org.w3c.dom.Document doc)
           
 
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.
 GraphQueue createQueue(QueueCollection qc, QueueDescriptor descr)
           
 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.
 
Methods inherited from class de.grogra.xl.impl.base.GraphImpl
createInterpretiveMark, removeNode
 
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
 

Constructor Detail

Graph

public Graph(RuntimeModel runtime,
             org.w3c.dom.Document doc)
Method Detail

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 edge
target - the target node of the edge
bits - 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

createQueue

public GraphQueue createQueue(QueueCollection qc,
                              QueueDescriptor descr)
Overrides:
createQueue in class GraphImpl

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 nodes
qs - the query state on which the amatch-method has to be invoked
index - the index-parameter for the amatch-method
consumer - the consumer-parameter for the amatch-method
arg - 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 edge
target - the target node of the edge
bits - the edge bits that are to be removed