new constant value accessors

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1376 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
dolby-oss 2007-07-06 15:13:06 +00:00
parent da8c93ec1a
commit 9ffe419bb3
1 changed files with 14 additions and 0 deletions

View File

@ -298,6 +298,13 @@ public class SymbolTable {
return (String) ((ConstantValue) values[v]).getValue();
}
public float getFloatValue(int v) throws IllegalArgumentException {
if (!isNumberConstant(v)) {
throw new IllegalArgumentException("value number " + v + " is not a numeric constant.");
}
return ((Number) ((ConstantValue) values[v]).getValue()).floatValue();
}
public double getDoubleValue(int v) throws IllegalArgumentException {
if (!isNumberConstant(v)) {
throw new IllegalArgumentException("value number " + v + " is not a numeric constant.");
@ -312,6 +319,13 @@ public class SymbolTable {
return ((Number) ((ConstantValue) values[v]).getValue()).intValue();
}
public long getLongValue(int v) throws IllegalArgumentException {
if (!isNumberConstant(v)) {
throw new IllegalArgumentException("value number " + v + " is not a numeric constant.");
}
return ((Number) ((ConstantValue) values[v]).getValue()).longValue();
}
public Object getConstantValue(int v) throws IllegalArgumentException{
if (!isConstant(v)) {
throw new IllegalArgumentException("value number " + v + " is not a constant.");