KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > Unit


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1997-1999 Raja Vallee-Rai
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 /*
21  * Modified by the Sable Research Group and others 1997-1999.
22  * See the 'credits' file distributed with Soot for the complete list of
23  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24  */

25
26
27 package soot;
28
29
30 import soot.tagkit.*;
31 import soot.util.*;
32 import java.util.*;
33 import java.io.*;
34
35 /** A code fragment (eg Stmt or Inst), used within Body
36  * classes. Intermediate representations must use an implementation
37  * of Unit for their code. In general, a unit denotes
38  * some sort of unit for execution.
39  */

40 public interface Unit extends Switchable, Host, Serializable, Context
41 {
42     /** Returns a list of Boxes containing Values used in this Unit. */
43     public List getUseBoxes();
44
45     /** Returns a list of Boxes containing Values defined in this Unit. */
46     public List getDefBoxes();
47
48     /** Returns a list of Boxes containing Units defined in this Unit; typically
49      * branch targets. */

50     public List getUnitBoxes();
51
52     /** Returns a list of Boxes pointing to this Unit. */
53     public List getBoxesPointingToThis();
54     /** Adds a box to the list returned by getBoxesPointingToThis. */
55     public void addBoxPointingToThis( UnitBox b );
56     /** Removes a box from the list returned by getBoxesPointingToThis. */
57     public void removeBoxPointingToThis( UnitBox b );
58     /** Clears any pointers to and from this Unit's UnitBoxes. */
59     public void clearUnitBoxes();
60     
61     /** Returns a list of Boxes containing any Value either used or defined
62      * in this Unit. */

63     public List getUseAndDefBoxes();
64
65     public Object JavaDoc clone();
66
67     /** Returns true if execution after this statement may continue at the following statement.
68      * GotoStmt will return false but IfStmt will return true. */

69     public boolean fallsThrough();
70     /** Returns true if execution after this statement does not necessarily continue at the following statement. GotoStmt and IfStmt will both return true. */
71     public boolean branches();
72     
73     public void toString(UnitPrinter up);
74
75     /**
76      * Redirects jumps to this Unit to newLocation. In general, you shouldn't
77      * have to use this directly.
78      *
79      * @see PatchingChain#getNonPatchingChain()
80      * @see soot.shimple.Shimple#redirectToPreds(Chain, Unit)
81      * @see soot.shimple.Shimple#redirectPointers(Unit, Unit)
82      **/

83     public void redirectJumpsToThisTo(Unit newLocation);
84 }
85
Popular Tags