KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > dava > internal > AST > ASTLabeledNode


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jerome Miecznikowski
3  * Copyright (C) 2004-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.AST;
22
23 import soot.*;
24 import soot.dava.internal.SET.*;
25 import soot.dava.toolkits.base.AST.*;
26
27 public abstract class ASTLabeledNode extends ASTNode
28 {
29     private SETNodeLabel label;
30     
31     public ASTLabeledNode( SETNodeLabel label)
32     {
33     super();
34
35     set_Label( label);
36     }
37
38     public SETNodeLabel get_Label()
39     {
40     return label;
41     }
42
43     public void set_Label( SETNodeLabel label)
44     {
45     this.label = label;
46     }
47
48     public void perform_Analysis( ASTAnalysis a)
49     {
50     perform_AnalysisOnSubBodies( a);
51     }
52
53     public void label_toString( UnitPrinter up )
54     {
55     if (label.toString() != null) {
56             up.literal( label.toString() );
57             up.literal( ":" );
58             up.newline();
59     }
60     }
61
62     public String JavaDoc label_toString()
63     {
64     if (label.toString() == null)
65         return new String JavaDoc();
66
67     else {
68         StringBuffer JavaDoc b = new StringBuffer JavaDoc();
69
70         b.append( label.toString());
71         b.append( ":");
72         b.append( ASTNode.NEWLINE);
73
74         return b.toString();
75     }
76     }
77 }
78
Popular Tags