tip.util
Class SubExpressions<T extends Node>

java.lang.Object
  extended by tip.cfg.CFGAnswerAdapter<Collection<T>>
      extended by tip.util.SubExpressions<T>
Type Parameters:
T - the type of the collected child nodes
All Implemented Interfaces:
CFGAnswer<Collection<T>>

public class SubExpressions<T extends Node>
extends CFGAnswerAdapter<Collection<T>>

SubExpressions implements the CFGAnswerAdapter to retrieve child nodes accepted by a NodeFilter in subexpressions of nodes associated with program points in a control flow graph.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
SubExpressions(NodeFilter<T> filter)
          Creates a new SubExpressions instance using the NodeFilter filter for filtering nodes.
 
Method Summary
 Collection<T> caseCIfThenElseStmPoint(AIfThenElseStm node, CIfThenElseStmPoint point)
          Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.
 Collection<T> caseCIfThenStmPoint(AIfThenStm node, CIfThenStmPoint point)
          Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.
 Collection<T> caseCWhileStmPoint(AWhileStm node, CWhileStmPoint point)
          Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.
 Collection<T> caseEntryPoint(Node node, EntryPoint point)
          Returns an empty set of nodes.
 Collection<T> caseExitPoint(Node node, ExitPoint point)
          Returns an empty set of nodes.
 Collection<T> defaultNode(Node node, IProgramPoint point)
          Returns all child nodes of node accepted by the filter.
 
Methods inherited from class tip.cfg.CFGAnswerAdapter
caseCAssignPtrStmPoint, caseCAssignVarStmPoint, caseCBinopExpPoint, caseCBlockPoint, caseCDeclStmPoint, caseCDerefExpPoint, caseCFunctionCallExpPoint, caseCFunctionPtrCallExpPoint, caseCInputExpPoint, caseCIntConstExpPoint, caseCMallocExpPoint, caseCNullExpPoint, caseCOutputStmPoint, caseCPointerExpPoint, caseCReturnStmPoint, caseCVarExpPoint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubExpressions

public SubExpressions(NodeFilter<T> filter)
Creates a new SubExpressions instance using the NodeFilter filter for filtering nodes.

Parameters:
filter - the filter used for filtering nodes
Method Detail

defaultNode

public Collection<T> defaultNode(Node node,
                                 IProgramPoint point)
Returns all child nodes of node accepted by the filter.

Overrides:
defaultNode in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the Node associated with point
point - the IProgramPoint calling the method
Returns:
all child nodes of node accepted by the filter

caseEntryPoint

public Collection<T> caseEntryPoint(Node node,
                                    EntryPoint point)
Returns an empty set of nodes.

Specified by:
caseEntryPoint in interface CFGAnswer<Collection<T extends Node>>
Overrides:
caseEntryPoint in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the Node associated with point
point - the EntryPoint calling the method
Returns:
an empty set of nodes

caseExitPoint

public Collection<T> caseExitPoint(Node node,
                                   ExitPoint point)
Returns an empty set of nodes.

Specified by:
caseExitPoint in interface CFGAnswer<Collection<T extends Node>>
Overrides:
caseExitPoint in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the Node associated with point
point - the ExitPoint calling the method
Returns:
an empty set of nodes

caseCIfThenStmPoint

public Collection<T> caseCIfThenStmPoint(AIfThenStm node,
                                         CIfThenStmPoint point)
Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.

Specified by:
caseCIfThenStmPoint in interface CFGAnswer<Collection<T extends Node>>
Overrides:
caseCIfThenStmPoint in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the AIfThenStm associated with point
point - the CIfThenStmPoint calling the method
Returns:
child nodes of node accepted by the filter

caseCIfThenElseStmPoint

public Collection<T> caseCIfThenElseStmPoint(AIfThenElseStm node,
                                             CIfThenElseStmPoint point)
Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.

Specified by:
caseCIfThenElseStmPoint in interface CFGAnswer<Collection<T extends Node>>
Overrides:
caseCIfThenElseStmPoint in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the AIfThenElseStm associated with point
point - the CIfThenElseStmPoint calling the method
Returns:
child nodes of node accepted by the filter

caseCWhileStmPoint

public Collection<T> caseCWhileStmPoint(AWhileStm node,
                                        CWhileStmPoint point)
Returns all child nodes of the condition expression of node accepted by the filter and node if it is accepted by the filter.

Specified by:
caseCWhileStmPoint in interface CFGAnswer<Collection<T extends Node>>
Overrides:
caseCWhileStmPoint in class CFGAnswerAdapter<Collection<T extends Node>>
Parameters:
node - the AWhileStm associated with point
point - the CWhileStmPoint calling the method
Returns:
child nodes of node accepted by the filter