Class AbstractAnalysis.Worklist
- java.lang.Object
-
- org.checkerframework.dataflow.analysis.AbstractAnalysis.Worklist
-
- Enclosing class:
- AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
protected static class AbstractAnalysis.Worklist extends java.lang.Object
A worklist is a priority queue of blocks in which the order is given by depth-first ordering to place non-loop predecessors ahead of successors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractAnalysis.Worklist.BackwardDFOComparator
Comparators to allow priority queue to order blocks by their depth-first order, using by backward analysis.class
AbstractAnalysis.Worklist.ForwardDFOComparator
Comparators to allow priority queue to order blocks by their depth-first order, using by forward analysis.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.IdentityHashMap<Block,java.lang.Integer>
depthFirstOrder
Map all blocks in the CFG to their depth-first order.protected java.util.PriorityQueue<Block>
queue
The backing priority queue.
-
Constructor Summary
Constructors Constructor Description Worklist(Analysis.Direction direction)
Create a Worklist.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Block block)
Add the given block toqueue
.boolean
contains(Block block)
Check ifqueue
contains the block which is passed as the argument.boolean
isEmpty()
SeeAbstractCollection.isEmpty()
.@Nullable Block
poll()
SeePriorityQueue.poll()
.void
process(ControlFlowGraph cfg)
Process the control flow graph, add the blocks todepthFirstOrder
.java.lang.String
toString()
-
-
-
Constructor Detail
-
Worklist
public Worklist(Analysis.Direction direction)
Create a Worklist.- Parameters:
direction
- the direction (forward or backward)
-
-
Method Detail
-
process
public void process(ControlFlowGraph cfg)
Process the control flow graph, add the blocks todepthFirstOrder
.- Parameters:
cfg
- the control flow graph to process
-
isEmpty
@Pure @EnsuresNonNullIf(result=false, expression="poll()") public boolean isEmpty()
SeeAbstractCollection.isEmpty()
.- Returns:
- true if
queue
is empty else false - See Also:
AbstractCollection.isEmpty()
-
contains
public boolean contains(Block block)
Check ifqueue
contains the block which is passed as the argument.- Parameters:
block
- the given block to check- Returns:
- true if
queue
contains the given block
-
add
public void add(Block block)
Add the given block toqueue
. Adds unconditionally: does not check containment first.- Parameters:
block
- the block to add toqueue
-
poll
@Pure public @Nullable Block poll()
SeePriorityQueue.poll()
.- Returns:
- the head of
queue
- See Also:
PriorityQueue.poll()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-