java.lang.Object
de.grogra.xl.impl.base.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).
- Author:
- Ole Kniemeyer
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intBit mask forgetDerivationMode()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 final intBit mask forgetDerivationMode()which indicates that rules have to be applied as interpretive rules.static final intMask forgetDerivationMode()to obtain the mode part (one ofPARALLEL_MODE,PARALLEL_NON_DETERMINISTIC_MODE,SEQUENTIAL_MODE,SEQUENTIAL_NON_DETERMINISTIC_MODE).static final intBit mask forgetDerivationMode()indicating a true parallel derivation mode.static final intBit mask forgetDerivationMode()indicating a parallel non-deterministic derivation mode.static final intBit mask forgetDerivationMode()indicating a sequential derivation mode.static final intBit mask forgetDerivationMode()indicating a sequential derivation mode.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidallowNoninjectiveMatchesByDefault(boolean value) voidallowNoninjectiveMatchesForNextQuery(boolean value) Deprecated.booleanareComparableScales(Object nodeA, Object nodeB) protected abstract voidbooleancanEnumerateNodes(Type type) Can nodes of the specifiedtypebe enumerated?protected abstract voidcreateMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut) Creates a query state to be used for queries which use this graph.protected abstract GraphQueuecreateQueue(QueueCollection qc, QueueDescriptor descr) protected Graph.ThreadDatalongderive()voidenumerateEdges(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) voidenumerateSpaces(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) Searches the graph (with reference to the type graph) for matching multiscale patternsintReturns the current derivation mode.intgetMinimumEncoarseDepthDiff(Object coarseNode, Object fineNode) Returns the length of the shortest encoarsement path from fineNode to coarseNodegetModel()Returns this graph's run-time model.protected ObjectgetPredecessor(Object node) intgetScaleValue(HashMap<Object, Integer> sortedTypeGraph, Object node) protected Graph.ThreadDatagetTypeNode(Type t) getTypeNode(Object node) Get node in type graph representing the type of the input nodebooleanisInTypeGraph(Object node) Check if a node is in the type graphbooleanisSameScale(Object nodeA, Object nodeB) Checks if 2 nodes are in the same scale in the type graph.voidsetDerivationMode(int mode) Sets the current derivation mode.Returns the ordered scale values of the nodes in the type graphMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.grogra.xl.query.GraphcanEnumerateEdges, createProducer, enumerateNodes, getRoot, getTypeRoot
- 
Field Details- 
PARALLEL_MODEpublic static final int PARALLEL_MODEBit mask forgetDerivationMode()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.- See Also:
 
- 
PARALLEL_NON_DETERMINISTIC_MODEpublic static final int PARALLEL_NON_DETERMINISTIC_MODEBit mask forgetDerivationMode()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.- See Also:
 
- 
SEQUENTIAL_MODEpublic static final int SEQUENTIAL_MODEBit mask forgetDerivationMode()indicating a sequential derivation mode. Only one rule application is performed in a single step (as marked byderive()). If several applications are possible, only the first one is chosen.- See Also:
 
- 
SEQUENTIAL_NON_DETERMINISTIC_MODEpublic static final int SEQUENTIAL_NON_DETERMINISTIC_MODEBit mask forgetDerivationMode()indicating a sequential derivation mode. Only one rule application is performed in a single step (as marked byderive()). If several applications are possible, one is chosen pseudo-randomly.- See Also:
 
- 
MODE_MASKpublic static final int MODE_MASKMask forgetDerivationMode()to obtain the mode part (one ofPARALLEL_MODE,PARALLEL_NON_DETERMINISTIC_MODE,SEQUENTIAL_MODE,SEQUENTIAL_NON_DETERMINISTIC_MODE).- See Also:
 
- 
INTERPRETIVE_FLAGpublic static final int INTERPRETIVE_FLAGBit mask forgetDerivationMode()which indicates that rules have to be applied as interpretive rules.- See Also:
 
- 
EXCLUDE_DELETED_FLAGpublic static final int EXCLUDE_DELETED_FLAGBit mask forgetDerivationMode()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.- See Also:
 
 
- 
- 
Constructor Details- 
Graph
 
