1 20 21 package soot.dava.internal.AST; 22 23 import soot.*; 24 import soot.jimple.*; 25 import java.util.*; 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 ASTSynchronizedBlockNode extends ASTLabeledNode 31 { 32 private List body; 33 private ValueBox localBox; 34 35 public ASTSynchronizedBlockNode( SETNodeLabel label, List body, Value local) 36 { 37 super( label); 38 this.body = body; 39 this.localBox = Jimple.v().newLocalBox( local ); 40 41 subBodies.add( body); 42 } 43 44 48 public void replaceBody(List body){ 49 this.body=body; 50 subBodies=new ArrayList(); 51 subBodies.add(body); 52 } 53 54 public int size() 55 { 56 return body.size(); 57 } 58 59 public Local getLocal() { 60 return (Local) localBox.getValue(); 61 } 62 63 64 public void setLocal(Local local){ 65 this.localBox = Jimple.v().newLocalBox( local ); 66 } 67 68 public Object clone() 69 { 70 return new ASTSynchronizedBlockNode( get_Label(), body, getLocal()); 71 } 72 73 public void toString( UnitPrinter up) 74 { 75 label_toString(up); 76 77 81 up.literal( "synchronized ("); 82 localBox.toString(up); 83 up.literal( ")"); 84 up.newline(); 85 86 up.literal( "{" ); 87 up.newline(); 88 89 up.incIndent(); 90 body_toString( up, body ); 91 up.decIndent(); 92 93 up.literal( "}" ); 94 up.newline(); 95 } 96 97 public String toString() 98 { 99 StringBuffer b = new StringBuffer (); 100 101 b.append( label_toString( )); 102 103 b.append( "synchronized ("); 104 b.append( getLocal()); 105 b.append( ")"); 106 b.append( NEWLINE); 107 108 b.append( "{"); 109 b.append( NEWLINE); 110 111 b.append( body_toString( body)); 112 113 b.append( "}"); 114 b.append( NEWLINE); 115 116 return b.toString(); 117 } 118 119 120 121 122 127 public void apply(Analysis a){ 128 a.caseASTSynchronizedBlockNode(this); 129 } 130 } 131 | Popular Tags |