1 20 21 package soot.dava.internal.AST; 22 23 import java.util.*; 24 import soot.*; 25 import soot.dava.internal.SET.*; 26 import soot.dava.toolkits.base.AST.analysis.*; 27 28 public class ASTUnconditionalLoopNode extends ASTLabeledNode 29 { 30 private List body; 31 32 public ASTUnconditionalLoopNode( SETNodeLabel label, List body) 33 { 34 super( label); 35 this.body = body; 36 37 subBodies.add( body); 38 } 39 40 44 public void replaceBody(List body){ 45 this.body=body; 46 subBodies=new ArrayList(); 47 subBodies.add(body); 48 } 49 50 public Object clone() 51 { 52 return new ASTUnconditionalLoopNode( get_Label(), body); 53 } 54 55 public void toString( UnitPrinter up ) { 56 label_toString( up ); 57 up.literal( "while" ); 58 up.literal( " " ); 59 up.literal( "(" ); 60 up.literal( "true" ); 61 up.literal( ")" ); 62 up.newline(); 63 64 up.literal( "{" ); 65 up.newline(); 66 67 up.incIndent(); 68 body_toString( up, body ); 69 up.decIndent(); 70 71 up.literal( "}" ); 72 up.newline(); 73 } 74 75 public String toString() 76 { 77 StringBuffer b = new StringBuffer (); 78 79 b.append( label_toString( )); 80 81 b.append( "while (true)"); 82 b.append( NEWLINE); 83 84 b.append( "{"); 85 b.append( NEWLINE); 86 87 b.append( body_toString( body)); 88 89 b.append( "}"); 90 b.append( NEWLINE); 91 92 return b.toString(); 93 } 94 95 96 101 public void apply(Analysis a){ 102 a.caseASTUnconditionalLoopNode(this); 103 } 104 } 105 | Popular Tags |