Class SecGraphImpl

All Implemented Interfaces:
GraphContext, GraphManagerContext, GraphObject, SecGraph, ProducingNode, DisposableField, Manageable, Shareable, RegistryContext, Selectable, Graph, Cloneable

@HasModel(Compiletime.class) public class SecGraphImpl extends EmbeddedSharedObject implements SecGraph, Selectable
  • Field Details

  • Constructor Details

  • Method Details

    • getMimeType

      public MimeType getMimeType()
      Description copied from class: EmbeddedSharedObject
      Manage where the file should be stored
      Specified by:
      getMimeType in class EmbeddedSharedObject
    • getResourceDirectoryName

      public String getResourceDirectoryName()
      Specified by:
      getResourceDirectoryName in class EmbeddedSharedObject
    • getObjectType

      public String getObjectType()
      Description copied from class: EmbeddedSharedObject
      The java class name of the object type
      Specified by:
      getObjectType in class EmbeddedSharedObject
    • isAutoRecreate

      public boolean isAutoRecreate()
    • 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
    • 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
    • getGraph

      public GraphManager getGraph()
      Description copied from interface: GraphObject
      Return the graph manager of the GraphObject. It is different from the graph manager of the project & workbench.
      Specified by:
      getGraph in interface GraphContext
      Specified by:
      getGraph in interface GraphManagerContext
      Specified by:
      getGraph 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
    • clear

      public void clear()
      Description copied from interface: SecGraph
      removes all Nodes except the root
      Specified by:
      clear in interface SecGraph
    • 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
    • apply

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

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

      public void applyXL(String qu)
      Description copied from interface: SecGraph
      Apply an XL Query on the SecGraph
      Specified by:
      applyXL in interface SecGraph
      Parameters:
      qu - : 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
    • 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
    • producer$begin

      public SecGraphInitialProducer producer$begin()
      Specified by:
      producer$begin in interface SecGraph
    • 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
    • save

      public static void save(Registry r)
    • 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
    • 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
    • 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
    • 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
    • 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
      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
    • 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
      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
      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
      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
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • 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
    • 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:
    • getName

      public String getName()
      Description copied from interface: GraphObject
      Gives the name if one exists
      Specified by:
      getName in interface GraphObject
      Returns:
    • toSelection

      public Selection toSelection(Context ctx)
      Description copied from interface: Selectable
      Converts this object into a Selection.
      Specified by:
      toSelection in interface Selectable
      Parameters:
      ctx - the UI context
      Returns:
      a selection, or null if this is not possible
    • produceNode

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

      public SecGraph 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:
    • manageableWriteReplace

      public Object manageableWriteReplace()
      Specified by:
      manageableWriteReplace in interface Manageable
      Overrides:
      manageableWriteReplace in class EmbeddedSharedObject
    • clone

      public Object clone() throws CloneNotSupportedException
      Specified by:
      clone in interface SecGraph
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • add

      public void add(GraphContext inp)
      Specified by:
      add in interface SecGraph
    • disposeField

      public void disposeField()
      Specified by:
      disposeField in interface DisposableField
    • getExtension

      public String getExtension()
      Specified by:
      getExtension in class EmbeddedSharedObject
    • hasContent

      public boolean hasContent()
      Description copied from class: EmbeddedSharedObject
      True if the object is not "empty" as its persistence depends how the mimetype write content, a java object with some value could be defined as "empty"
      Specified by:
      hasContent in class EmbeddedSharedObject
    • 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
    • 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
    • derive

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

      public ManageableType getManageableType()
      Specified by:
      getManageableType in interface Manageable
      Overrides:
      getManageableType in class EmbeddedSharedObject