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

Modifier.java

00001 package ca.mcgill.sable.soot;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Soot, a Java(TM) classfile optimization framework.                *
00005  * Copyright (C) 1997, 1998 Raja Vallee-Rai (kor@sable.mcgill.ca)    *
00006  * All rights reserved.                                              *
00007  *                                                                   *
00008  * This work was done as a project of the Sable Research Group,      *
00009  * School of Computer Science, McGill University, Canada             *
00010  * (http://www.sable.mcgill.ca/).  It is understood that any         *
00011  * modification not identified as such is not covered by the         *
00012  * 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 library; 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 Sable Research Group projects, please      *
00033  * visit the web site: http://www.sable.mcgill.ca/                   *
00034  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00035 
00036 /*
00037  Reference Version
00038  -----------------
00039  This is the latest official version on which this file is based.
00040  The reference version is: $SootVersion: 1.beta.4 $
00041 
00042  Change History
00043  --------------
00044  A) Notes:
00045 
00046  Please use the following template.  Most recent changes should
00047  appear at the top of the list.
00048 
00049  - Modified on [date (March 1, 1900)] by [name]. [(*) if appropriate]
00050    [description of modification].
00051 
00052  Any Modification flagged with "(*)" was done as a project of the
00053  Sable Research Group, School of Computer Science,
00054  McGill University, Canada (http://www.sable.mcgill.ca/).
00055 
00056  You should add your copyright, using the following template, at
00057  the top of this file, along with other copyrights.
00058 
00059  *                                                                   *
00060  * Modifications by [name] are                                       *
00061  * Copyright (C) [year(s)] [your name (or company)].  All rights     *
00062  * reserved.                                                         *
00063  *                                                                   *
00064 
00065  B) Changes:
00066 
00067  - Modified on November 2, 1998 by Raja Vallee-Rai (kor@sable.mcgill.ca) (*)
00068    Repackaged all source files and performed extensive modifications.
00069    First initial release of Soot.
00070 
00071  - Modified on 15-Jun-1998 by Raja Vallee-Rai (kor@sable.mcgill.ca). (*)
00072    First internal release (Version 0.1).
00073 */
00074 
00075 // Incomplete class
00076 
00077 public class Modifier
00078 {
00079     public static final int ABSTRACT =     0x0400;
00080     public static final int FINAL =        0x0010;
00081     public static final int INTERFACE =    0x0200;
00082     public static final int NATIVE =       0x0100;
00083     public static final int PRIVATE =      0x0002;
00084     public static final int PROTECTED =    0x0004;
00085     public static final int PUBLIC =       0x0001;
00086     public static final int STATIC =       0x0008;
00087     public static final int SYNCHRONIZED = 0x0020;
00088     public static final int TRANSIENT =    0x0080;
00089     public static final int VOLATILE =     0x0040;
00090 
00091     private Modifier()
00092     {
00093     }
00094     public static boolean isAbstract(int m)
00095     {
00096         return (m & ABSTRACT) != 0;
00097     }
00098     public static boolean isFinal(int m )
00099     {
00100         return (m & FINAL) != 0;
00101     }
00102     public static boolean isInterface(int m)
00103     {
00104         return (m & INTERFACE) != 0;
00105     }
00106     public static boolean isNative(int m)
00107     {
00108         return (m & NATIVE) != 0;
00109     }
00110     public static boolean isPrivate(int m)
00111     {
00112         return (m & PRIVATE) != 0;
00113     }
00114     public static boolean isProtected(int m)
00115     {
00116         return (m & PROTECTED) != 0;
00117     }
00118     public static boolean isPublic(int m)
00119     {
00120         return (m & PUBLIC) != 0;
00121     }
00122     public static boolean isStatic(int m)
00123     {
00124         return (m & STATIC) != 0;
00125     }
00126     public static boolean isSynchronized(int m)
00127     {
00128         return (m & SYNCHRONIZED) != 0;
00129     }
00130     public static boolean isTransient(int m )
00131     {
00132         return (m & TRANSIENT) != 0;
00133     }
00134     public static boolean isVolatile(int m)
00135     {
00136         return (m & VOLATILE) != 0;
00137     }
00138     /**
00139      * Converts the given modifiers to their string representation, in canonical form.
00140      */
00141 
00142     public static String toString(int m)
00143     {
00144         StringBuffer buffer = new StringBuffer();
00145 
00146         if(isPublic(m))
00147             buffer.append("public ");
00148         else if(isPrivate(m))
00149             buffer.append("private ");
00150         else if(isProtected(m))
00151             buffer.append("protected ");
00152 
00153         if(isAbstract(m))
00154             buffer.append("abstract ");
00155 
00156         if(isInterface(m))
00157             buffer.append("interface ");
00158 
00159         if(isStatic(m))
00160             buffer.append("static ");
00161 
00162         if(isFinal(m))
00163             buffer.append("final ");
00164 
00165         if(isSynchronized(m))
00166             buffer.append("synchronized ");
00167 
00168         if(isNative(m))
00169             buffer.append("native ");
00170 
00171         if(isTransient(m))
00172             buffer.append("transient ");
00173 
00174         if(isVolatile(m))
00175             buffer.append("volatile ");
00176 
00177         return (buffer.toString()).trim();
00178     }
00179 }

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