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.ObjectA 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 classAbstractAnalysis.Worklist.BackwardDFOComparatorComparators to allow priority queue to order blocks by their depth-first order, using by backward analysis.classAbstractAnalysis.Worklist.ForwardDFOComparatorComparators 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>depthFirstOrderMap all blocks in the CFG to their depth-first order.protected java.util.PriorityQueue<Block>queueThe 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 voidadd(Block block)Add the given block toqueue.booleancontains(Block block)Check ifqueuecontains the block which is passed as the argument.booleanisEmpty()SeeAbstractCollection.isEmpty().@Nullable Blockpoll()SeePriorityQueue.poll().voidprocess(ControlFlowGraph cfg)Process the control flow graph, add the blocks todepthFirstOrder.java.lang.StringtoString()
-
-
-
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
queueis empty else false - See Also:
AbstractCollection.isEmpty()
-
contains
public boolean contains(Block block)
Check ifqueuecontains the block which is passed as the argument.- Parameters:
block- the given block to check- Returns:
- true if
queuecontains 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:
toStringin classjava.lang.Object
-
-