@Test public void compare() { ExprIntervalValue v1 = new ExprIntervalValue(Period.ofDays(1)); ExprIntervalValue v2 = new ExprIntervalValue(Period.ofDays(2)); assertEquals(v1.compare(v2), -1); }
@Override public int compare(ExprValue other) { TemporalAmount otherInterval = other.intervalValue(); if (!interval.getClass().equals(other.intervalValue().getClass())) { throw new ExpressionEvaluationException( String.format("invalid to compare intervals with units %s and %s", unit(), ((ExprIntervalValue) other).unit())); } return Long.compare( interval.get(unit()), otherInterval.get(((ExprIntervalValue) other).unit())); }
ExprIntervalValue extends AbstractExprValue { @Override public int compare(ExprValue other) { TemporalAmount otherInterval = other.intervalValue(); if (!interval.getClass().equals(other.intervalValue().getClass())) { throw new ExpressionEvaluationException( String.format("invalid to compare intervals with units %s and %s", unit(), ((ExprIntervalValue) other).unit())); } return Long.compare( interval.get(unit()), otherInterval.get(((ExprIntervalValue) other).unit())); } }
ExprIntervalValue extends AbstractExprValue { @Override public int compare(ExprValue other) { TemporalAmount otherInterval = other.intervalValue(); if (!interval.getClass().equals(other.intervalValue().getClass())) { throw new ExpressionEvaluationException( String.format("invalid to compare intervals with units %s and %s", unit(), ((ExprIntervalValue) other).unit())); } return Long.compare( interval.get(unit()), otherInterval.get(((ExprIntervalValue) other).unit())); }  }
ExprIntervalValue extends AbstractExprValue { @Override public int compare(ExprValue other) { TemporalAmount otherInterval = other.intervalValue(); if (!interval.getClass().equals(other.intervalValue().getClass())) { throw new ExpressionEvaluationException( String.format("invalid to compare intervals with units %s and %s", unit(), ((ExprIntervalValue) other).unit())); } return Long.compare( interval.get(unit()), otherInterval.get(((ExprIntervalValue) other).unit())); }  @Override TemporalAmount intervalValue(); @Override int compare(ExprValue other); @Override boolean equal(ExprValue other); @Override TemporalAmount value(); @Override ExprType type(); TemporalUnit unit(); }
ExprIntervalValue extends AbstractExprValue { @Override public int compare(ExprValue other) { TemporalAmount otherInterval = other.intervalValue(); if (!interval.getClass().equals(other.intervalValue().getClass())) { throw new ExpressionEvaluationException( String.format("invalid to compare intervals with units %s and %s", unit(), ((ExprIntervalValue) other).unit())); } return Long.compare( interval.get(unit()), otherInterval.get(((ExprIntervalValue) other).unit())); }  @Override TemporalAmount intervalValue(); @Override int compare(ExprValue other); @Override boolean equal(ExprValue other); @Override TemporalAmount value(); @Override ExprType type(); TemporalUnit unit();  }