/** * @return <code>true</code> if this Clock occurred after the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean after(Clock c) { return compareTo(c) == Occurred.AFTER; }
@Override public byte[] serialize(Clock clock) throws SerializationException { return clock == null ? null : clock.toByteArray(); } }
@Override public synchronized void saveHWMark(long hwMark) { if(hwMark > _hwmScn) { _hwmScn = hwMark; _waterMarksClock.setHWMark(_source, _hwmScn); } }
public boolean equals(Clock another_clock) { // Check if 'this' is equal to 'another_clock' // 1. If you're checking if the pointer is the same return another_clock.equals(this); // 2. If you're checking if time is the same (You probably need to create getter/setter methods or change privacy for these fields) return another_clock.hours == this.hours && another_clock.minutes == this.minutes && another_clock.seconds == this.seconds; }
@Override public Clock deserialize(byte[] bytes) throws SerializationException { return Clock.parseClock(bytes); }
@Override public int hashCode() { int hash = 5; hash = 97 * hash + _id; hash = 97 * hash + (int)_offset; hash = 97 * hash + _index; hash = 97 * hash + _clock.hashCode(); return hash; }
@Override public long getLWMark() { return _waterMarksClock.getLWMScn(_source); }
/** * @return <code>true</code> if this Clock is equal to or occurred after the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean afterEqual(Clock c) { Occurred o = compareTo(c); return o == Occurred.AFTER || o == Occurred.EQUICONCURRENTLY; }
@Override public byte[] serialize(Clock clock) throws SerializationException { return clock == null ? null : clock.toByteArray(); } }
public boolean equals (Clock c) { boolean equiv = c.equals(c); // this keeps calling itself return equiv; }
@Override public Clock deserialize(byte[] bytes) throws SerializationException { return Clock.parseClock(bytes); }
@Override public synchronized void saveHWMark(long hwMark) { if(hwMark > _hwmScn) { _hwmScn = hwMark; _waterMarksClock.setHWMark(_source, _hwmScn); } }
@Override public int hashCode() { int hash = 5; hash = 97 * hash + _id; hash = 97 * hash + (int)_offset; hash = 97 * hash + _index; hash = 97 * hash + _clock.hashCode(); return hash; }
@Override public long getLWMark() { return _waterMarksClock.getLWMScn(_source); }
/** * @return <code>true</code> if this Clock occurred before the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean before(Clock c) { return compareTo(c) == Occurred.BEFORE; }
/** * @return <code>true</code> if this Clock is equal to or occurred before the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean beforeEqual(Clock c) { Occurred o = compareTo(c); return o == Occurred.BEFORE || o == Occurred.EQUICONCURRENTLY; }
/** * @return <code>true</code> if this Clock occurred before the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean before(Clock c) { return compareTo(c) == Occurred.BEFORE; }
/** * @return <code>true</code> if this Clock occurred after the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean after(Clock c) { return compareTo(c) == Occurred.AFTER; }
/** * @return <code>true</code> if this Clock is equal to or occurred before the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean beforeEqual(Clock c) { Occurred o = compareTo(c); return o == Occurred.BEFORE || o == Occurred.EQUICONCURRENTLY; }
/** * @return <code>true</code> if this Clock is equal to or occurred after the specified Clock <code>c</code>. * Otherwise, <code>false</code>. */ public boolean afterEqual(Clock c) { Occurred o = compareTo(c); return o == Occurred.AFTER || o == Occurred.EQUICONCURRENTLY; }