Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class Quad  view Quad download Quad.java

java.lang.Object
  extended byCompil3r.Quad.Quad

public class Quad
extends java.lang.Object

Version:
$Id: Quad.java,v 1.21 2003/08/03 12:32:50 joewhaley Exp $

Field Summary
static boolean DETERMINISTIC
           
private  int id_number
          Id number for this quad.
private  Operand operand1
          The four operands.
private  Operand operand2
          The four operands.
private  Operand operand3
          The four operands.
private  Operand operand4
          The four operands.
private  Operator operator
          The operator.
 
Constructor Summary
(package private) Quad(int id, Operator operator)
          Creates new Quad
(package private) Quad(int id, Operator operator, Operand operand1)
           
(package private) Quad(int id, Operator operator, Operand operand1, Operand operand2)
           
(package private) Quad(int id, Operator operator, Operand operand1, Operand operand2, Operand operand3)
           
(package private) Quad(int id, Operator operator, Operand operand1, Operand operand2, Operand operand3, Operand operand4)
           
 
Method Summary
 void accept(QuadVisitor qv)
          Accepts a quad visitor to this quad.
 Quad copy(int id_number)
           
 Util.Templates.List.RegisterOperand getDefinedRegisters()
          Returns a list of the registers defined by this quad.
 int getID()
          Returns the id number of this quad.
(package private)  Operand getOp1()
          These are not intended to be used outside of the Compil3r.Quad package.
(package private)  Operand getOp2()
           
(package private)  Operand getOp3()
           
(package private)  Operand getOp4()
           
 Operator getOperator()
          Return the operator for this quad.
 Util.Templates.List.jq_Class getThrownExceptions()
          Returns a list of the types of exceptions that this quad can throw.
 Util.Templates.List.RegisterOperand getUsedRegisters()
          Returns a list of the registers used by this quad.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 void interpret(Interpreter.QuadInterpreter s)
          Interprets this quad, modifying the given interpreter state.
 void setOp1(Operand op)
           
 void setOp2(Operand op)
           
 void setOp3(Operand op)
           
 void setOp4(Operand op)
           
 java.lang.String toString_short()
          Returns a short string representation of this quad, without any operands.
 java.lang.String toString()
          Returns a string representation of this quad.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

operator

private Operator operator
The operator. Operator objects are shared across all quads.


operand1

private Operand operand1
The four operands. Operands are quad-specific.


operand2

private Operand operand2
The four operands. Operands are quad-specific.


operand3

private Operand operand3
The four operands. Operands are quad-specific.


operand4

private Operand operand4
The four operands. Operands are quad-specific.


id_number

private int id_number
Id number for this quad. THIS NUMBER HOLDS NO MEANING WHATSOEVER. It is just used for printing.


DETERMINISTIC

public static final boolean DETERMINISTIC
See Also:
Constant Field Values
Constructor Detail

Quad

Quad(int id,
     Operator operator)
Creates new Quad


Quad

Quad(int id,
     Operator operator,
     Operand operand1)

Quad

Quad(int id,
     Operator operator,
     Operand operand1,
     Operand operand2)

Quad

Quad(int id,
     Operator operator,
     Operand operand1,
     Operand operand2,
     Operand operand3)

Quad

Quad(int id,
     Operator operator,
     Operand operand1,
     Operand operand2,
     Operand operand3,
     Operand operand4)
Method Detail

getOp1

Operand getOp1()
These are not intended to be used outside of the Compil3r.Quad package. Instead, use the static accessor methods for each operator, e.g. Move.getDest(quad).


getOp2

Operand getOp2()

getOp3

Operand getOp3()

getOp4

Operand getOp4()

setOp1

public void setOp1(Operand op)

setOp2

public void setOp2(Operand op)

setOp3

public void setOp3(Operand op)

setOp4

public void setOp4(Operand op)

copy

public Quad copy(int id_number)

getOperator

public Operator getOperator()
Return the operator for this quad.


accept

public void accept(QuadVisitor qv)
Accepts a quad visitor to this quad. For the visitor pattern.


getID

public int getID()
Returns the id number of this quad. THIS NUMBER HOLDS NO MEANING WHATSOEVER. It is just used for printing.


getThrownExceptions

public Util.Templates.List.jq_Class getThrownExceptions()
Returns a list of the types of exceptions that this quad can throw. Note that types in this list are not exact, therefore subtypes of the returned types may also be thrown.


getDefinedRegisters

public Util.Templates.List.RegisterOperand getDefinedRegisters()
Returns a list of the registers defined by this quad.


getUsedRegisters

public Util.Templates.List.RegisterOperand getUsedRegisters()
Returns a list of the registers used by this quad.


interpret

public void interpret(Interpreter.QuadInterpreter s)
Interprets this quad, modifying the given interpreter state.


toString

public java.lang.String toString()
Returns a string representation of this quad.


toString_short

public java.lang.String toString_short()
Returns a short string representation of this quad, without any operands.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)