FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba
Class FrameDataflowAnalysis<ValueType,FrameType extends Frame<ValueType>>

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
      extended by edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<Fact>
          extended by edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<FrameType>
              extended by edu.umd.cs.findbugs.ba.FrameDataflowAnalysis<ValueType,FrameType>
All Implemented Interfaces:
DataflowAnalysis<FrameType>
Direct Known Subclasses:
ConstantAnalysis, IsNullValueAnalysis, ResourceValueAnalysis, TypeAnalysis, ValueNumberAnalysis

public abstract class FrameDataflowAnalysis<ValueType,FrameType extends Frame<ValueType>>
extends ForwardDataflowAnalysis<FrameType>

A convenient base class for dataflow analysis classes which use Frames as values.

Author:
David Hovemeyer
See Also:
Frame, DataflowAnalysis

Constructor Summary
FrameDataflowAnalysis(DepthFirstSearch dfs)
           
 
Method Summary
 void copy(FrameType source, FrameType dest)
          Copy dataflow facts.
 int getLastUpdateTimestamp(FrameType fact)
           
 boolean isFactValid(FrameType fact)
          Determine whether the given fact is valid (neither top nor bottom).
 boolean isTop(FrameType fact)
          Is the given fact the top value.
 void makeFactTop(FrameType fact)
          Make given fact the top value.
protected  void mergeInto(FrameType other, FrameType result)
          Merge one frame into another.
protected abstract  void mergeValues(FrameType otherFrame, FrameType resultFrame, int slot)
          Merge the values contained in a given slot of two Frames.
protected  FrameType modifyFrame(FrameType orig, FrameType copy)
          Create a modifiable copy of a frame.
 boolean same(FrameType fact1, FrameType fact2)
          Are given dataflow facts the same?
 void setLastUpdateTimestamp(FrameType fact, int lastTimestamp)
           
 
Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis
getBlockOrder, getDepthFirstSearch, isForwards
 
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
getFactAfterLocation, getFactAtLocation, transfer, transferInstruction
 
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
edgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIteration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.umd.cs.findbugs.ba.DataflowAnalysis
createFact, initEntryFact, meetInto
 

Constructor Detail

FrameDataflowAnalysis

public FrameDataflowAnalysis(DepthFirstSearch dfs)
Method Detail

copy

public void copy(FrameType source,
                 FrameType dest)
Description copied from interface: DataflowAnalysis
Copy dataflow facts.


makeFactTop

public void makeFactTop(FrameType fact)
Description copied from interface: DataflowAnalysis
Make given fact the top value.


isTop

public boolean isTop(FrameType fact)
Description copied from interface: DataflowAnalysis
Is the given fact the top value.


same

public boolean same(FrameType fact1,
                    FrameType fact2)
Description copied from interface: DataflowAnalysis
Are given dataflow facts the same?


isFactValid

public boolean isFactValid(FrameType fact)
Description copied from class: AbstractDataflowAnalysis
Determine whether the given fact is valid (neither top nor bottom).

Specified by:
isFactValid in class AbstractDataflowAnalysis<FrameType extends Frame<ValueType>>

getLastUpdateTimestamp

public int getLastUpdateTimestamp(FrameType fact)
Specified by:
getLastUpdateTimestamp in interface DataflowAnalysis<FrameType extends Frame<ValueType>>
Overrides:
getLastUpdateTimestamp in class BasicAbstractDataflowAnalysis<FrameType extends Frame<ValueType>>

setLastUpdateTimestamp

public void setLastUpdateTimestamp(FrameType fact,
                                   int lastTimestamp)
Specified by:
setLastUpdateTimestamp in interface DataflowAnalysis<FrameType extends Frame<ValueType>>
Overrides:
setLastUpdateTimestamp in class BasicAbstractDataflowAnalysis<FrameType extends Frame<ValueType>>

modifyFrame

protected final FrameType modifyFrame(FrameType orig,
                                      @Nullable
                                      FrameType copy)
Create a modifiable copy of a frame. This is useful for meetInto(), if the frame needs to be modified in a path-sensitive fashion. A typical usage pattern is:

 FrameType copy = null;
 if (someCondition()) {
     copy = modifyFrame(fact, copy);
     // modify copy
 }
 if (someOtherCondition()) {
     copy = modifyFrame(fact, copy);
     // modify copy
 }
 if (copy != null)
     fact = copy;
 

mergeInto(fact, result);

The advantage of using modifyFrame() is that new code can be added before or after other places where the frame is modified, and the code will remain correct.

Parameters:
orig - the original frame
copy - the modifiable copy (returned by a previous call to modifyFrame()), or null if this is the first time modifyFrame() is being called
Returns:
a modifiable copy of fact

mergeInto

protected void mergeInto(FrameType other,
                         FrameType result)
                  throws DataflowAnalysisException
Merge one frame into another.

Parameters:
other - the frame to merge with the result
result - the result frame, which is modified to be the merge of the two frames
Throws:
DataflowAnalysisException

mergeValues

protected abstract void mergeValues(FrameType otherFrame,
                                    FrameType resultFrame,
                                    int slot)
                             throws DataflowAnalysisException
Merge the values contained in a given slot of two Frames.

Parameters:
otherFrame - a Frame
resultFrame - a Frame which will contain the resulting merged value
slot - a slot in both frames
Throws:
DataflowAnalysisException

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.