Package gnu.mapping
Class PropertyLocation
- java.lang.Object
-
- gnu.mapping.Location<java.lang.Object>
-
- gnu.mapping.PropertyLocation
-
public class PropertyLocation extends Location<java.lang.Object>
Used to implement Lisp-style "property lists". APropertyLocationis a location whose value is thecarof a property list. This class also contains a number of static methods useful for working with property lists.
-
-
Constructor Summary
Constructors Constructor Description PropertyLocation()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget()Get the current value of this location.static java.lang.ObjectgetProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object defaultValue)Gets a property value associated with an object.static java.lang.ObjectgetProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object defaultValue, Environment env)Gets a property value associated with an object.static java.lang.ObjectgetPropertyList(java.lang.Object symbol)Get the property list associated with object in the current Environment.static java.lang.ObjectgetPropertyList(java.lang.Object symbol, Environment env)Get the property list assocated with an object in a given Environment.booleanisBound()static java.lang.ObjectplistGet(java.lang.Object plist, java.lang.Object prop, java.lang.Object dfault)Given a property list and a key, find the corresponding property value.static java.lang.ObjectplistPut(java.lang.Object plist, java.lang.Object prop, java.lang.Object value)Modify and add a property binding to a property list.static java.lang.ObjectplistRemove(java.lang.Object plist, java.lang.Object prop)Remove a property binding from a property list.static voidputProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object newValue)Sets a property value associated with an object.static voidputProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object newValue, Environment env)static booleanremoveProperty(java.lang.Object symbol, java.lang.Object property)Remove a property associated with an object.static booleanremoveProperty(java.lang.Object symbol, java.lang.Object property, Environment env)Remove a properaty assocatied with an object.voidset(java.lang.Object newValue)static voidsetPropertyList(java.lang.Object symbol, java.lang.Object plist)Set the property list assocated with an object in a given Environment.static voidsetPropertyList(java.lang.Object symbol, java.lang.Object plist, Environment env)Set the property list assocated with an object in a given Environment.-
Methods inherited from class gnu.mapping.Location
define, entered, get, getBase, getKeyProperty, getKeySymbol, getValue, isConstant, make, make, make, print, setRestore, setValue, setWithSave, toString, undefine
-
-
-
-
Method Detail
-
get
public final java.lang.Object get()
Description copied from class:LocationGet the current value of this location.
-
set
public final void set(java.lang.Object newValue)
-
getPropertyList
public static java.lang.Object getPropertyList(java.lang.Object symbol, Environment env)Get the property list assocated with an object in a given Environment.- Parameters:
symbol- Usually but not necessarily a Symbol. (A String is not converted a Symbol by this method.)
-
getPropertyList
public static java.lang.Object getPropertyList(java.lang.Object symbol)
Get the property list associated with object in the current Environment. Corresponds to Common Lisp'ssymbol-plistfunction.- Parameters:
symbol- Usually but not necessarily a Symbol. (A String is not converted a Symbol by this method.)
-
setPropertyList
public static void setPropertyList(java.lang.Object symbol, java.lang.Object plist, Environment env)Set the property list assocated with an object in a given Environment. This function should be avoided, since a Symbol's property list may be used by unknown classes. It also can be slow.- Parameters:
symbol- Usually but not necessarily a Symbol. (A String is not converted a Symbol by this method.)
-
setPropertyList
public static void setPropertyList(java.lang.Object symbol, java.lang.Object plist)Set the property list assocated with an object in a given Environment. Corresponds to Common Lisp's(setf symbol-plist)function.
-
getProperty
public static java.lang.Object getProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object defaultValue, Environment env)Gets a property value associated with an object.- Parameters:
symbol- Usually aSymbol, but can be anyObject. AStringis converted to aSymbolusingenv.getSymbol(). Symbols require a constant-type hash lookup; other object are searched linearly.
-
getProperty
public static java.lang.Object getProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object defaultValue)Gets a property value associated with an object. Corresponds to Common Lisp'sgetfunction.
-
putProperty
public static void putProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object newValue, Environment env)
-
putProperty
public static void putProperty(java.lang.Object symbol, java.lang.Object property, java.lang.Object newValue)Sets a property value associated with an object. Corresponds to Common Lisp's(setf get)function.
-
removeProperty
public static boolean removeProperty(java.lang.Object symbol, java.lang.Object property, Environment env)Remove a properaty assocatied with an object.
-
removeProperty
public static boolean removeProperty(java.lang.Object symbol, java.lang.Object property)Remove a property associated with an object. Corresponds to Common Lisp'srempropfunction.
-
plistGet
public static java.lang.Object plistGet(java.lang.Object plist, java.lang.Object prop, java.lang.Object dfault)Given a property list and a key, find the corresponding property value.
-
plistPut
public static java.lang.Object plistPut(java.lang.Object plist, java.lang.Object prop, java.lang.Object value)Modify and add a property binding to a property list.- Returns:
- The updated property list.
-
plistRemove
public static java.lang.Object plistRemove(java.lang.Object plist, java.lang.Object prop)Remove a property binding from a property list.- Returns:
- The updated property list.
-
-