public int hashCode(Map<ParameterOrProcessEqualsWrapper, Integer> parameterOccurences) { final int prime = 31; int result = 1; result = prime * result + end.hashCode(parameterOccurences); result = prime * result + start.hashCode(parameterOccurences); return result; }
@Override public Range instantiate(Map<Parameter, Value> parameters) throws ArithmeticError { final Value newStart = start.instantiate(parameters); final Value newEnd = end.instantiate(parameters); if (start.equals(newStart) && end.equals(newEnd)) return this; return new IntervalRange(newStart, newEnd); }
public boolean equals( Object obj, Map<ParameterOrProcessEqualsWrapper, Integer> parameterOccurences) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final IntervalRange other = (IntervalRange) obj; if (!end.equals(other.end, parameterOccurences)) return false; if (!start.equals(other.start, parameterOccurences)) return false; return true; }
@Override public String toString() { final String startString = start.toString(); final String endString = end.toString(); final StringBuilder sb = new StringBuilder(startString.length() + endString.length() + 6); if (start instanceof ConstantValue || start instanceof ParameterReference) sb.append(startString); else sb.append('(').append(startString).append(')'); sb.append(".."); if (end instanceof ConstantValue || end instanceof ParameterReference) sb.append(endString); else sb.append('(').append(endString).append(')'); return sb.toString(); }