Package com.ensoftcorp.open.pcg.common
Class PCG
- java.lang.Object
-
- com.ensoftcorp.open.pcg.common.PCG
-
public class PCG extends java.lang.ObjectA 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 interfacePCG.PCGEdgeDefines tags and attributes for PCG edgesstatic interfacePCG.PCGNodeDefines tags and attributes for PCG nodes
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPCGInstancesA 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 voiddelete(PCG pcg)Deletes the PCG instance from the Atlas graphstatic voiddeleteAll()Purges all records of PCGs from the Atlas graphbooleanequals(java.lang.Object obj)PCG instances are equivalent if they have the same instance id (case-insensitive)com.ensoftcorp.atlas.core.query.QgetCFG()Returns the original control flow graphlonggetCreationTime()Gets the time (unix time) that the this PCG was createdcom.ensoftcorp.atlas.core.query.QgetEvents()Returns the set of events used to contruct the PCGcom.ensoftcorp.atlas.core.query.QgetExits()Returns the exits of the control flow graph specified to create the PCGcom.ensoftcorp.atlas.core.db.graph.NodegetFunction()Returns the function that contains this PCGjava.lang.StringgetGivenName()Returns the name assigned to this PCGjava.lang.StringgetInstanceID()Returns the instance ID of this PCG which can be used to load the PCG laterlonggetLastAccessTime()Gets the time (unix time) that the this PCG was last accessedcom.ensoftcorp.atlas.core.db.graph.NodegetMasterEntry()Returns the master entry of the PCG and CFGcom.ensoftcorp.atlas.core.db.graph.NodegetMasterExit()Returns the master exit of the PCG and CFGcom.ensoftcorp.atlas.core.query.QgetPCG()Returns the project control graphstatic java.lang.StringgetPCGInstanceID(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 instancestatic java.lang.StringgetPCGInstanceID(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.QgetRoots()Returns the roots of the control flow graph specified to create the PCGinthashCode()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 existstatic PCGload(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 existstatic PCGload(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 existstatic java.util.Set<PCG>loadAll()Loads all PCGs stored in the Atlas graphvoidsetGivenName(java.lang.String givenName)Updates this PCG's given namevoidupdateLastAccessTime()Updates the last access time to the current time
-
-
-
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
PCG instances are equivalent if they have the same instance id (case-insensitive)- Overrides:
equalsin classjava.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:
-
-