- 
- 
Method Details- 
getThreadData
- 
createThreadData
- 
getModelDescription copied from interface:GraphReturns this graph's run-time model.
- 
createQueue
- 
createQueryStateDescription copied from interface:GraphCreates a query state to be used for queries which use this graph. The returned query state has to be an instance of the type defined byCompiletimeModel.getQueryStateType()of the corresponding compile-time model.- Specified by:
- createQueryStatein interface- Graph
- Returns:
- a new query state
 
- 
allowNoninjectiveMatchesByDefaultpublic void allowNoninjectiveMatchesByDefault(boolean value) 
- 
allowNoninjectiveMatchesForNextQueryDeprecated.
- 
getDerivationModepublic int getDerivationMode()Returns the current derivation mode. This is a combination of one of the bit masksPARALLEL_MODE,PARALLEL_NON_DETERMINISTIC_MODE,SEQUENTIAL_MODE,SEQUENTIAL_NON_DETERMINISTIC_MODEwith the flagsINTERPRETIVE_FLAGandEXCLUDE_DELETED_FLAG.- Returns:
- current derivation mode
- See Also:
 
- 
setDerivationModepublic void setDerivationMode(int mode) Sets the current derivation mode.modeis a combination of the bit masksPARALLEL_MODE,PARALLEL_NON_DETERMINISTIC_MODE,SEQUENTIAL_MODE,SEQUENTIAL_NON_DETERMINISTIC_MODEwith the flagsINTERPRETIVE_FLAGandEXCLUDE_DELETED_FLAG.- Parameters:
- mode- desired derivation mode
- See Also:
 
- 
derivepublic long derive()
- 
beginModificationsprotected abstract void beginModifications()
- 
commitModificationsprotected abstract void commitModifications()
- 
getQueues
- 
canEnumerateNodesDescription copied from interface:GraphCan nodes of the specifiedtypebe enumerated? This method returnstrueiff this graph can enumerate nodes of the giventypeusing the methodGraph.enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int).- Specified by:
- canEnumerateNodesin interface- Graph
- Parameters:
- type- the type of nodes
- Returns:
- trueiff nodes of- typecan be enumerated
 
- 
enumerateEdgespublic void enumerateEdges(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) - Specified by:
- enumerateEdgesin interface- Graph
 
- 
getPredecessor
- 
createMatcherpublic Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut) - Specified by:
- createMatcherin interface- Graph
 
- 
enumerateSpacespublic void enumerateSpaces(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) Searches the graph (with reference to the type graph) for matching multiscale patterns- Specified by:
- enumerateSpacesin interface- Graph
- Parameters:
- node- node already bound before this spacing
- dir- edge direction
- edgeType- class type of edge, normally int
- qs- QueryState instance
- toIndex-
- patternIndex-
- pattern- edge pattern, i.e. successor, branching, refinement, etc.
- matchIndex-
- consumer- CompoundPattern instance for continuing match logic
- arg-
 
- 
isInTypeGraphCheck if a node is in the type graph- Parameters:
- node-
- Returns:
- true if input node is part of the type graph, false otherwise
 
- 
sortedTypeGraphDescription copied from interface:GraphReturns the ordered scale values of the nodes in the type graph- Specified by:
- sortedTypeGraphin interface- Graph
- Returns:
- HashMap instance containing mappings from the type graph nodes to scale values
 
- 
getScaleValue
- 
getTypeNode
- 
getTypeNodeGet node in type graph representing the type of the input node- Parameters:
- node-
- Returns:
- node from type graph representing type of input node
 
- 
areComparableScales
- 
isSameScaleChecks if 2 nodes are in the same scale in the type graph.- Parameters:
- nodeA-
- nodeB-
- Returns:
 
- 
getMinimumEncoarseDepthDiffReturns the length of the shortest encoarsement path from fineNode to coarseNode- Parameters:
- coarseNode-
- fineNode-
- Returns:
- length of path, 0 if coarseNode is not encoarsement of fineNode, -1 if error
 
 
-