diff --git a/prism/src/parser/Values.java b/prism/src/parser/Values.java index 96aa84bb..eb18807b 100644 --- a/prism/src/parser/Values.java +++ b/prism/src/parser/Values.java @@ -241,16 +241,19 @@ public class Values implements Cloneable //implements Comparable public int getIntValue(int i) throws PrismLangException { Object o; - + o = values.get(i); - + if (o instanceof Boolean) { return ((Boolean)o).booleanValue() ? 1 : 0; } if (o instanceof Integer) { return ((Integer)o).intValue(); } - + if (o instanceof BigRational) { + return ((BigRational)o).toInt(); + } + throw new PrismLangException("Cannot get integer value for \"" + getName(i) + "\""); } @@ -273,6 +276,9 @@ public class Values implements Cloneable //implements Comparable if (o instanceof Double) { return ((Double)o).doubleValue(); } + if (o instanceof BigRational) { + return ((BigRational)o).doubleValue(); + } throw new PrismLangException("Cannot get double value for \"" + getName(i) + "\""); } @@ -283,14 +289,16 @@ public class Values implements Cloneable //implements Comparable public boolean getBooleanValue(int i) throws PrismLangException { Object o; - + o = values.get(i); - - if (!(o instanceof Boolean)) { + + if (o instanceof Boolean) { + return ((Boolean)o).booleanValue(); + } else if (o instanceof BigRational) { + return ((BigRational)o).toBoolean(); + } else { throw new PrismLangException("Cannot get boolean value for \"" + getName(i) + "\""); } - - return ((Boolean)o).booleanValue(); } /**