|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.xl.impl.base.Graph
public abstract class Graph
This class is an abstract base class for implementations of
XL's runtime model for graph-like structures. Graph
represents a single graph on which XL's query statements
may operate.
The package documentation contains more information about the structure of the graph that is implied by this base class.
The current derivation mode for rule applications acting on this graph
is set by setDerivationMode(int)
and may be truly parallel
(PARALLEL_MODE
), parallel and non-deterministic
(PARALLEL_NON_DETERMINISTIC_MODE
, one application is chosen
out of several applications which delete the same node),
sequential (SEQUENTIAL_MODE
, only the first rule application
per derivation step is used), or sequential and non-deterministic
(SEQUENTIAL_NON_DETERMINISTIC_MODE
, only one rule application
per derivation step is used).
Nested Class Summary | |
---|---|
class |
Graph.QState
|
protected static class |
Graph.ThreadData
|
Field Summary | |
---|---|
static int |
EXCLUDE_DELETED_FLAG
Bit mask for getDerivationMode() which indicates that
nodes which were already deleted by previous rule applications
of the current derivation step shall be excluded from further
matches of the same step. |
static int |
INTERPRETIVE_FLAG
Bit mask for getDerivationMode() which indicates that
rules have to be applied as interpretive rules. |
static int |
MODE_MASK
Mask for getDerivationMode() to obtain the mode part
(one of PARALLEL_MODE ,
PARALLEL_NON_DETERMINISTIC_MODE ,
SEQUENTIAL_MODE , SEQUENTIAL_NON_DETERMINISTIC_MODE ). |
static int |
PARALLEL_MODE
Bit mask for getDerivationMode() indicating a true parallel
derivation mode. |
static int |
PARALLEL_NON_DETERMINISTIC_MODE
Bit mask for getDerivationMode() indicating a parallel
non-deterministic derivation mode. |
static int |
SEQUENTIAL_MODE
Bit mask for getDerivationMode() indicating a sequential
derivation mode. |
static int |
SEQUENTIAL_NON_DETERMINISTIC_MODE
Bit mask for getDerivationMode() indicating a sequential
derivation mode. |
Constructor Summary | |
---|---|
Graph(RuntimeModel model)
|
Method Summary | |
---|---|
void |
allowNoninjectiveMatchesByDefault(boolean value)
|
void |
allowNoninjectiveMatchesForNextQuery(boolean value)
Deprecated. |
protected abstract void |
beginModifications()
|
boolean |
canEnumerateNodes(Type type)
Can nodes of the specified type be enumerated? |
protected abstract void |
commitModifications()
|
Pattern.Matcher |
createMatcher(Pattern pred,
XBitSet providedConstants,
IntList neededConstantsOut)
|
Graph.QState |
createQueryState()
Creates a query state to be used for queries which use this graph. |
protected abstract GraphQueue |
createQueue(QueueCollection qc,
QueueDescriptor descr)
|
protected Graph.ThreadData |
createThreadData()
|
long |
derive()
|
void |
enumerateEdges(java.lang.Object node,
EdgeDirection dir,
Type edgeType,
QueryState qs,
int toIndex,
int patternIndex,
java.io.Serializable pattern,
int matchIndex,
MatchConsumer consumer,
int arg)
|
int |
getDerivationMode()
Returns the current derivation mode. |
RuntimeModel |
getModel()
Returns this graph's run-time model. |
protected java.lang.Object |
getPredecessor(java.lang.Object node)
|
QueueCollection |
getQueues()
|
protected Graph.ThreadData |
getThreadData()
|
void |
setDerivationMode(int mode)
Sets the current derivation mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.grogra.xl.query.Graph |
---|
canEnumerateEdges, createProducer, enumerateNodes, getRoot |
Field Detail |
---|
public static final int EXCLUDE_DELETED_FLAG
getDerivationMode()
which indicates that
nodes which were already deleted by previous rule applications
of the current derivation step shall be excluded from further
matches of the same step.
public static final int INTERPRETIVE_FLAG
getDerivationMode()
which indicates that
rules have to be applied as interpretive rules.
public static final int MODE_MASK
getDerivationMode()
to obtain the mode part
(one of PARALLEL_MODE
,
PARALLEL_NON_DETERMINISTIC_MODE
,
SEQUENTIAL_MODE
, SEQUENTIAL_NON_DETERMINISTIC_MODE
).
public static final int PARALLEL_MODE
getDerivationMode()
indicating a true parallel
derivation mode. All rules are applied via every possible match in
parallel. A single node may be deleted by several rule applications.
public static final int PARALLEL_NON_DETERMINISTIC_MODE
getDerivationMode()
indicating a parallel
non-deterministic derivation mode. It is ensured that a single node is
deleted by at most one actual rule application. If several potential
rule applications delete the same node, one actual application is chosen
pseudo-randomly.
public static final int SEQUENTIAL_MODE
getDerivationMode()
indicating a sequential
derivation mode. Only one rule application is performed in a single step
(as marked by derive()
). If several
applications are possible, only the first one is chosen.
public static final int SEQUENTIAL_NON_DETERMINISTIC_MODE
getDerivationMode()
indicating a sequential
derivation mode. Only one rule application is performed in a single step
(as marked by derive()
). If several
applications are possible, one is chosen pseudo-randomly.
Constructor Detail |
---|
public Graph(RuntimeModel model)
Method Detail |
---|
public void allowNoninjectiveMatchesByDefault(boolean value)
@Deprecated public void allowNoninjectiveMatchesForNextQuery(boolean value)
protected abstract void beginModifications()
public boolean canEnumerateNodes(Type type)
Graph
type
be enumerated? This
method returns true
iff this graph can enumerate
nodes of the given type
using the method
Graph.enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int)
.
canEnumerateNodes
in interface Graph
type
- the type of nodes
true
iff nodes of type
can be enumeratedprotected abstract void commitModifications()
public Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
createMatcher
in interface Graph
public Graph.QState createQueryState()
Graph
CompiletimeModel.getQueryStateType()
of the corresponding compile-time model.
createQueryState
in interface Graph
protected abstract GraphQueue createQueue(QueueCollection qc, QueueDescriptor descr)
protected Graph.ThreadData createThreadData()
public long derive()
public void enumerateEdges(java.lang.Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, java.io.Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)
enumerateEdges
in interface Graph
public int getDerivationMode()
PARALLEL_MODE
,
PARALLEL_NON_DETERMINISTIC_MODE
,
SEQUENTIAL_MODE
, SEQUENTIAL_NON_DETERMINISTIC_MODE
with the flags INTERPRETIVE_FLAG
and EXCLUDE_DELETED_FLAG
.
setDerivationMode(int)
public RuntimeModel getModel()
Graph
getModel
in interface Graph
protected java.lang.Object getPredecessor(java.lang.Object node)
public QueueCollection getQueues()
protected Graph.ThreadData getThreadData()
public void setDerivationMode(int mode)
mode
is a combination
of the bit masks PARALLEL_MODE
,
PARALLEL_NON_DETERMINISTIC_MODE
,
SEQUENTIAL_MODE
, SEQUENTIAL_NON_DETERMINISTIC_MODE
with the flags
INTERPRETIVE_FLAG
and EXCLUDE_DELETED_FLAG
.
mode
- desired derivation modegetDerivationMode()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |