Algernon Software

org.algernon.aam.register
Class RegisterSet

java.lang.Object
  extended byorg.algernon.aam.register.RegisterSet

public class RegisterSet
extends Object

This class represents a RegisterSet in the AAM. It contains the registers, memory and code.


Field Summary
 LispString ACTIONS
          Stack or queue of paths to be followed.
 LispString ACTIVATE_BC
          Activation clause for forward chaining rules.
 LispString ACTIVATE_FC
          Activation clause for backard chaining rules.
 LispString BINDINGS
          Stack of binding lists.
 LispString CLAUSE
          The clause currently being executed.
 LispString CODE
          Code register (like a Program Counter).
 LispString CONTEXT
          Stack of execution contexts.
private  Jatha f_lisp
           
protected  Processor f_processor
           
 LispString ID
          The ID of the activation being processed.
 LispString INDEX
          Number of the clause being processed.
 LispString KEY
          Key clause of backward chaining rules.
protected  HashMap m_registerMap
           
 Register R_ACTIONS
          Stack or queue of paths to be followed.
 Register R_ACTIVATE_BC
          Activation clause for forward chaining rules.
 Register R_ACTIVATE_FC
          Activation clause for backard chaining rules.
 Register R_BINDINGS
          Stack of binding lists.
 Register R_CLAUSE
          The clause currently being executed.
 Register R_CODE
          Code register (like a Program Counter).
 Register R_CONTEXT
          Stack of execution contexts.
 Register R_ID
          The ID of the activation being processed.
 Register R_INDEX
          Number of the clause being processed.
 Register R_KEY
          Key clause of backward chaining rules.
 Register R_RESULTS
          Binding lists stored for return to user.
 Register R_RULE
          The rule being processed.
 LispString RESULTS
          Binding lists stored for return to user.
 LispString RULE
          The rule being processed.
 
Constructor Summary
RegisterSet(Processor processor)
          Create a new AAM RegisterSet.
 
Method Summary
 LispValue appendRegisterValue(LispValue registerName, LispValue newValue)
          Appends the given value onto the end of the register.
 Register getRegister(LispValue name)
          Returns the Register with the given name.
 LispValue getRegisterEntry(LispValue registerName, int index)
          Return the nth entry in the given register, where the topmost item is entry number zero.
 long getRegisterSize(LispValue registerName)
          Return the size of (number of entries in) the given register.
 LispValue getRegisterValue(LispValue registerName)
          Return the value of the given register.
 void initializeRegisters()
          Initializes the register contents to NIL.
 LispValue popRegisterValue(LispValue registerName)
          Pops the register and returns the popped entry.
 LispValue pushRegisterValue(LispValue registerName, LispValue newValue)
          Pushes the given value onto the register.
 LispValue setRegisterValue(LispValue registerName, LispValue newValue)
          Sets the value of the given register.
 void showRegisters()
          Displays all of the registers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f_lisp

private Jatha f_lisp

ACTIONS

public LispString ACTIONS
Stack or queue of paths to be followed.


ACTIVATE_BC

public LispString ACTIVATE_BC
Activation clause for forward chaining rules.


ACTIVATE_FC

public LispString ACTIVATE_FC
Activation clause for backard chaining rules.


BINDINGS

public LispString BINDINGS
Stack of binding lists.


CLAUSE

public LispString CLAUSE
The clause currently being executed.


CODE

public LispString CODE
Code register (like a Program Counter). Contains a list of the upcoming opcodes and their arguments.


CONTEXT

public LispString CONTEXT
Stack of execution contexts.


ID

public LispString ID
The ID of the activation being processed.


INDEX

public LispString INDEX
Number of the clause being processed.


KEY

public LispString KEY
Key clause of backward chaining rules.


RESULTS

public LispString RESULTS
Binding lists stored for return to user.


RULE

public LispString RULE
The rule being processed.


R_ACTIONS

public Register R_ACTIONS
Stack or queue of paths to be followed.


R_ACTIVATE_BC

public Register R_ACTIVATE_BC
Activation clause for forward chaining rules.


R_ACTIVATE_FC

public Register R_ACTIVATE_FC
Activation clause for backard chaining rules.


R_BINDINGS

public Register R_BINDINGS
Stack of binding lists.


R_CLAUSE

public Register R_CLAUSE
The clause currently being executed.


R_CODE

public Register R_CODE
Code register (like a Program Counter). Contains a list of the upcoming opcodes and their arguments.


R_CONTEXT

public Register R_CONTEXT
Stack of execution contexts.


R_ID

public Register R_ID
The ID of the activation being processed.


R_INDEX

public Register R_INDEX
Number of the clause being processed.


R_KEY

public Register R_KEY
Key clause of backward chaining rules.


R_RESULTS

public Register R_RESULTS
Binding lists stored for return to user.


R_RULE

public Register R_RULE
The rule being processed.


m_registerMap

protected HashMap m_registerMap

f_processor

protected Processor f_processor
Constructor Detail

RegisterSet

public RegisterSet(Processor processor)
Create a new AAM RegisterSet.

Method Detail

getRegister

public Register getRegister(LispValue name)
Returns the Register with the given name. Returns null if none exists with that name.


getRegisterValue

public LispValue getRegisterValue(LispValue registerName)
Return the value of the given register.


setRegisterValue

public LispValue setRegisterValue(LispValue registerName,
                                  LispValue newValue)
                           throws AlgernonDataException
Sets the value of the given register. Returns the value.

Throws:
AlgernonDataException

getRegisterEntry

public LispValue getRegisterEntry(LispValue registerName,
                                  int index)
Return the nth entry in the given register, where the topmost item is entry number zero.


popRegisterValue

public LispValue popRegisterValue(LispValue registerName)
Pops the register and returns the popped entry.


pushRegisterValue

public LispValue pushRegisterValue(LispValue registerName,
                                   LispValue newValue)
Pushes the given value onto the register. Returns the new value of the register.


appendRegisterValue

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


getRegisterSize

public long getRegisterSize(LispValue registerName)
Return the size of (number of entries in) the given register.


initializeRegisters

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


showRegisters

public void showRegisters()
Displays all of the registers.


Algernon Software