Class PCG


  • public class PCG
    extends java.lang.Object
    A wrapper class for deserializing and accessing the properties of Project Control Graph computations.
    Author:
    Ben Holland
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  PCG.PCGEdge
      Defines tags and attributes for PCG edges
      static interface  PCG.PCGNode
      Defines tags and attributes for PCG nodes
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PCGInstances
      A attribute used to serialize the PCG nodes and edges that identify a unique PCG instance serialized in the Atlas graph.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void delete​(PCG pcg)
      Deletes the PCG instance from the Atlas graph
      static void deleteAll()
      Purges all records of PCGs from the Atlas graph
      boolean equals​(java.lang.Object obj)
      PCG instances are equivalent if they have the same instance id (case-insensitive)
      com.ensoftcorp.atlas.core.query.Q getCFG()
      Returns the original control flow graph
      long getCreationTime()
      Gets the time (unix time) that the this PCG was created
      com.ensoftcorp.atlas.core.query.Q getEvents()
      Returns the set of events used to contruct the PCG
      com.ensoftcorp.atlas.core.query.Q getExits()
      Returns the exits of the control flow graph specified to create the PCG
      com.ensoftcorp.atlas.core.db.graph.Node getFunction()
      Returns the function that contains this PCG
      java.lang.String getGivenName()
      Returns the name assigned to this PCG
      java.lang.String getInstanceID()
      Returns the instance ID of this PCG which can be used to load the PCG later
      long getLastAccessTime()
      Gets the time (unix time) that the this PCG was last accessed
      com.ensoftcorp.atlas.core.db.graph.Node getMasterEntry()
      Returns the master entry of the PCG and CFG
      com.ensoftcorp.atlas.core.db.graph.Node getMasterExit()
      Returns the master exit of the PCG and CFG
      com.ensoftcorp.atlas.core.query.Q getPCG()
      Returns the project control graph
      static java.lang.String getPCGInstanceID​(com.ensoftcorp.atlas.core.db.graph.Graph cfg, com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> roots, com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> exits, com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
      Returns a hash of the sorted node/edge addresses used to construct the PCG, which can be used to identify a unique PCG instance
      static java.lang.String getPCGInstanceID​(com.ensoftcorp.open.commons.algorithms.UniqueEntryExitControlFlowGraph ucfg, com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
      Returns a hash of the sorted node/edge addresses used to construct the PCG, which can be used to identify a unique PCG instance.
      com.ensoftcorp.atlas.core.query.Q getRoots()
      Returns the roots of the control flow graph specified to create the PCG
      int hashCode()
      PCG instances are equivalent if they have the same instance id (case-insensitive)
      static java.util.Set<PCG> load​(com.ensoftcorp.atlas.core.db.graph.Node masterEntry)
      Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
      static PCG load​(com.ensoftcorp.atlas.core.db.graph.Node masterEntry, java.lang.String instanceID)
      Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
      static PCG load​(com.ensoftcorp.open.commons.algorithms.UniqueEntryExitControlFlowGraph ucfg, com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
      Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
      static java.util.Set<PCG> loadAll()
      Loads all PCGs stored in the Atlas graph
      void setGivenName​(java.lang.String givenName)
      Updates this PCG's given name
      void updateLastAccessTime()
      Updates the last access time to the current time
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PCGInstances

        public static final java.lang.String PCGInstances
        A attribute used to serialize the PCG nodes and edges that identify a unique PCG instance serialized in the Atlas graph.
        See Also:
        Constant Field Values
    • Method Detail

      • hashCode

        public int hashCode()
        PCG instances are equivalent if they have the same instance id (case-insensitive)
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        PCG instances are equivalent if they have the same instance id (case-insensitive)
        Overrides:
        equals in class java.lang.Object
      • getLastAccessTime

        public long getLastAccessTime()
        Gets the time (unix time) that the this PCG was last accessed
        Returns:
      • updateLastAccessTime

        public void updateLastAccessTime()
        Updates the last access time to the current time
      • getCreationTime

        public long getCreationTime()
        Gets the time (unix time) that the this PCG was created
        Returns:
      • setGivenName

        public void setGivenName​(java.lang.String givenName)
        Updates this PCG's given name
        Parameters:
        givenName -
      • getGivenName

        public java.lang.String getGivenName()
        Returns the name assigned to this PCG
        Returns:
      • getFunction

        public com.ensoftcorp.atlas.core.db.graph.Node getFunction()
        Returns the function that contains this PCG
        Returns:
      • load

        public static PCG load​(com.ensoftcorp.open.commons.algorithms.UniqueEntryExitControlFlowGraph ucfg,
                               com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
        Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
        Parameters:
        instanceID -
        Returns:
      • load

        public static PCG load​(com.ensoftcorp.atlas.core.db.graph.Node masterEntry,
                               java.lang.String instanceID)
        Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
        Parameters:
        instanceID -
        Returns:
      • load

        public static java.util.Set<PCG> load​(com.ensoftcorp.atlas.core.db.graph.Node masterEntry)
        Loads a serialized PCG instance from the Atlas graph or null if the PCG instance does not exist
        Parameters:
        instanceID -
        Returns:
      • loadAll

        public static java.util.Set<PCG> loadAll()
        Loads all PCGs stored in the Atlas graph
        Returns:
      • delete

        public static void delete​(PCG pcg)
        Deletes the PCG instance from the Atlas graph
        Parameters:
        instanceID -
      • deleteAll

        public static void deleteAll()
        Purges all records of PCGs from the Atlas graph
      • getInstanceID

        public java.lang.String getInstanceID()
        Returns the instance ID of this PCG which can be used to load the PCG later
        Returns:
      • getPCG

        public com.ensoftcorp.atlas.core.query.Q getPCG()
        Returns the project control graph
        Returns:
      • getCFG

        public com.ensoftcorp.atlas.core.query.Q getCFG()
        Returns the original control flow graph
        Returns:
      • getMasterEntry

        public com.ensoftcorp.atlas.core.db.graph.Node getMasterEntry()
        Returns the master entry of the PCG and CFG
        Returns:
      • getRoots

        public com.ensoftcorp.atlas.core.query.Q getRoots()
        Returns the roots of the control flow graph specified to create the PCG
        Returns:
      • getExits

        public com.ensoftcorp.atlas.core.query.Q getExits()
        Returns the exits of the control flow graph specified to create the PCG
        Returns:
      • getMasterExit

        public com.ensoftcorp.atlas.core.db.graph.Node getMasterExit()
        Returns the master exit of the PCG and CFG
        Returns:
      • getEvents

        public com.ensoftcorp.atlas.core.query.Q getEvents()
        Returns the set of events used to contruct the PCG
        Returns:
      • getPCGInstanceID

        public static java.lang.String getPCGInstanceID​(com.ensoftcorp.atlas.core.db.graph.Graph cfg,
                                                        com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> roots,
                                                        com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> exits,
                                                        com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
        Returns a hash of the sorted node/edge addresses used to construct the PCG, which can be used to identify a unique PCG instance
        Parameters:
        pcg -
        Returns:
      • getPCGInstanceID

        public static java.lang.String getPCGInstanceID​(com.ensoftcorp.open.commons.algorithms.UniqueEntryExitControlFlowGraph ucfg,
                                                        com.ensoftcorp.atlas.core.db.set.AtlasSet<com.ensoftcorp.atlas.core.db.graph.Node> events)
        Returns a hash of the sorted node/edge addresses used to construct the PCG, which can be used to identify a unique PCG instance. Equivalent to getPCGInstanceID(ucfg.getCFG(), ucfg.getRoots(), ucfg.getExits(), events)
        Parameters:
        pcg -
        Returns: