1 20 21 package soot.dava.internal.AST; 22 23 import java.util.*; 24 import soot.*; 25 import soot.jimple.*; 26 import soot.dava.internal.SET.*; 27 import soot.dava.toolkits.base.AST.*; 28 import soot.dava.toolkits.base.AST.analysis.*; 29 30 public class ASTWhileNode extends ASTControlFlowNode 31 { 32 private List body; 33 34 public ASTWhileNode( SETNodeLabel label, ConditionExpr ce, List body) 35 { 36 super( label, ce); 37 this.body = body; 38 39 subBodies.add( body); 40 } 41 42 43 48 public ASTWhileNode( SETNodeLabel label, ASTCondition ce, List body) 49 { 50 super( label, ce); 51 this.body = body; 52 53 subBodies.add( body); 54 } 55 56 60 public void replaceBody(List body){ 61 this.body=body; 62 subBodies=new ArrayList(); 63 subBodies.add(body); 64 } 65 66 public Object clone() 67 { 68 return new ASTWhileNode( get_Label(), get_Condition(), body); 69 } 70 71 public void toString( UnitPrinter up ) 72 { 73 label_toString( up ); 74 75 up.literal( "while" ); 76 up.literal( " " ); 77 up.literal( "(" ); 78 condition.toString( up ); 79 up.literal( ")" ); 80 up.newline(); 81 82 up.literal( "{" ); 83 up.newline(); 84 85 up.incIndent(); 86 body_toString( up, body ); 87 up.decIndent(); 88 89 up.literal( "}" ); 90 up.newline(); 91 } 92 93 public String toString( ) 94 { 95 StringBuffer b = new StringBuffer (); 96 97 b.append( label_toString( )); 98 99 b.append( "while ("); 100 b.append( get_Condition().toString()); 101 b.append( ")"); 102 b.append( NEWLINE); 103 104 b.append( "{"); 105 b.append( NEWLINE); 106 107 b.append( body_toString( body)); 108 109 b.append( "}"); 110 b.append( NEWLINE); 111 112 return b.toString(); 113 } 114 115 120 public void apply(Analysis a){ 121 a.caseASTWhileNode(this); 122 } 123 } 124 | Popular Tags |