|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.mjc.CModifier
This class provides utilities for operating on modifier bit masks.
| Field Summary | |
protected long[] |
codes
|
private HashMap |
codesMap
Maps from code values to preferred positions. |
protected String[] |
names
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
CModifier()
Instantiate the modifier utilities for the default modifier bit-masks and names. |
|
CModifier(long[] codes,
String[] names)
Instantiate the modifier utilities for the given modifier bit-masks and names. |
|
| Method Summary | |
String |
asString(long modifiers)
Returns a string with the names of all the modifiers in the preferred order. |
String[] |
asStrings(long modifiers)
Returns an array of the names of all the modifiers in the preferred order. |
private void |
calculateCodesMap()
|
long[] |
codes()
Returns the codes of modifiers |
private int |
highestPos(long mods)
Returns the highest of index from codes of a
modifier flag that is set in mods. |
boolean |
inPreferredOrder(long previousMods,
long newMod)
Returns true if no modifiers in previousMods are
supposed to come after the modifier in newMod. |
private int |
modPos(long mod)
Returns the index of mod in codes. |
String |
nameOf(long mod)
Returns the name of the given modifier. |
String[] |
names()
Returns the names of modifiers |
private long |
stripInternalMods(long mod)
|
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected String[] names
protected long[] codes
private HashMap codesMap
| Constructor Detail |
public CModifier()
CModifier( Constants.ACCESS_FLAG_ARRAY,
Constants.ACCESS_FLAG_NAMES );
Constants,
Constants.ACCESS_FLAG_ARRAY,
Constants.ACCESS_FLAG_NAMES
public CModifier(long[] codes,
String[] names)
codes - an array of modifier bit-masks, typically from the
ACCESS_FLAG_ARRAY field of the
appropriate Constants interface.names - an array of modifier names, typically from the
ACCESS_FLAG_NAMES field of the
appropriate Constants interface.Constants,
Constants.ACCESS_FLAG_ARRAY,
Constants.ACCESS_FLAG_NAMES| Method Detail |
private void calculateCodesMap()
public long[] codes()
public String[] names()
public String asString(long modifiers)
asString in interface ModifierUtilitypublic String[] asStrings(long modifiers)
asStrings in interface ModifierUtility
public boolean inPreferredOrder(long previousMods,
long newMod)
previousMods are
supposed to come after the modifier in newMod.
inPreferredOrder in interface ModifierUtilitypublic String nameOf(long mod)
also {| requires modPos( mod ) != -1; ensures \result.equals( names[ modPos( mod ) ] ); also requires modPos( mod ) == -1; signals_only IllegalArgumentException; |}
nameOf in interface ModifierUtilityprivate int highestPos(long mods)
codes of a
modifier flag that is set in mods.
ensures \result == ( \max int i; 0 <= i && i < codes.length && hasFlag( mods, codes[i] ); i );
mods - a modifier bit-mask private int modPos(long mod)
mod in codes.
{| requires (\exists int i; 0 <= i && i < codes.length; codes[i]==mod ); ensures codes[\result] == mod; also requires !(\exists int i; 0 <= i && i < codes.length; codes[i]==mod); ensures \result == -1; |}
private long stripInternalMods(long mod)
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||