de.grogra.xl.impl.base
Class Producer

java.lang.Object
  extended by de.grogra.xl.impl.base.Producer
All Implemented Interfaces:
Producer, java.util.concurrent.Executor
Direct Known Subclasses:
DOMProducer, RGGProducer, SimpleProducer

public abstract class Producer
extends java.lang.Object
implements Producer, java.util.concurrent.Executor

This class is an abstract base implementation of Producer. It uses subclasses of GraphQueue to represent the queues which store deferred actions of XL.

Author:
Ole Kniemeyer

Field Summary
protected  GraphQueue addNodeQueue
           
protected  GraphQueue deleteEdgeQueue
           
protected  GraphQueue deleteNodeQueue
           
 
Fields inherited from interface de.grogra.xl.query.Producer
DOUBLE_ARROW, EXECUTION_ARROW, SIMPLE_ARROW
 
Constructor Summary
protected Producer(QueryState match)
           
protected Producer(RuntimeModel model)
           
 
Method Summary
protected  void addEdgeImpl(java.lang.Object first, java.lang.Object second, int bits, EdgeDirection direction)
           
protected  void addNodeImpl(java.lang.Object object, boolean addEdge)
           
<N,P> void
connect(N s, N t, P param, Connector<N,P> c)
          Adds an action to the connecting queue q (GraphQueue.CONNECT_DESCRIPTOR) which induces the invocation c.connect(s, t, param, q) on queue application.
 void consume(java.lang.Object node)
           
 void copyIncoming(java.lang.Object s, java.lang.Object t, int edges)
           
 void copyOutgoing(java.lang.Object s, java.lang.Object t, int edges)
           
 void cut()
           
 void execute(java.lang.Runnable r)
           
protected  java.lang.Object getPreviousNode()
           
protected  QueryState getQueryState()
          Returns the match for which this producer constructs the replacement.
<Q extends Queue>
Q
getQueue(QueueDescriptor<Q> descr)
           
 QueueCollection getQueues()
           
 void interpretive()
           
 void moveIncoming(java.lang.Object s, java.lang.Object t, int edges)
           
 void moveOutgoing(java.lang.Object s, java.lang.Object t, int edges)
           
protected  void nodeUsed(java.lang.Object object)
           
protected  void popImpl()
           
 boolean producer$beginExecution(int arrow)
          This method is invoked by the XL run-time system in order to notify the producer about the beginning of a right-hand side (i.e., a match for the left-hand side has been found, and the right-hand side is executed).
 void producer$endExecution(boolean applied)
          This method is invoked by the XL run-time system in order to notify the producer about the end of the execution of a right-hand side.
 Graph producer$getGraph()
          Returns the graph for which this producer constructs the right-hand side structur.
 void producer$visitEdge(EdgePattern pattern)
           
protected  void pushImpl()
           
protected  void separateImpl()
           
 void setConnectionEdges(int edges)
           
 void setInConnectionEdges(int edges)
           
 void setOutConnectionEdges(int edges)
           
 void useOperators(boolean value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addNodeQueue

protected GraphQueue addNodeQueue

deleteEdgeQueue

protected GraphQueue deleteEdgeQueue

deleteNodeQueue

protected GraphQueue deleteNodeQueue
Constructor Detail

Producer

protected Producer(QueryState match)

Producer

protected Producer(RuntimeModel model)
Method Detail

addEdgeImpl

protected final void addEdgeImpl(java.lang.Object first,
                                 java.lang.Object second,
                                 int bits,
                                 EdgeDirection direction)

addNodeImpl

protected void addNodeImpl(java.lang.Object object,
                           boolean addEdge)

connect

public <N,P> void connect(N s,
                          N t,
                          P param,
                          Connector<N,P> c)
Adds an action to the connecting queue q (GraphQueue.CONNECT_DESCRIPTOR) which induces the invocation c.connect(s, t, param, q) on queue application.

Parameters:
s - node of the match for the left hand side of the rule
t - replacing node of the right hand side of the rule
param - some parameter for the connector
c - a connector

consume

public void consume(java.lang.Object node)

copyIncoming

public void copyIncoming(java.lang.Object s,
                         java.lang.Object t,
                         int edges)

copyOutgoing

public void copyOutgoing(java.lang.Object s,
                         java.lang.Object t,
                         int edges)

cut

public void cut()

execute

public void execute(java.lang.Runnable r)
Specified by:
execute in interface java.util.concurrent.Executor

getPreviousNode

protected java.lang.Object getPreviousNode()

getQueryState

protected QueryState getQueryState()
Returns the match for which this producer constructs the replacement. The returned instance is the same as the one in the factory method Graph.createProducer(de.grogra.xl.query.QueryState) which created this producer.

Returns:
the match for which this producer constructs a replacement

getQueue

public <Q extends Queue> Q getQueue(QueueDescriptor<Q> descr)

getQueues

public QueueCollection getQueues()

interpretive

public void interpretive()

moveIncoming

public void moveIncoming(java.lang.Object s,
                         java.lang.Object t,
                         int edges)

moveOutgoing

public void moveOutgoing(java.lang.Object s,
                         java.lang.Object t,
                         int edges)

nodeUsed

protected void nodeUsed(java.lang.Object object)

popImpl

protected void popImpl()

producer$beginExecution

public boolean producer$beginExecution(int arrow)
Description copied from interface: Producer
This method is invoked by the XL run-time system in order to notify the producer about the beginning of a right-hand side (i.e., a match for the left-hand side has been found, and the right-hand side is executed).

Specified by:
producer$beginExecution in interface Producer
Parameters:
arrow - the type of rule arrow, one of Producer.SIMPLE_ARROW, Producer.DOUBLE_ARROW, Producer.EXECUTION_ARROW
Returns:
true if the right-hand side shall be executed, false if its execution shall be skipped

producer$endExecution

public void producer$endExecution(boolean applied)
Description copied from interface: Producer
This method is invoked by the XL run-time system in order to notify the producer about the end of the execution of a right-hand side.

Specified by:
producer$endExecution in interface Producer
Parameters:
applied - return value of invocation of Producer.producer$beginExecution(int)

producer$getGraph

public Graph producer$getGraph()
Description copied from interface: Producer
Returns the graph for which this producer constructs the right-hand side structur.

Specified by:
producer$getGraph in interface Producer
Returns:
the graph on which this producer operates

producer$visitEdge

public void producer$visitEdge(EdgePattern pattern)
Specified by:
producer$visitEdge in interface Producer

pushImpl

protected void pushImpl()

separateImpl

protected void separateImpl()

setConnectionEdges

public void setConnectionEdges(int edges)

setInConnectionEdges

public void setInConnectionEdges(int edges)

setOutConnectionEdges

public void setOutConnectionEdges(int edges)

useOperators

public void useOperators(boolean value)