1 4 package gnu.mapping; 5 6 8 9 public class SharedLocation extends NamedLocation 10 { 11 int timestamp; 12 13 public SharedLocation (Symbol symbol, Object property, int timestamp) 14 { 15 super(symbol, property); 16 this.timestamp = timestamp; 17 } 18 19 public synchronized final Object get (Object defaultValue) 20 { 21 return base != null ? base.get(defaultValue) 22 : value == Location.UNBOUND ? defaultValue : value; 23 } 24 25 public synchronized boolean isBound () 26 { 27 return base != null ? base.isBound() : value != Location.UNBOUND; 28 } 29 30 public synchronized final void set (Object newValue) 31 { 32 if (base == null) 33 value = newValue; 34 else if (value == DIRECT_ON_SET) 35 { 36 base = null; 37 value = newValue; 38 } 39 else if (base.isConstant()) 40 getEnvironment().put(getKeySymbol(), getKeyProperty(), newValue); 41 else 42 base.set(newValue); 43 } 44 45 } 46 | Popular Tags |