return sesemap.get(enter);
}
- private void analyzeMethod(FlatMethod fm, Set<SESENode> context) {
+ public Set<SESENode> getSESE(MethodDescriptor md) {
+ return discovered.get(md);
+ }
+
+ public Hashtable<FlatNode, Stack<SESENode>> analyzeMethod(FlatMethod fm) {
+ return analyzeMethod(fm, null);
+ }
+
+ private Hashtable<FlatNode, Stack<SESENode>> analyzeMethod(FlatMethod fm, Set<SESENode> context) {
Hashtable<FlatNode, Stack<SESENode>> stacks=new Hashtable<FlatNode, Stack<SESENode>> ();
stacks.put(fm, new Stack<SESENode>());
HashSet<FlatNode> tovisit=new HashSet<FlatNode>();
Stack<SESENode> instack=stacks.get(fm);
switch(fn.kind()) {
case FKind.FlatCall: {
+ if (context==null)
+ break;
FlatCall fc=(FlatCall)fn;
//handle method call
Set<SESENode> parents;
}
case FKind.FlatSESEEnterNode: {
FlatSESEEnterNode enter=(FlatSESEEnterNode)fn;
- Set<SESENode> parents;
- if (instack.isEmpty()) {
- parents=context;
- } else {
- parents=new HashSet<SESENode>();
- parents.add(instack.peek());
- }
- SESENode sese=getSESE(enter);
- for(Iterator<SESENode> parentit=parents.iterator();parentit.hasNext();) {
- SESENode parentsese=parentit.next();
- parentsese.addChild(sese);
+
+ if (context!=null) {
+ Set<SESENode> parents;
+ if (instack.isEmpty()) {
+ parents=context;
+ } else {
+ parents=new HashSet<SESENode>();
+ parents.add(instack.peek());
+ }
+ SESENode sese=getSESE(enter);
+ for(Iterator<SESENode> parentit=parents.iterator();parentit.hasNext();) {
+ SESENode parentsese=parentit.next();
+ parentsese.addChild(sese);
+ }
}
Stack<SESENode> copy=(Stack<SESENode>)instack.clone();
copy.push(sese);
}
}
}
-
-
+ return stacks;
}
public static boolean add(Hashtable<MethodDescriptor, Set<SESENode>> discovered, MethodDescriptor md, SESENode sese) {
class SESENode {
boolean isRoot;
HashSet<SESENode> children;
+ HashSet<SESENode> parents;
+
FlatSESEEnterNode node;
SESENode(FlatSESEEnterNode node, boolean isRoot) {
children=new HashSet<SESENode>();
return children.isEmpty();
}
- public void addChild(SESENode child) {
+ protected void addChild(SESENode child) {
children.add(child);
+ child.parents.add(this);
}
+ public Set<SESENode> getParents() {
+ return parents;
+ }
+
public Set<SESENode> getChildren() {
return children;
}