Browse Source

Values, getXYValue(): support for BigRational

master
Joachim Klein 8 years ago
committed by Dave Parker
parent
commit
9294070eb1
  1. 14
      prism/src/parser/Values.java

14
prism/src/parser/Values.java

@ -250,6 +250,9 @@ public class Values implements Cloneable //implements Comparable
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) + "\"");
}
@ -286,11 +292,13 @@ public class Values implements Cloneable //implements Comparable
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();
}
/**

Loading…
Cancel
Save