Algernon Software

org.algernon.aam.register
Class GeneralRegister

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

public class GeneralRegister
extends Object
implements Register

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


Field Summary
protected  Algernon f_algy
           
protected  Jatha f_lisp
           
protected  Processor f_processor
           
protected  String m_name
           
protected  Processor m_processor
           
protected  RegisterSet m_registerSet
           
protected  LispValue m_value
           
 
Constructor Summary
GeneralRegister(Processor processor, String name, RegisterSet registerSet)
          Creates a new general-purpose AAM register.
 
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 entry in the given register, where the topmost item is entry number zero.
 String getName()
          Returns the name of this Register.
 RegisterSet getRegisterSet()
          Returns the RegisterSet this Register belongs to.
 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 value onto the register.
 void setName(String newName)
          Sets the name of this Register.
 void setRegisterSet(RegisterSet set)
          Sets the RegisterSet this Register belongs to.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_processor

protected Processor m_processor

m_name

protected String m_name

m_registerSet

protected RegisterSet m_registerSet

m_value

protected LispValue m_value

f_algy

protected Algernon f_algy

f_processor

protected Processor f_processor

f_lisp

protected Jatha f_lisp
Constructor Detail

GeneralRegister

public GeneralRegister(Processor processor,
                       String name,
                       RegisterSet registerSet)
Creates a new general-purpose AAM register.

Method Detail

getName

public String getName()
Description copied from interface: Register
Returns the name of this Register.

Specified by:
getName in interface Register

setName

public void setName(String newName)
Description copied from interface: Register
Sets the name of this Register.

Specified by:
setName in interface Register

getRegisterSet

public RegisterSet getRegisterSet()
Description copied from interface: Register
Returns the RegisterSet this Register belongs to.

Specified by:
getRegisterSet in interface Register

setRegisterSet

public void setRegisterSet(RegisterSet set)
Description copied from interface: Register
Sets the RegisterSet this Register belongs to.

Specified by:
setRegisterSet in interface Register

getValue

public LispValue getValue()
Return the value of the given register.

Specified by:
getValue in interface Register

setValue

public LispValue setValue(LispValue newValue)
                   throws AlgernonDataException
Sets the value of the given register. Returns the value.

Specified by:
setValue in interface Register
Throws:
AlgernonDataException

getEntry

public LispValue getEntry(int index)
Return the nth entry in the given 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.

Specified by:
getEntry in interface Register

pop

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

Specified by:
pop in interface Register

push

public LispValue push(LispValue newValue)
Pushes the given value onto the register. Returns the new value of the register.

Specified by:
push in interface Register

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

size

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

Specified by:
size in interface Register

clear

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

Specified by:
clear in interface Register

toString

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


Algernon Software