java.lang.Object
de.grogra.graph.impl.Edge
de.grogra.graph.impl.Node
de.grogra.graph.object.sg.impl.SecGraphNode
- All Implemented Interfaces:
GraphContext
,GraphManagerContext
,GraphObject
,SecGraph
,ProducingNode
,Manageable
,PersistenceCapable
,Shareable
,RegistryContext
,UserFields
,XObject
,Map
,Instantiator
,Graph
,Serializable
,Cloneable
@HasModel(Compiletime.class)
public class SecGraphNode
extends Node
implements SecGraph, Instantiator
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Node.NType
protected SecGraphImpl
static final Node.NType.Field
Fields inherited from class de.grogra.graph.impl.Node
ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MAX_RESOLUTION, MIME_TYPE, MIN_RESOLUTION, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, RESOLUTION_BIT, RESOLUTION_MASK, resolution$FIELD, USED_BITS
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
Fields inherited from interface de.grogra.graph.object.sg.SecGraph
PRODUCTION_ROOT, QUERY_ROOT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(GraphContext sg) void
apply the given SecGraph on this SecGraphvoid
Apply a RGG function on the SecGraphvoid
Apply an XL Query on the SecGraphboolean
canEnumerateEdges
(EdgeDirection dir, boolean constEdge, Serializable edge) boolean
canEnumerateNodes
(Type type) Can nodes of the specifiedtype
be enumerated?void
clear()
removes all Nodes except the rootclone the graph of the rootnode and returns itcreateMatcher
(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut) Creates an instance ofProducer
.Creates a query state to be used for queries which use this graph.long
derive()
Gives an array of node types and number contained in the GraphObjectvoid
enumerateEdges
(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) void
enumerateNodes
(Type type, QueryState qs, int tp, MatchConsumer consumer, int arg) This methods enumerates all nodes of this graph of the given type to the givenMatchConsumer
via the given query state.void
enumerateSpaces
(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) This method enumerates all edges that possibly related 2 nodes with a spacing pattern inbetween them.void
execute()
run this SecGraph as a rule on the MainGraphvoid
run this SecGraph as a rule on the given secGraphcreate a new producer to initialize the GraphgetModel()
Returns this graph's run-time model.Return a node of the given nameprotected Node.NType
This method returns theNode.NType
which describes the managed fields of the class of this node.getProductionRoot
(boolean create) getQueryRoot
(boolean create) Returns theRegistry
which is linked with this instance.getRoot()
Returns the root node of this graph.Return the root node of the GraphObject, i.e. the root of the object loadedReturns the root node of the type graph for this graphvoid
function triggered by the saving of the projectboolean
test if this SecGraph incldues the SecGraph SGboolean
test if this SecGraph incldues the given SecGraph or if the query SecGraph of this graph is included in the given SecGraphboolean
test if this graph is included in the ProjectGraphboolean
inProjectGraph
(boolean asQuery) test if this graph is included in the ProjectGraph or if the query SecGraph of this graph is included in the Project Graphvoid
instantiate
(Object producer) boolean
check if the secgraph includes a queryRootboolean
check if the secgraph includes a QueryRoot and a ProductionRootprotected Node
This method returns a new instance of the class of this node.query()
void
set the project graph to be teh current onevoid
reload()
If the GraphObject uses some modules defined in the project, reload forces the modules in the GraphObject to be relinked after compilationresolve()
Resolves the real object if a reference is used If the real object is used the function returns it selfvoid
setAutoRecreate
(boolean b) defines if the SecGraph is automatically recreated if the model is savedvoid
set this graph to be the currently used onevoid
setRootNode
(Node root) Set the rootnode of a GraphObject object.void
setSecGraph
(SecGraphImpl value) Returns the ordered scale values of the nodes in the type graphcreates a Node holding a instanciation of the SecGraphtoNode()
void
Opens the 2d view of the current graphvoid
Opens the 3d view of the current graphvoid
write()
Override the file GraphObject in the project with its current version.Methods inherited from class de.grogra.graph.impl.Node
addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, clone, cloneGraph, dump, dumpTree, dup, dupFrom, dupnew, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, findRefinementType, get, getAccessor, getAccessor, getAttributes, getAxisParent, getBoolean, getBranch, getBranchLength, getBranchNode, getBranchTail, getByte, getChar, getCommonAncestor, getCurrentGraphState, getDirectChildCount, getDouble, getEdgeAttributeAccessor, getEdgeAttributes, getEdgeBitsTo, getEdgeTo, getExtentIndex, getFirst, getFirstEdge, getFloat, getGraph, getId, getIgnored, getIndex, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getObject, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getResolution, getShort, getSource, getStamp, getSuccessor, getSymbol, getSymbolColor, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isEncoarseOf, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, paramString, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setIgnored, setLayer, setMark, setName, setResolution, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, toString, writeReplace
Methods inherited from class de.grogra.graph.impl.Edge
addEdgeBits, getBitMark, getEdgeBits, getEdgeKeys, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.grogra.graph.object.GraphObject
getGraph, getName
Methods inherited from interface de.grogra.persistence.PersistenceCapable
getBitMark, getObjectMark, setBitMark, setObjectMark
-
Field Details
-
secGraph
-
$TYPE
-
secGraph$FIELD
-
-
Constructor Details
-
SecGraphNode
public SecGraphNode()
-
-
Method Details
-
getNTypeImpl
Description copied from class:Node
This method returns theNode.NType
which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
getNTypeImpl
in classNode
- Returns:
- type describing the managed fields of the class of this node
-
newInstance
Description copied from class:Node
This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
newInstance
in classNode
- Returns:
- new instance of class of this node
-
getSecGraph
-
setSecGraph
-
getInstantiator
- Overrides:
getInstantiator
in classNode
-
getRootNode
Description copied from interface:GraphObject
Return the root node of the GraphObject, i.e. the root of the object loaded- Specified by:
getRootNode
in interfaceGraphObject
- Returns:
- a Node
-
setRootNode
Description copied from interface:GraphObject
Set the rootnode of a GraphObject object.- Specified by:
setRootNode
in interfaceGraphObject
- Parameters:
root
-
-
cloneGraph
Description copied from interface:GraphObject
clone the graph of the rootnode and returns it- Specified by:
cloneGraph
in interfaceGraphObject
- Returns:
- Throws:
CloneNotSupportedException
-
write
public void write()Description copied from interface:GraphObject
Override the file GraphObject in the project with its current version. Required on GraphObject created in RGG to be saved- Specified by:
write
in interfaceGraphObject
-
reload
public void reload()Description copied from interface:GraphObject
If the GraphObject uses some modules defined in the project, reload forces the modules in the GraphObject to be relinked after compilation- Specified by:
reload
in interfaceGraphObject
-
describes
Description copied from interface:GraphObject
Gives an array of node types and number contained in the GraphObject- Specified by:
describes
in interfaceGraphObject
- Returns:
-
getNode
Description copied from interface:GraphObject
Return a node of the given name- Specified by:
getNode
in interfaceGraphObject
- Parameters:
key
- : the name of the type of node
-
resolve
Description copied from interface:GraphObject
Resolves the real object if a reference is used If the real object is used the function returns it self- Specified by:
resolve
in interfaceGraphObject
- Returns:
-
view3d
Description copied from interface:GraphObject
Opens the 3d view of the current graph- Specified by:
view3d
in interfaceGraphObject
- Parameters:
ctx
-
-
view2d
Description copied from interface:GraphObject
Opens the 2d view of the current graph- Specified by:
view2d
in interfaceGraphObject
- Parameters:
ctx
-
-
getRegistry
Description copied from interface:RegistryContext
Returns theRegistry
which is linked with this instance.- Specified by:
getRegistry
in interfaceRegistryContext
- Returns:
- the registry linked with this instance
-
produceNode
- Specified by:
produceNode
in interfaceProducingNode
-
getModel
Description copied from interface:Graph
Returns this graph's run-time model. -
createQueryState
Description copied from interface:Graph
Creates 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:
createQueryState
in interfaceGraph
- Returns:
- a new query state
-
createProducer
Description copied from interface:Graph
Creates an instance ofProducer
. This factory method creates an instance of a subclass ofProducer
which will be exclusively used later on in the context of the current match represented byqs
. The instance must be an instance of the class returned byCompiletimeModel.getProducerType()
for the corresponding compile-time model.The usage of producers is specified by the XL programming language.
- Specified by:
createProducer
in interfaceGraph
- Parameters:
qs
- query state which holds current match for which the producer shall produce a replacement- Returns:
- a producer for use in the context of
qs
-
createMatcher
public Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut) - Specified by:
createMatcher
in interfaceGraph
-
canEnumerateNodes
Description copied from interface:Graph
Can nodes of the specifiedtype
be enumerated? This method returnstrue
iff this graph can enumerate nodes of the giventype
using the methodGraph.enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int)
.- Specified by:
canEnumerateNodes
in interfaceGraph
- Parameters:
type
- the type of nodes- Returns:
true
iff nodes oftype
can be enumerated
-
enumerateNodes
Description copied from interface:Graph
This methods enumerates all nodes of this graph of the given type to the givenMatchConsumer
via the given query state. I.e., for every nodec
of this extent that has typetype
, the following statement is executed:qs.amatch (tp, c, consumer, arg);
- Specified by:
enumerateNodes
in interfaceGraph
- Parameters:
type
- the type of nodesqs
- the query state on which theamatch
-method has to be invokedtp
- the index-parameter for theamatch
-methodconsumer
- the consumer-parameter for theamatch
-methodarg
- the arg-parameter for theamatch
-method
-
canEnumerateEdges
- Specified by:
canEnumerateEdges
in interfaceGraph
-
enumerateEdges
public void enumerateEdges(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) - Specified by:
enumerateEdges
in interfaceGraph
-
getRoot
Description copied from interface:Graph
Returns the root node of this graph. -
getTypeRoot
Description copied from interface:Graph
Returns the root node of the type graph for this graph- Specified by:
getTypeRoot
in interfaceGraph
- Returns:
- the root of the type graph
-
enumerateSpaces
public void enumerateSpaces(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg) Description copied from interface:Graph
This method enumerates all edges that possibly related 2 nodes with a spacing pattern inbetween them.- Specified by:
enumerateSpaces
in interfaceGraph
- Parameters:
node
-dir
-edgeType
-qs
-toIndex
-patternIndex
-pattern
-matchIndex
-consumer
-arg
-
-
sortedTypeGraph
Description copied from interface:Graph
Returns the ordered scale values of the nodes in the type graph- Specified by:
sortedTypeGraph
in interfaceGraph
- Returns:
- HashMap instance containing mappings from the type graph nodes to scale values
-
clear
public void clear()Description copied from interface:SecGraph
removes all Nodes except the root -
apply
Description copied from interface:SecGraph
Apply a RGG function on the SecGraph -
applyXL
Description copied from interface:SecGraph
Apply an XL Query on the SecGraph -
toInstance
Description copied from interface:SecGraph
creates a Node holding a instanciation of the SecGraph- Specified by:
toInstance
in interfaceSecGraph
- Returns:
- the Node
-
toNode
-
producer$begin
- Specified by:
producer$begin
in interfaceSecGraph
-
handleSaveEvent
public void handleSaveEvent()Description copied from interface:SecGraph
function triggered by the saving of the project- Specified by:
handleSaveEvent
in interfaceSecGraph
-
setAutoRecreate
public void setAutoRecreate(boolean b) Description copied from interface:SecGraph
defines if the SecGraph is automatically recreated if the model is saved- Specified by:
setAutoRecreate
in interfaceSecGraph
- Parameters:
b
- sets if recreated or not
-
getInitalProducer
Description copied from interface:SecGraph
create a new producer to initialize the Graph- Specified by:
getInitalProducer
in interfaceSecGraph
- Returns:
-
setCurrent
public void setCurrent()Description copied from interface:SecGraph
set this graph to be the currently used one- Specified by:
setCurrent
in interfaceSecGraph
-
releaseCurrent
public void releaseCurrent()Description copied from interface:SecGraph
set the project graph to be teh current one- Specified by:
releaseCurrent
in interfaceSecGraph
-
isQueryGraph
public boolean isQueryGraph()Description copied from interface:SecGraph
check if the secgraph includes a queryRoot- Specified by:
isQueryGraph
in interfaceSecGraph
- Returns:
-
isRuleGraph
public boolean isRuleGraph()Description copied from interface:SecGraph
check if the secgraph includes a QueryRoot and a ProductionRoot- Specified by:
isRuleGraph
in interfaceSecGraph
- Returns:
-
getQueryRoot
- Specified by:
getQueryRoot
in interfaceSecGraph
-
getProductionRoot
- Specified by:
getProductionRoot
in interfaceSecGraph
-
query
-
production
- Specified by:
production
in interfaceSecGraph
-
includes
public boolean includes(SecGraph sg) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException Description copied from interface:SecGraph
test if this SecGraph incldues the SecGraph SG -
includes
public boolean includes(SecGraph sg, boolean asQuery) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException Description copied from interface:SecGraph
test if this SecGraph incldues the given SecGraph or if the query SecGraph of this graph is included in the given SecGraph -
inProjectGraph
public boolean inProjectGraph() throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphExceptionDescription copied from interface:SecGraph
test if this graph is included in the ProjectGraph- Specified by:
inProjectGraph
in interfaceSecGraph
- Returns:
- Throws:
de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
-
inProjectGraph
public boolean inProjectGraph(boolean asQuery) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException Description copied from interface:SecGraph
test if this graph is included in the ProjectGraph or if the query SecGraph of this graph is included in the Project Graph- Specified by:
inProjectGraph
in interfaceSecGraph
- Parameters:
asQuery
-- Returns:
- Throws:
de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
-
execute
public void execute() throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphExceptionDescription copied from interface:SecGraph
run this SecGraph as a rule on the MainGraph -
execute
public void execute(SecGraph sg) throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException Description copied from interface:SecGraph
run this SecGraph as a rule on the given secGraph -
apply
public void apply(SecGraph rule) throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException Description copied from interface:SecGraph
apply the given SecGraph on this SecGraph -
add
-
getRGGGraph
- Specified by:
getRGGGraph
in interfaceSecGraph
-
derive
public long derive() -
instantiate
- Specified by:
instantiate
in interfaceInstantiator
-