Class SecGraphNode

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:
  • Field Details

  • Constructor Details

    • SecGraphNode

      public SecGraphNode()
  • Method Details

    • getNTypeImpl

      protected Node.NType getNTypeImpl()
      Description copied from class: Node
      This method returns the Node.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 class Node
      Returns:
      type describing the managed fields of the class of this node
    • newInstance

      protected 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 class Node
      Returns:
      new instance of class of this node
    • getSecGraph

      public SecGraphImpl getSecGraph()
    • setSecGraph

      public void setSecGraph(SecGraphImpl value)
    • getInstantiator

      public Instantiator getInstantiator()
      Overrides:
      getInstantiator in class Node
    • getRootNode

      public Node 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 interface GraphObject
      Returns:
      a Node
    • setRootNode

      public void setRootNode(Node root)
      Description copied from interface: GraphObject
      Set the rootnode of a GraphObject object.
      Specified by:
      setRootNode in interface GraphObject
      Parameters:
      root -
    • cloneGraph

      public Node cloneGraph() throws CloneNotSupportedException
      Description copied from interface: GraphObject
      clone the graph of the rootnode and returns it
      Specified by:
      cloneGraph in interface GraphObject
      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 interface GraphObject
    • 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 interface GraphObject
    • describes

      public Object describes()
      Description copied from interface: GraphObject
      Gives an array of node types and number contained in the GraphObject
      Specified by:
      describes in interface GraphObject
      Returns:
    • getNode

      public Node getNode(String key)
      Description copied from interface: GraphObject
      Return a node of the given name
      Specified by:
      getNode in interface GraphObject
      Parameters:
      key - : the name of the type of node
    • resolve

      public GraphObject 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 interface GraphObject
      Returns:
    • view3d

      public void view3d(Context ctx)
      Description copied from interface: GraphObject
      Opens the 3d view of the current graph
      Specified by:
      view3d in interface GraphObject
      Parameters:
      ctx -
    • view2d

      public void view2d(Context ctx)
      Description copied from interface: GraphObject
      Opens the 2d view of the current graph
      Specified by:
      view2d in interface GraphObject
      Parameters:
      ctx -
    • getRegistry

      public Registry getRegistry()
      Description copied from interface: RegistryContext
      Returns the Registry which is linked with this instance.
      Specified by:
      getRegistry in interface RegistryContext
      Returns:
      the registry linked with this instance
    • produceNode

      public Node produceNode()
      Specified by:
      produceNode in interface ProducingNode
    • getModel

      public RuntimeModel getModel()
      Description copied from interface: Graph
      Returns this graph's run-time model.
      Specified by:
      getModel in interface Graph
      Returns:
      the run-time model
    • createQueryState

      public QueryState 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 by CompiletimeModel.getQueryStateType() of the corresponding compile-time model.
      Specified by:
      createQueryState in interface Graph
      Returns:
      a new query state
    • createProducer

      public Producer createProducer(QueryState qs)
      Description copied from interface: Graph
      Creates an instance of Producer. This factory method creates an instance of a subclass of Producer which will be exclusively used later on in the context of the current match represented by qs. The instance must be an instance of the class returned by CompiletimeModel.getProducerType() for the corresponding compile-time model.

      The usage of producers is specified by the XL programming language.

      Specified by:
      createProducer in interface Graph
      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 interface Graph
    • canEnumerateNodes

      public boolean canEnumerateNodes(Type type)
      Description copied from interface: Graph
      Can nodes of the specified 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).
      Specified by:
      canEnumerateNodes in interface Graph
      Parameters:
      type - the type of nodes
      Returns:
      true iff nodes of type can be enumerated
    • enumerateNodes

      public void enumerateNodes(Type type, QueryState qs, int tp, MatchConsumer consumer, int arg)
      Description copied from interface: Graph
      This methods enumerates all nodes of this graph of the given type to the given MatchConsumer via the given query state. I.e., for every node c of this extent that has type type, the following statement is executed:
           qs.amatch (tp, c, consumer, arg);
       
      Specified by:
      enumerateNodes in interface Graph
      Parameters:
      type - the type of nodes
      qs - the query state on which the amatch-method has to be invoked
      tp - the index-parameter for the amatch-method
      consumer - the consumer-parameter for the amatch-method
      arg - the arg-parameter for the amatch-method
    • canEnumerateEdges

      public boolean canEnumerateEdges(EdgeDirection dir, boolean constEdge, Serializable edge)
      Specified by:
      canEnumerateEdges in interface Graph
    • 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 interface Graph
    • getRoot

      public Object getRoot()
      Description copied from interface: Graph
      Returns the root node of this graph.
      Specified by:
      getRoot in interface Graph
      Returns:
      the root
    • getTypeRoot

      public Object getTypeRoot()
      Description copied from interface: Graph
      Returns the root node of the type graph for this graph
      Specified by:
      getTypeRoot in interface Graph
      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 interface Graph
      Parameters:
      node -
      dir -
      edgeType -
      qs -
      toIndex -
      patternIndex -
      pattern -
      matchIndex -
      consumer -
      arg -
    • sortedTypeGraph

      public HashMap<Object,Integer> sortedTypeGraph()
      Description copied from interface: Graph
      Returns the ordered scale values of the nodes in the type graph
      Specified by:
      sortedTypeGraph in interface Graph
      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
      Specified by:
      clear in interface SecGraph
    • apply

      public void apply(String name)
      Description copied from interface: SecGraph
      Apply a RGG function on the SecGraph
      Specified by:
      apply in interface SecGraph
      Parameters:
      name - : name of the function
    • applyXL

      public void applyXL(String query)
      Description copied from interface: SecGraph
      Apply an XL Query on the SecGraph
      Specified by:
      applyXL in interface SecGraph
      Parameters:
      query - : the XL query
    • toInstance

      public Node toInstance()
      Description copied from interface: SecGraph
      creates a Node holding a instanciation of the SecGraph
      Specified by:
      toInstance in interface SecGraph
      Returns:
      the Node
    • toNode

      public Node toNode()
    • producer$begin

      public SecGraphInitialProducer producer$begin()
      Specified by:
      producer$begin in interface SecGraph
    • handleSaveEvent

      public void handleSaveEvent()
      Description copied from interface: SecGraph
      function triggered by the saving of the project
      Specified by:
      handleSaveEvent in interface SecGraph
    • 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 interface SecGraph
      Parameters:
      b - sets if recreated or not
    • getInitalProducer

      public Object getInitalProducer()
      Description copied from interface: SecGraph
      create a new producer to initialize the Graph
      Specified by:
      getInitalProducer in interface SecGraph
      Returns:
    • setCurrent

      public void setCurrent()
      Description copied from interface: SecGraph
      set this graph to be the currently used one
      Specified by:
      setCurrent in interface SecGraph
    • releaseCurrent

      public void releaseCurrent()
      Description copied from interface: SecGraph
      set the project graph to be teh current one
      Specified by:
      releaseCurrent in interface SecGraph
    • isQueryGraph

      public boolean isQueryGraph()
      Description copied from interface: SecGraph
      check if the secgraph includes a queryRoot
      Specified by:
      isQueryGraph in interface SecGraph
      Returns:
    • isRuleGraph

      public boolean isRuleGraph()
      Description copied from interface: SecGraph
      check if the secgraph includes a QueryRoot and a ProductionRoot
      Specified by:
      isRuleGraph in interface SecGraph
      Returns:
    • getQueryRoot

      public Node getQueryRoot(boolean create)
      Specified by:
      getQueryRoot in interface SecGraph
    • getProductionRoot

      public Node getProductionRoot(boolean create)
      Specified by:
      getProductionRoot in interface SecGraph
    • query

      public Object query()
      Specified by:
      query in interface SecGraph
    • production

      public Object production()
      Specified by:
      production in interface SecGraph
    • 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
      Specified by:
      includes in interface SecGraph
      Parameters:
      sg -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • 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
      Specified by:
      includes in interface SecGraph
      Parameters:
      sg -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • inProjectGraph

      public boolean inProjectGraph() throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
      Description copied from interface: SecGraph
      test if this graph is included in the ProjectGraph
      Specified by:
      inProjectGraph in interface SecGraph
      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 interface SecGraph
      Parameters:
      asQuery -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • execute

      public void execute() throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
      Description copied from interface: SecGraph
      run this SecGraph as a rule on the MainGraph
      Specified by:
      execute in interface SecGraph
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • 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
      Specified by:
      execute in interface SecGraph
      Parameters:
      sg -
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • 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
      Specified by:
      apply in interface SecGraph
      Parameters:
      rule -
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • add

      public void add(GraphContext sg)
      Specified by:
      add in interface SecGraph
    • getRGGGraph

      public RGGGraph getRGGGraph()
      Specified by:
      getRGGGraph in interface SecGraph
    • derive

      public long derive()
      Specified by:
      derive in interface SecGraph
    • instantiate

      public void instantiate(Object producer)
      Specified by:
      instantiate in interface Instantiator