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 ASTDoWhileNode extends ASTControlFlowNode 31 { 32 private List body; 33 34 public ASTDoWhileNode( SETNodeLabel label, ConditionExpr ce, List body) 35 { 36 super( label, ce); 37 this.body = body; 38 39 subBodies.add( body); 40 } 41 42 47 public ASTDoWhileNode( SETNodeLabel label, ASTCondition ce, List body) 48 { 49 super( label, ce); 50 this.body = body; 51 52 subBodies.add( body); 53 } 54 55 59 public void replaceBody(List body){ 60 this.body=body; 61 subBodies=new ArrayList(); 62 subBodies.add(body); 63 } 64 65 public Object clone() 66 { 67 return new ASTDoWhileNode( get_Label(), get_Condition(), body); 68 } 69 70 public void toString( UnitPrinter up ) 71 { 72 label_toString( up); 73 74 up.literal( "do" ); 75 up.newline(); 76 77 up.literal( "{" ); 78 up.newline(); 79 80 up.incIndent(); 81 body_toString( up, body ); 82 up.decIndent(); 83 84 up.literal( "}" ); 85 up.newline(); 86 87 up.literal( "while" ); 88 up.literal( " " ); 89 up.literal( "(" ); 90 condition.toString(up); 91 up.literal( ")" ); 92 up.literal( ";" ); 93 up.newline(); 94 } 95 96 public String toString() 97 { 98 StringBuffer b = new StringBuffer (); 99 100 b.append( label_toString()); 101 102 b.append( "do"); 103 b.append( NEWLINE); 104 105 b.append( "{"); 106 b.append( NEWLINE); 107 108 b.append( body_toString(body)); 109 110 b.append( "}"); 111 b.append( NEWLINE); 112 113 b.append( "while ("); 114 b.append( get_Condition().toString()); 115 b.append( ");"); 116 b.append( NEWLINE); 117 118 return b.toString(); 119 } 120 121 126 public void apply(Analysis a){ 127 a.caseASTDoWhileNode(this); 128 } 129 } 130 | Popular Tags |