AbstractXClock implements XClock<F> { @Override public final boolean equals( final Object obj) { LOGGER.trace("begin {}.equals({})", new Object[] { getClass().getSimpleName(), obj }); final boolean rval; if (obj == this) { rval = true; } else if ((obj == null) || !(obj instanceof XClock<?>)) { rval = false; } else { _timeLock.lock(); try { final XClock<?> other = (XClock<?>)obj; rval = _time.equals(other.getTime()); } finally { _timeLock.unlock(); } } LOGGER.trace("will return: {}", rval); LOGGER.trace("end {}.equals()", getClass().getSimpleName()); return rval; } protected  AbstractXClock(
            final long tick,
            final F phase,
            final F[] allPhases); protected  AbstractXClock(
            final F[] allPhases); @Override final XTime<F> getTime(); @Override final XTime<F> increment(); @Override void setTime(
            final XTime<F> time); @Override final int compareTo(
            final XClock<F> other); @Override final boolean equals(
            final Object obj); @Override final int hashCode(); @Override final String toString();  }
@Override @Test public final void equalsIdentical() { final AbstractXClockImpl clock = new AbstractXClockImpl(PhaseImpl .values()); assertThat(clock.equals(clock), is(true)); }
@Override @Test public final void equalsSameTime() { final AbstractXClockImpl clock = new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl.values()); final AbstractXClockImpl sameClock = new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl.values()); assertThat(clock.equals(sameClock), is(true)); }
@Override @Test public final void equalsDifferentTick() { final AbstractXClockImpl clock = new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl.values()); final AbstractXClockImpl differentTickClock = new AbstractXClockImpl(0, PhaseImpl.PHASE_1, PhaseImpl.values()); assertThat(clock.equals(differentTickClock), is(false)); }
@Override @Test public final void equalsDifferentPhase() { final AbstractXClockImpl clock = new AbstractXClockImpl(1, PhaseImpl.PHASE_2, PhaseImpl.values()); final AbstractXClockImpl differentPhaseClock = new AbstractXClockImpl( 1, PhaseImpl.PHASE_1, PhaseImpl.values()); assertThat(clock.equals(differentPhaseClock), is(false)); }
@Override @Test public final void equalsNull() { assertThat(new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl .values()).equals((XClock<?>)null), is(false)); }
@Override @Test public final void equalsNonClock() { assertThat(new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl .values()).equals("not a clock"), is(false)); }