package edu.ucsb.cs.jicos.services.shared; import edu.ucsb.cs.jicos.services.*; /** * IntUpperBound.java IMMUTABLE * @author Peter Cappello * @version 1 */ public class IntUpperBound implements Shared { private Integer shared; /** Construct an IntUpperBound from the int argument. * @param shared The int value to be shared. */ public IntUpperBound( int shared ) { this.shared = new Integer( shared ); } /** Returns a reference to the shared Integer Object. * @return a reference to the shared Integer Object. */ public synchronized Object get() { return shared; } /** This method operationally defines the semantics of newer. * @return true if & only if this is newer than the argument Shared Object. * @param shared The Shared Object whose value is proposed as OLDER. */ public synchronized boolean isNewerThan( Shared shared ) { // pre-condition assert shared != null; return this.shared.intValue() < ( (Integer) shared.get() ).intValue(); } }