Algernon Software

org.algernon.aam.register
Class BindingsRegister

java.lang.Object
  extended byorg.algernon.aam.register.GeneralRegister
      extended byorg.algernon.aam.register.BindingsRegister
All Implemented Interfaces:
Register

public class BindingsRegister
extends GeneralRegister
implements Register

This class represents a register that holds BindingSets in the AAM. Results are contained in binding sets, and the mergeBindingSets operation will merge two sets into one. The final result of an operation stream is always a BindingSet. The contents of this register is always a list of BindingSets. The list may be empty.


Field Summary
protected  LispValue m_bindingSets
           
 
Fields inherited from class org.algernon.aam.register.GeneralRegister
f_algy, f_lisp, f_processor, m_name, m_processor, m_registerSet, m_value
 
Constructor Summary
BindingsRegister(Processor processor, String name, RegisterSet registerSet)
          Creates a new AAM register that holds a binding set.
 
Method Summary
 LispValue append(LispValue newValue)
          Appends the given value onto the end of the register.
 void clear()
          Initializes the register contents to NIL.
 LispValue getEntry(int index)
          Return the nth BindingSet in this register, where the topmost item is entry number zero.
 LispValue getValue()
          Return the value of the given register.
 LispValue pop()
          Pops the register and returns the popped entry.
 LispValue push(LispValue newValue)
          Pushes the given BindingSet onto the register.
 LispValue setValue(LispValue newValue)
          Sets the value of the given register.
 long size()
          Returns the number of values in this register.
 String toString()
          Displays the register name and its contents.
 
Methods inherited from class org.algernon.aam.register.GeneralRegister
getName, getRegisterSet, setName, setRegisterSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.algernon.aam.register.Register
getName, getRegisterSet, setName, setRegisterSet
 

Field Detail

m_bindingSets

protected LispValue m_bindingSets
Constructor Detail

BindingsRegister

public BindingsRegister(Processor processor,
                        String name,
                        RegisterSet registerSet)
Creates a new AAM register that holds a binding set. A BindingSet contains BindingLists. Default value is an empty BindingSet.

See Also:
BindingSet, BindingList
Method Detail

getValue

public LispValue getValue()
Return the value of the given register. This is a list of Binding Sets.

Specified by:
getValue in interface Register
Overrides:
getValue in class GeneralRegister
See Also:
BindingSet

setValue

public LispValue setValue(LispValue newValue)
                   throws AlgernonDataException
Sets the value of the given register. The value must be a BindingSet or a list of binding sets. Returns the value.

Specified by:
setValue in interface Register
Overrides:
setValue in class GeneralRegister
Throws:
AlgernonDataException

getEntry

public LispValue getEntry(int index)
Return the nth BindingSet in this register, where the topmost item is entry number zero. If the index given is greater than the number of items in the register, NIL is returned. This value can usually be coerced to BindingList.

Specified by:
getEntry in interface Register
Overrides:
getEntry in class GeneralRegister

pop

public LispValue pop()
Pops the register and returns the popped entry. The value can be coerced to BindingSet unless it is NIL.

Specified by:
pop in interface Register
Overrides:
pop in class GeneralRegister

push

public LispValue push(LispValue newValue)
Pushes the given BindingSet onto the register. If the value is a BindingList, it is pushed into the topmost BindingSet. Returns the new value of the register.

Specified by:
push in interface Register
Overrides:
push in class GeneralRegister

append

public LispValue append(LispValue newValue)
Appends the given value onto the end of the register. Returns the new value of the register.

Specified by:
append in interface Register
Overrides:
append in class GeneralRegister

size

public long size()
Returns the number of values in this register.

Specified by:
size in interface Register
Overrides:
size in class GeneralRegister

clear

public void clear()
Initializes the register contents to NIL.

Specified by:
clear in interface Register
Overrides:
clear in class GeneralRegister

toString

public String toString()
Displays the register name and its contents.

Overrides:
toString in class GeneralRegister

Algernon Software