KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > dava > internal > javaRep > DAbruptStmt


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

20
21 package soot.dava.internal.javaRep;
22
23 import java.util.*;
24 import soot.jimple.internal.*;
25 import soot.dava.internal.SET.*;
26 import soot.*;
27
28 public class DAbruptStmt extends AbstractStmt
29 {
30     private String JavaDoc command;
31     private SETNodeLabel label;
32
33
34     public boolean surpressDestinationLabel;
35
36     public DAbruptStmt( String JavaDoc command, SETNodeLabel label)
37     {
38     this.command = command;
39     this.label = label;
40
41     label.set_Name();
42     surpressDestinationLabel = false;
43     }
44
45     public boolean fallsThrough()
46     {
47     return false;
48     }
49
50     public boolean branches()
51     {
52     return false;
53     }
54
55     public Object JavaDoc clone()
56     {
57     return new DAbruptStmt( command, label);
58     }
59
60     public String JavaDoc toString()
61     {
62     StringBuffer JavaDoc b = new StringBuffer JavaDoc();
63
64     b.append( command);
65
66     if ((surpressDestinationLabel == false) && (label.toString() != null)) {
67         b.append( " ");
68         b.append( label.toString());
69     }
70
71     return b.toString();
72     }
73     
74     public void toString(UnitPrinter up) {
75         up.literal(command);
76         if ((surpressDestinationLabel == false) && (label.toString() != null)) {
77             up.literal( " ");
78             up.literal( label.toString());
79         }
80     }
81
82     public boolean is_Continue()
83     {
84     return command.equals( "continue");
85     }
86
87
88     public boolean is_Break(){
89     return command.equals("break");
90     }
91
92     /*
93       Nomair A. Naeem 20-FEB-2005
94       getter and setter methods for the label are needed for the aggregators of the AST conditionals
95     */

96     public void setLabel(SETNodeLabel label){
97     this.label=label;
98     }
99
100     public SETNodeLabel getLabel(){
101     return label;
102     }
103 }
104
Popular Tags