1 package net.sf.openrocket.util;
3 public interface Monitorable {
6 * Return a modification ID unique to the current state of this object and contained objects.
7 * The general contract is that if a specific object has the same modification ID at two moments
8 * in time, then the state of the object has not changed in between. Additionally the
9 * modification ID value must be monotonically increasing. This value can be used as a monitor
10 * to whether an object has been changed between two points of time.
12 * Implementations may optionally fulfill the stronger requirement that any two objects of the same
13 * type that have the same modification ID will be equal, though for complex objects guaranteeing
14 * this may be impractical.
16 * Objects that contain only primitive types or immutable objects can implement this method by
17 * increasing a modification counter or retrieving a new unique ID every time a value is set.
19 * Objects that contain other objects with a mutable state may for example return the sum of the
20 * object's own modification ID, a modification ID counter (initially zero) and the modification ID
21 * of the contained objects. When a mutable object is set, the modification counter is increased by
22 * the modification ID of the current object in order to preserve monotonicity.
24 * If an object does not have any fields, this method can simply return zero.
26 * Cloned objects may or may not have the same modification ID as the original object.
28 * @return a modification ID value for this object.
29 * @see UniqueID#next()
31 public int getModID();