- Workaround for bug with plotting when given INF value.

- Fixed bug with hashing which was not dependent on symbol and would thus give same hash for the range expressions applied to a different variable
- Fixed bug with hashing in which a < could weirdly show up due to unhandled - sign in original string hash
This commit is contained in:
Richard Graham 2012-09-14 05:34:21 +00:00
parent 0a2ddd9d6e
commit 4172bb3bf6

View File

@ -352,7 +352,9 @@ public class CustomExpression implements Cloneable{
}
public Double evaluateDouble(SimulationStatus status){
return evaluate(status).getDoubleValue();
double result = evaluate(status).getDoubleValue();
if (result == Double.NEGATIVE_INFINITY || result == Double.POSITIVE_INFINITY) result = Double.NaN;
return result;
}
/*
@ -498,9 +500,10 @@ public class CustomExpression implements Cloneable{
* Used for temporary substitution when evaluating index and range expressions.
*/
public String hash(){
Integer hashint = new Integer(this.getExpressionString().hashCode());
Integer hashint = new Integer(this.getExpressionString().hashCode() + symbol.hashCode());
String hash = "$";
for (char c : hashint.toString().toCharArray()){
if (c == '-') c = '0';
char newc = (char) (c + 17);
hash = hash + newc;
}