frysk.isa.registers
Class RegisterMap

java.lang.Object
  extended by frysk.isa.registers.RegisterMap

public class RegisterMap
extends Object

Provides a map between an internal and external register format.


Field Summary
private  Map integerToRegister
           
private  Map numberToRegister
           
private  Map registerToNumber
           
private  String what
           
 
Constructor Summary
RegisterMap(String what)
          Create a register-to-number map.
 
Method Summary
 RegisterMap add(Register register, Number number)
          Add the REGISTER-NUMBER mapping.
 boolean containsKey(int regNum)
          Return true if REG_NUM (as a Number) is known.
 boolean containsKey(Number number)
          Return true if NUMBER is known.
 boolean containsKey(Register register)
          Return true if REGISTER is known.
 Register getRegister(int regNum)
          Find the REGISTER corresponding to REG_NUM (as a Number).
 Register getRegister(Number number)
          Find the REGISTER corresponding to NUMBER.
 Number getRegisterNumber(Register register)
          Find the NUMBER corresponding to REGISTER.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

integerToRegister

private final Map integerToRegister

registerToNumber

private final Map registerToNumber

numberToRegister

private final Map numberToRegister

what

private final String what
Constructor Detail

RegisterMap

public RegisterMap(String what)
Create a register-to-number map. WHAT defines what the map is about and is used when throwing exceptions.

Method Detail

add

public final RegisterMap add(Register register,
                             Number number)
Add the REGISTER-NUMBER mapping.


getRegisterNumber

public Number getRegisterNumber(Register register)
Find the NUMBER corresponding to REGISTER. Use containsKey(Register) to verify that the mapping is present.


getRegister

public Register getRegister(int regNum)
Find the REGISTER corresponding to REG_NUM (as a Number). Use containsKey(int) to verify that the mapping is present.


getRegister

public Register getRegister(Number number)
Find the REGISTER corresponding to NUMBER. Use containsKey(Number) to verify that the mapping is present.


containsKey

public boolean containsKey(Register register)
Return true if REGISTER is known.


containsKey

public boolean containsKey(Number number)
Return true if NUMBER is known.


containsKey

public boolean containsKey(int regNum)
Return true if REG_NUM (as a Number) is known.