ElevatorSystemState implements State<ElevatorSystemState> { public static int hashCode(double x) { return (int)Math.round((round(x, (int)-Math.log10(RATE_EPSILON)) / RATE_EPSILON)); } ElevatorSystemState(); int getIntervalNum(); int getTotalPassengers(); double getUp(); double getDown(); double getInterfloor(); void update(StatsInterval interval); @Override void set(ElevatorSystemState other); static int hashCode(double x); static int hashCode(int x); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEpsilons() { assertEquals(0, ElevatorSystemState.hashCode(0.0)); assertEquals(1, ElevatorSystemState.hashCode(0.05)); assertEquals(1, ElevatorSystemState.hashCode(0.1)); assertEquals(2, ElevatorSystemState.hashCode(0.15)); assertEquals(2, ElevatorSystemState.hashCode(0.2)); assertEquals(2, ElevatorSystemState.hashCode(0.24)); assertEquals(0, ElevatorSystemState.hashCode(49)); assertEquals(1, ElevatorSystemState.hashCode(51)); assertEquals(1, ElevatorSystemState.hashCode(100)); assertEquals(2, ElevatorSystemState.hashCode(150)); }