Package org.mpi_sws.jmc.strategies.trust
Class ExecutionGraphNode
java.lang.Object
org.mpi_sws.jmc.strategies.trust.ExecutionGraphNode
Represents a node in the execution graph.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExecutionGraphNode(Event event, LamportVectorClock vectorClock) Constructs a newExecutionGraphNodewith the given event. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, Object value) Adds an attribute to this node.voidaddEdge(ExecutionGraphNode to, Relation adjacency) Adds an edge to this node.clone()Constructs a newExecutionGraphNodecopying the given node.booleanbooleanequalsEdges(ExecutionGraphNode other) voidforEachPredecessor(BiConsumer<Relation, List<Event.Key>> iterator) voidforEachSuccessor(BiConsumer<Relation, List<Event.Key>> iterator) Returns all the predecessors of this node.Returns the edges of this node.<T> TgetAttribute(String key) Returns the attribute with the given key.getEdges()Returns the edges of this node.getEvent()Returns theEventthat this node represents.intReturns the number of incoming edges of this node.Returns the predecessor of this node in the program order.getPredecessors(Relation adjacency) Returns the back edges of this node.getSuccessors(Relation adjacency) Returns the neighbours of this node that have the given adjacency.Returns the vector clock of this node.booleanhappensBefore(ExecutionGraphNode other) Check if `this` node is happens-before (_porf_ relation) the `other` node.booleanReturns whether this node has an edge to the given node with the given adjacency.booleanhasPredecessor(Event.Key key, Relation relation) Checks if this node has a predecessor with the given key and relation.key()voidremoveAllEdgesFrom(Event.Key from) Removes all edges from the given node.voidvoidremoveAllPredecessors(Relation adjacency) Removes all the predecessors with the given adjacency from this node.voidremoveEdge(ExecutionGraphNode to, Relation adjacency) Removes the edge with the given adjacency from this node.voidremoveEdge(Relation relation) Removes the edge with the given relation from this node.voidremoveEdgeTo(Event.Key to, Relation adjacency) voidvoidremovePredecessor(ExecutionGraphNode from, Relation adjacency) Removes the predecessor with the given adjacency from this node.voidsetAttributes(Map<String, Object> attributes) Updates the attributes of this node.voidsetVectorClock(LamportVectorClock newClock) Updates the vector clock of this node.com.google.gson.JsonElementtoJson()com.google.gson.JsonElement
-
Field Details
-
edges
-
backEdges
-
-
Constructor Details
-
ExecutionGraphNode
Constructs a newExecutionGraphNodewith the given event.- Parameters:
event- TheEventthat this node represents.
-
-
Method Details
-
clone
Constructs a newExecutionGraphNodecopying the given node. -
key
-
getVectorClock
Returns the vector clock of this node.- Returns:
- The vector clock of this node.
-
addEdge
Adds an edge to this node. The edge is directed from this node to the given node with the given adjacency.- Parameters:
to- The node to which the edge is directed.adjacency- The adjacency of the edge.
-
removeEdge
Removes the edge with the given adjacency from this node.Note that removing an edge invalidates the vector clock of all descendants. The concern of fixing the vector clocks is passed to the calling function.
- Parameters:
to- The node to which the edge is directed.adjacency- The adjacency of the edge.
-
removeEdge
Removes the edge with the given relation from this node.Leads to dandling references
- Parameters:
relation- The relation of the edge.
-
removeAllEdgesTo
-
removeEdgeTo
-
removeAllEdgesFrom
Removes all edges from the given node.- Parameters:
from- The node from which the edges are directed.
-
removePredecessor
Removes the predecessor with the given adjacency from this node.- Parameters:
from- The node from which the edge is directed.adjacency- The adjacency of the edge.
-
removePredecessor
-
removeAllPredecessors
Removes all the predecessors with the given adjacency from this node.- Parameters:
adjacency- The adjacency of the edges.
-
getAllSuccessors
Returns the edges of this node.- Returns:
- The edges of this node.
-
getSuccessors
Returns the neighbours of this node that have the given adjacency.- Parameters:
adjacency- The adjacency of the neighbours.- Returns:
- The neighbours of this node that have the given adjacency.
-
getEdges
Returns the edges of this node.- Returns:
- The edges of this node.
-
hasEdge
Returns whether this node has an edge to the given node with the given adjacency.- Parameters:
to- The node to which the edge is directed.adjacency- The adjacency of the edge.- Returns:
- Whether this node has an edge to the given node with the given adjacency.
-
getAllPredecessors
Returns all the predecessors of this node.- Returns:
- The predecessors of this node.
-
getPredecessors
Returns the back edges of this node.- Returns:
- The back edges of this node.
-
getInDegree
public int getInDegree()Returns the number of incoming edges of this node.- Returns:
- The number of incoming edges of this node.
-
forEachPredecessor
-
forEachSuccessor
-
happensBefore
Check if `this` node is happens-before (_porf_ relation) the `other` node.Determined using vector clocks
- Parameters:
other- The other node to compare against.- Returns:
- Returns true if the `this` is happens-before `other`
-
setAttributes
Updates the attributes of this node.- Parameters:
attributes- The new attributes of this node.
-
addAttribute
Adds an attribute to this node.- Parameters:
key- The key of the attribute.value- The value of the attribute.
-
getAttribute
Returns the attribute with the given key.- Type Parameters:
T- The type of the attribute.- Parameters:
key- The key of the attribute.- Returns:
- The attribute with the given key.
-
getEvent
Returns theEventthat this node represents.- Returns:
- The event that this node represents.
-
toJson
public com.google.gson.JsonElement toJson() -
toJsonIgnoreLocation
public com.google.gson.JsonElement toJsonIgnoreLocation() -
getPoPredecessor
Returns the predecessor of this node in the program order.- Returns:
- The predecessor of this node in the program order.
-
setVectorClock
Updates the vector clock of this node.- Parameters:
newClock- The new vector clock of this node.
-
equals
-
equalsEdges
-
hasPredecessor
Checks if this node has a predecessor with the given key and relation.- Parameters:
key- The key of the predecessor.relation- The relation of the predecessor.- Returns:
- True if this node has a predecessor with the given key and relation, false otherwise.
-