AbstractXClock implements XClock<F> { @Override public final XTime<F> increment() { LOGGER.trace("begin {}.increment()", getClass().getSimpleName()); _timeLock.lock(); try { final F nextPhase = _allPhases.get( (_allPhases.indexOf(_time.getPhase()) + 1) % _allPhases.size()); final long tick = _time.getTick() + (nextPhase.equals(_allPhases.get(0)) ? 1 : 0); _time = new SimpleXTime<F>(tick, nextPhase); LOGGER.trace("will return: {}", _time); LOGGER.trace("end {}.increment()", getClass().getSimpleName()); return _time; } finally { _timeLock.unlock(); } } 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 incrementPhase() { final XTime<PhaseImpl> incrementedTime = new AbstractXClockImpl(1, PhaseImpl.PHASE_1, PhaseImpl.values()).increment(); assertThat(incrementedTime.getTick(), is(1L)); assertThat(incrementedTime.getPhase(), is(PhaseImpl.PHASE_2)); }
@Override @Test public final void incrementTick() { final XTime<PhaseImpl> incrementedTime = new AbstractXClockImpl(1, PhaseImpl.PHASE_2, PhaseImpl.values()).increment(); assertThat(incrementedTime.getTick(), is(2L)); assertThat(incrementedTime.getPhase(), is(PhaseImpl.PHASE_1)); }