/** * Retrieve the unit's value * * @param unit The identifier of the vector element being retrieved * @return Returns the value of the unit (if existent), or <tt>null</tt> if it does not exist */ public Long getClock(String unit) { return get(unit); }
if (clock1.get(lEntry) < clock2.get(lEntry)) { isEqual = false; isGreater = false; if (clock1.get(lEntry) > clock2.get(lEntry)) { isEqual = false; isSmaller = false; else if (clock1.get(lEntry) != 0) { isEqual = false; isSmaller = false; if (!clock1.containsKey(lEntry) && (clock2.get(lEntry) != 0)) { isEqual = false; isGreater = false;
/** * Increases the component of a unit by 1. * * @param unit The identifier of the vector element being increased * @return Returns the new clock value for the given unit */ public Long incrementClock(String unit) { validateUnitName(unit); Long newValue = (containsKey(unit)) ? get(unit).longValue() + 1 : 1L; put(unit, newValue); return newValue; }