1 4 package gnu.mapping; 5 6 public abstract class IndirectableLocation extends Location 7 { 8 9 protected static final Object DIRECT_ON_SET = new String ("(direct-on-set)"); 10 11 18 protected static final Object INDIRECT_FLUIDS = new String ("(indirect-fluids)"); 19 20 21 protected Location base; 22 23 30 protected Object value; 31 32 public Symbol getKeySymbol () 33 { 34 return base != null ? base.getKeySymbol() : null; 35 } 36 37 public Object getKeyProperty () 38 { 39 return base != null ? base.getKeyProperty() : null; 40 } 41 42 public boolean isConstant () 43 { 44 return base != null && base.isConstant(); 45 } 46 47 public Location getBase () 48 { 49 return base == null ? this : base.getBase(); 50 } 51 52 public Location getBaseForce () 53 { 54 if (base == null) 55 return new PlainLocation(getKeySymbol(), getKeyProperty(), value); 56 else 57 return base; 58 } 59 60 public void setBase (Location base) 61 { 62 this.base = base; 63 this.value = null; 64 } 65 66 67 public void setAlias (Location base) 68 { 69 this.base = base; 70 this.value = INDIRECT_FLUIDS; 71 } 72 73 public void undefine () 74 { 75 base = null; 76 value = UNBOUND; 77 } 78 79 public Environment getEnvironment () 80 { 81 return (base instanceof NamedLocation 82 ? ((NamedLocation) base).getEnvironment() 83 : null); 84 } 85 } 86 | Popular Tags |