Package it.unive.lisa.program.cfg.edge
Class Edge
- java.lang.Object
-
- it.unive.lisa.program.cfg.edge.Edge
-
- All Implemented Interfaces:
CodeEdge<CFG,Statement,Edge>
,Edge<CFG,Statement,Edge>
,java.lang.Comparable<Edge>
- Direct Known Subclasses:
FalseEdge
,SequentialEdge
,TrueEdge
public abstract class Edge extends java.lang.Object implements CodeEdge<CFG,Statement,Edge>
An edge of a control flow graph, connecting two statements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <V> boolean
accept(GraphVisitor<CFG,Statement,Edge,V> visitor, V tool)
Accepts the givenGraphVisitor
.int
compareTo(Edge o)
boolean
equals(java.lang.Object obj)
Statement
getDestination()
Yields the node where this edge ends.Statement
getSource()
Yields the node where this edge originates.int
hashCode()
abstract java.lang.String
toString()
abstract <A extends AbstractState<A>>
AnalysisState<A>traverseBackwards(AnalysisState<A> state)
Traverses this edge in the backward direction, from destination to source, optionally modifying the givensourceState
by applying semantic assumptions.abstract <A extends AbstractState<A>>
AnalysisState<A>traverseForward(AnalysisState<A> state)
Traverses this edge in the forward direction, proceeding from source to destination, optionally modifying the givensourceState
by applying semantic assumptions.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.util.datastructures.graph.code.CodeEdge
isUnconditional, newInstance
-
-
-
-
Method Detail
-
getSource
public final Statement getSource()
Description copied from interface:Edge
Yields the node where this edge originates.
-
getDestination
public final Statement getDestination()
Description copied from interface:Edge
Yields the node where this edge ends.- Specified by:
getDestination
in interfaceEdge<CFG,Statement,Edge>
- Returns:
- the destination node
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
traverseForward
public abstract <A extends AbstractState<A>> AnalysisState<A> traverseForward(AnalysisState<A> state) throws SemanticException
Traverses this edge in the forward direction, proceeding from source to destination, optionally modifying the givensourceState
by applying semantic assumptions.- Type Parameters:
A
- the concreteAbstractState
instance- Parameters:
state
- theAnalysisState
computed at the source of this edge- Returns:
- the
AnalysisState
after traversing this edge - Throws:
SemanticException
- if something goes wrong during the computation
-
traverseBackwards
public abstract <A extends AbstractState<A>> AnalysisState<A> traverseBackwards(AnalysisState<A> state) throws SemanticException
Traverses this edge in the backward direction, from destination to source, optionally modifying the givensourceState
by applying semantic assumptions.- Type Parameters:
A
- the concreteAbstractState
instance- Parameters:
state
- theAnalysisState
computed at the destination of this edge- Returns:
- the
AnalysisState
after traversing this edge - Throws:
SemanticException
- if something goes wrong during the computation
-
accept
public <V> boolean accept(GraphVisitor<CFG,Statement,Edge,V> visitor, V tool)
Description copied from interface:Edge
Accepts the givenGraphVisitor
. Implementors of this method are responsible for invokingGraphVisitor.visit(Object, Graph, Edge)
on this edge. The visiting should stop if such call returnsfalse
.- Specified by:
accept
in interfaceEdge<CFG,Statement,Edge>
- Type Parameters:
V
- the type of auxiliary tool thatvisitor
can use- Parameters:
visitor
- the visitor that is visiting theGraph
containing this edgetool
- the auxiliary tool thatvisitor
can use- Returns:
- whether or not the visiting should stop when this call returns, as decided by the visitor itself
-
-