de.grogra.xl.impl.base
public abstract class Graph extends java.lang.Object implements Graph, java.lang.Cloneable
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).
| Modifier and Type | Class and Description |
|---|---|
class |
Graph.QState |
protected static class |
Graph.ThreadData |
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
Graph(RuntimeModel model) |
| Modifier and Type | Method and Description |
|---|---|
void |
allowNoninjectiveMatchesByDefault(boolean value) |
void |
allowNoninjectiveMatchesForNextQuery(boolean value)
Deprecated.
|
boolean |
areComparableScales(java.lang.Object nodeA,
java.lang.Object nodeB) |
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) |
void |
enumerateSpaces(java.lang.Object node,
EdgeDirection dir,
Type edgeType,
QueryState qs,
int toIndex,
int patternIndex,
java.io.Serializable pattern,
int matchIndex,
MatchConsumer consumer,
int arg)
Searches the graph (with reference to the type graph) for matching multiscale patterns
|
int |
getDerivationMode()
Returns the current derivation mode.
|
int |
getMinimumEncoarseDepthDiff(java.lang.Object coarseNode,
java.lang.Object fineNode)
Returns the length of the shortest encoarsement path from fineNode to coarseNode
|
RuntimeModel |
getModel()
Returns this graph's run-time model.
|
protected java.lang.Object |
getPredecessor(java.lang.Object node) |
QueueCollection |
getQueues() |
int |
getScaleValue(java.util.HashMap<java.lang.Object,java.lang.Integer> sortedTypeGraph,
java.lang.Object node) |
protected Graph.ThreadData |
getThreadData() |
java.lang.Object |
getTypeNode(java.lang.Object node)
Get node in type graph representing the type of the input node
|
java.lang.Object |
getTypeNode(Type t) |
boolean |
isInTypeGraph(java.lang.Object node)
Check if a node is in the type graph
|
boolean |
isSameScale(java.lang.Object nodeA,
java.lang.Object nodeB)
Checks if 2 nodes are in the same scale in the type graph.
|
void |
setDerivationMode(int mode)
Sets the current derivation mode.
|
java.util.HashMap<java.lang.Object,java.lang.Integer> |
sortedTypeGraph()
Returns the ordered scale values of the nodes in the type graph
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanEnumerateEdges, createProducer, enumerateNodes, getRoot, getTypeRootpublic 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.public Graph(RuntimeModel model)
public void allowNoninjectiveMatchesByDefault(boolean value)
@Deprecated public void allowNoninjectiveMatchesForNextQuery(boolean value)
public boolean areComparableScales(java.lang.Object nodeA,
java.lang.Object nodeB)
protected abstract void beginModifications()
public boolean canEnumerateNodes(Type type)
Graphtype 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 Graphtype - the type of nodestrue iff nodes of type can be enumeratedprotected abstract void commitModifications()
public Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
createMatcher in interface Graphpublic Graph.QState createQueryState()
GraphCompiletimeModel.getQueryStateType()
of the corresponding compile-time model.createQueryState in interface Graphprotected 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 Graphpublic void enumerateSpaces(java.lang.Object node,
EdgeDirection dir,
Type edgeType,
QueryState qs,
int toIndex,
int patternIndex,
java.io.Serializable pattern,
int matchIndex,
MatchConsumer consumer,
int arg)
enumerateSpaces in interface Graphnode - node already bound before this spacingdir - edge directionedgeType - class type of edge, normally intqs - QueryState instancepattern - edge pattern, i.e. successor, branching, refinement, etc.consumer - CompoundPattern instance for continuing match logicpublic 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 int getMinimumEncoarseDepthDiff(java.lang.Object coarseNode,
java.lang.Object fineNode)
coarseNode - fineNode - public RuntimeModel getModel()
Graphprotected java.lang.Object getPredecessor(java.lang.Object node)
public QueueCollection getQueues()
public int getScaleValue(java.util.HashMap<java.lang.Object,java.lang.Integer> sortedTypeGraph,
java.lang.Object node)
protected Graph.ThreadData getThreadData()
public java.lang.Object getTypeNode(java.lang.Object node)
node - public java.lang.Object getTypeNode(Type t)
public boolean isInTypeGraph(java.lang.Object node)
node - public boolean isSameScale(java.lang.Object nodeA,
java.lang.Object nodeB)
nodeA - nodeB - 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()public java.util.HashMap<java.lang.Object,java.lang.Integer> sortedTypeGraph()
GraphsortedTypeGraph in interface Graph