All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class key.ReferenceProperty

java.lang.Object
   |
   +----key.Property
           |
           +----key.ReferenceProperty

public class ReferenceProperty
extends Property
implements Referrer
When you set it (be it by loading the id or giving it an atom, this class will attempt to use *only* that reference for as long as possible. An actual reference to the object has a higher priority than an id.

This means:

There are, then, four states for this object:

Think about removing that last state in the name of storing as little as possible. Then we only have 3 states to worry about. You'd remove it by changing the resolve() method to clear the value. ;)


Variable Index

 o value

Constructor Index

 o ReferenceProperty(String, Type, Atom)
 o ReferenceProperty(String, Type, Atom, Object)

Method Index

 o checkType(Type)
 o clear()
Make it so we're not referencing anything anymore
 o delete(Atom)
 o get()
We may wish (in the future) to put in some code that can do a rescan, or, better, notice, when an atom moves, so that the resolved reference isn't wrong - or the value's don't get confused
 o getId()
 o loadFrom(DataInput)
You need to have the property class set up *before* calling this command
 o resolvable()
 o resolve(Atom)
This routine can be made more efficient by combining the getSymbol and isSymbolTransit routines - possibly by having another routine that returns a 'searchObject' or something, which can have flags on it based on how it was found.
 o set(Object)
Store the resolved reference
 o setId(String)
Just store the id of the atom
 o setId(String, Atom)
 o swapout(Atom)
 o writeTo(DataOutput)

Variables

 o value
 protected Object value

Constructors

 o ReferenceProperty
 public ReferenceProperty(String name,
                          Type type,
                          Atom parent)
 o ReferenceProperty
 public ReferenceProperty(String name,
                          Type type,
                          Atom parent,
                          Object theValue) throws TypeMismatchException

Methods

 o checkType
 protected void checkType(Type type)
Overrides:
checkType in class Property
 o get
 public Object get()
We may wish (in the future) to put in some code that can do a rescan, or, better, notice, when an atom moves, so that the resolved reference isn't wrong - or the value's don't get confused

 o resolvable
 public boolean resolvable()
 o resolve
 public Tag resolve(Atom relTo)
This routine can be made more efficient by combining the getSymbol and isSymbolTransit routines - possibly by having another routine that returns a 'searchObject' or something, which can have flags on it based on how it was found.

 o clear
 public void clear()
Make it so we're not referencing anything anymore

 o delete
 public void delete(Atom a)
 o set
 public void set(Object o) throws TypeMismatchException
Store the resolved reference

 o getId
 public String getId()
 o setId
 protected void setId(String id)
Just store the id of the atom

 o setId
 public void setId(String id,
                   Atom relTo)
 o writeTo
 public void writeTo(DataOutput to) throws IOException
Overrides:
writeTo in class Property
 o loadFrom
 public void loadFrom(DataInput from) throws IOException
You need to have the property class set up *before* calling this command

Overrides:
loadFrom in class Property
 o swapout
 public void swapout(Atom a)

All Packages  Class Hierarchy  This Package  Previous  Next  Index