Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

LabeledStmtAnnotation.java

00001 package edu.ksu.cis.bandera.annotation;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 1999, 2000   Robby (robby@cis.ksu.edu)              *
00006  * All rights reserved.                                              *
00007  *                                                                   *
00008  * This work was done as a project in the SAnToS Laboratory,         *
00009  * Department of Computing and Information Sciences, Kansas State    *
00010  * University, USA (http://www.cis.ksu.edu/santos).                  *
00011  * It is understood that any modification not identified as such is  *
00012  * not covered by the preceding statement.                           *
00013  *                                                                   *
00014  * This work is free software; you can redistribute it and/or        *
00015  * modify it under the terms of the GNU Library General Public       *
00016  * License as published by the Free Software Foundation; either      *
00017  * version 2 of the License, or (at your option) any later version.  *
00018  *                                                                   *
00019  * This work is distributed in the hope that it will be useful,      *
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00022  * Library General Public License for more details.                  *
00023  *                                                                   *
00024  * You should have received a copy of the GNU Library General Public *
00025  * License along with this toolkit; if not, write to the             *
00026  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00027  * Boston, MA  02111-1307, USA.                                      *
00028  *                                                                   *
00029  * Java is a trademark of Sun Microsystems, Inc.                     *
00030  *                                                                   *
00031  * To submit a bug report, send a comment, or get the latest news on *
00032  * this project and other SAnToS projects, please visit the web-site *
00033  *                http://www.cis.ksu.edu/santos                      *
00034  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00035 import edu.ksu.cis.bandera.jjjc.node.*;
00036 import ca.mcgill.sable.soot.jimple.*;
00037 import ca.mcgill.sable.util.*;
00038 import java.util.*;
00039 public class LabeledStmtAnnotation extends SequentialAnnotation {
00040     private String id = null;
00041     private Annotation annotation = null;
00042 /**
00043  * LabeledStmtAnnotation constructor comment.
00044  * @param node edu.ksu.cis.bandera.jjjc.node.Node
00045  */
00046 public LabeledStmtAnnotation(edu.ksu.cis.bandera.jjjc.node.Node node) {
00047     super(node);
00048 }
00049     public void apply(Switch sw)
00050     {
00051         ((AnnotationSwitch) sw).caseLabeledStmtAnnotation(this);
00052     }
00053 /**
00054  * 
00055  * @return java.lang.Object
00056  */
00057 public Object clone() {
00058     LabeledStmtAnnotation result = new LabeledStmtAnnotation((Node) node.clone());
00059     result.id = id;
00060     if (annotation != null) result.annotation = (Annotation) annotation.clone();
00061     return result;
00062 }
00063 /**
00064  * 
00065  * @return java.util.Vector
00066  * @param includeSequential boolean
00067  */
00068 public Vector getAllAnnotations(boolean includeSequential) {
00069     Vector result = new Vector();
00070     result.addElement(this);
00071     result.addAll(annotation.getAllAnnotations(includeSequential));
00072     return result;
00073 }
00074 /**
00075  * 
00076  * @return edu.ksu.cis.bandera.annotations.Annotation
00077  */
00078 public Annotation getAnnotation() {
00079     return annotation;
00080 }
00081 /**
00082  * 
00083  * @return edu.ksu.cis.bandera.annotations.Annotation
00084  * @param stmt ca.mcgill.sable.soot.jimple.Stmt
00085  */
00086 public Annotation getContainingAnnotation(Stmt stmt) throws AnnotationException {
00087     return (annotation != null) ? annotation.getContainingAnnotation(stmt) : null;
00088 }
00089 /**
00090  * 
00091  * @return java.lang.String
00092  */
00093 public String getId() {
00094     return id;
00095 }
00096 /**
00097  * 
00098  * @return Stmt[]
00099  */
00100 public Stmt[] getStatements() {
00101     return (annotation != null) ? annotation.getStatements() : new Stmt[0];
00102 }
00103 /**
00104  * 
00105  * @return boolean
00106  * @param stmt ca.mcgill.sable.soot.jimple.Stmt
00107  */
00108 public boolean removeStmt(Stmt stmt) throws AnnotationException {
00109     if (annotation != null) return annotation.removeStmt(stmt);
00110     else return false;
00111 }
00112 /**
00113  * 
00114  * @return boolean
00115  * @param stmt ca.mcgill.sable.soot.jimple.Stmt
00116  */
00117 public boolean removeStmtByMark(Stmt stmt) throws AnnotationException {
00118     if (annotation != null) return annotation.removeStmtByMark(stmt);
00119     else return false;
00120 }
00121 /**
00122  * 
00123  * @return boolean
00124  * @param oldStmt ca.mcgill.sable.soot.jimple.Stmt
00125  * @param newStmt ca.mcgill.sable.soot.jimple.Stmt
00126  */
00127 public boolean replaceStmt(Stmt oldStmt, Stmt newStmt) throws AnnotationException {
00128     if (annotation != null) return annotation.replaceStmt(oldStmt, newStmt);
00129     else return false;
00130 }
00131 /**
00132  * 
00133  * @return boolean
00134  * @param oldStmt ca.mcgill.sable.soot.jimple.Stmt
00135  * @param newStmt ca.mcgill.sable.soot.jimple.Stmt
00136  */
00137 public boolean replaceStmtByMark(Stmt oldStmt, Stmt newStmt) throws AnnotationException {
00138     if (annotation != null) return annotation.replaceStmtByMark(oldStmt, newStmt);
00139     else return false;
00140 }
00141 /**
00142  * 
00143  * @param annotation edu.ksu.cis.bandera.annotations.Annotation
00144  */
00145 public void setAnnotation(Annotation annotation) {
00146     this.annotation = annotation;
00147     this.annotation.setParent(this);
00148 }
00149 /**
00150  * 
00151  * @param id java.lang.String
00152  */
00153 public void setId(String id) {
00154     this.id = id;
00155 }
00156 /**
00157  * 
00158  * @return java.lang.String
00159  */
00160 public String toString() {
00161     return id + ":";
00162 }
00163 /**
00164  * 
00165  * @param body JimpleBody
00166  */
00167 public void validate(JimpleBody body) {
00168     if (annotation != null) annotation.validate(body);
00169 }
00170 }

Generated at Thu Feb 7 06:49:08 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001