KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > dava > internal > SET > SETSynchronizedBlockNode


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jerome Miecznikowski
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package soot.dava.internal.SET;
21
22 import soot.*;
23 import java.util.*;
24 import soot.util.*;
25 import soot.dava.internal.asg.*;
26 import soot.dava.internal.AST.*;
27 import soot.dava.toolkits.base.finders.*;
28
29 public class SETSynchronizedBlockNode extends SETNode
30 {
31     private Value local;
32
33     public SETSynchronizedBlockNode( ExceptionNode en, Value local)
34     {
35     super( en.get_Body());
36
37     add_SubBody( en.get_TryBody());
38     add_SubBody( en.get_CatchBody());
39
40     this.local = local;
41     }
42
43     public IterableSet get_NaturalExits()
44     {
45     return ((SETNode) ((IterableSet) body2childChain.get( subBodies.get(0))).getLast()).get_NaturalExits();
46     }
47
48     public ASTNode emit_AST()
49     {
50         return new ASTSynchronizedBlockNode( get_Label(), emit_ASTBody( (IterableSet) body2childChain.get( subBodies.get(0))), local);
51     }
52
53     public AugmentedStmt get_EntryStmt()
54     {
55     return ((SETNode) ((IterableSet) body2childChain.get( subBodies.get(0))).getFirst()).get_EntryStmt();
56     }
57
58     protected boolean resolve( SETNode parent)
59     {
60     Iterator sbit = parent.get_SubBodies().iterator();
61
62     while (sbit.hasNext()) {
63         IterableSet subBody = (IterableSet) sbit.next();
64         
65         if (subBody.intersects( get_Body()))
66         return subBody.isSupersetOf( get_Body());
67     }
68
69     return true;
70     }
71 }
72
Popular Tags