avrora.core
Interface Operand

All Known Subinterfaces:
Operand.Constant, Operand.Register
All Known Implementing Classes:
SyntacticOperand, SyntacticOperand.Expr, SyntacticOperand.Register

public interface Operand

The Operand class encapsulates the notion of an operand to an instruction. An operand can be either a register or a constant integer. Whether the register is a source or destination register depends on the particular instruction. Likewise, whether the integer represents an immediate, an offset, or an address depends on the instruction.

Operands are used as the arguments to the constructors of instructions.

See Also:
InstrPrototype

Nested Class Summary
static interface Operand.Constant
          The Operand.Constant class encapsulates the notion of a constant operand to an instruction.
static interface Operand.Register
          The Operand.Register class encapsulates the notion of a register operand to an instruction.
 
Method Summary
 Operand.Constant asConstant()
          The asConstant() method uses virtual dispatch to avoid a cast.
 Operand.Register asRegister()
          The asRegister() method uses virtual dispatch to avoid a cast.
 

Method Detail

asRegister

public Operand.Register asRegister()
The asRegister() method uses virtual dispatch to avoid a cast. If this operand is an instance of Operand.Register it will return itself. Otherwise, it will return null.

Returns:
this if this is an instance of Operand.Register; null otherwise

asConstant

public Operand.Constant asConstant()
The asConstant() method uses virtual dispatch to avoid a cast. If this operand is an instance of Operand.Constant it will return itself. Otherwise, it will return null.

Returns:
this if this is an instance of Operand.Constant; null otherwise