Semant
Class Type.INSTANCE

java.lang.Object
  extended by Semant.Type
      extended by Semant.Type.INSTANCE
Enclosing class:
Type

public static class Type.INSTANCE
extends Type

A class instance is an instance of some class, encapsulating instance fields and instance methods.


Nested Class Summary
 
Nested classes/interfaces inherited from class Semant.Type
Type.ARRAY, Type.CLASS, Type.FUN, Type.INSTANCE, Type.Print, Type.RECORD<T extends Type>, Type.Visitor
 
Field Summary
 Type.RECORD<Type> fields
          The instance fields.
 Type.CLASS instanceOf
           
 Type.RECORD<Type.FUN> methods
          The instance methods.
 
Fields inherited from class Semant.Type
BOOLEAN, INT, NIL, STRING, SYSTEM, VOID
 
Constructor Summary
Type.INSTANCE(Type.CLASS c)
          An instance of some class.
 
Method Summary
 void accept(Type.Visitor v)
          A type must accept a visitor
 boolean coerceTo(Type t)
          Instances coerce if they are instances of equal or parent classes.
 boolean equals(Type t)
          Instances are equal if they are instances of equal classes.
 Type field(java.lang.String n)
          Implementation of field for instances.
 Type.FUN method(java.lang.String n)
          Implementation of method for instances.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instanceOf

public final Type.CLASS instanceOf

fields

public final Type.RECORD<Type> fields
The instance fields.


methods

public final Type.RECORD<Type.FUN> methods
The instance methods.

Constructor Detail

Type.INSTANCE

public Type.INSTANCE(Type.CLASS c)
An instance of some class.

Parameters:
c - the class
Method Detail

field

public Type field(java.lang.String n)
Implementation of field for instances. Instances can access both local and inherited instance fields.

Overrides:
field in class Type
Parameters:
n - name of the field
Returns:
type of the field

method

public Type.FUN method(java.lang.String n)
Implementation of method for instances. Instances can invoke both local and inherited methods.

Overrides:
method in class Type
Parameters:
n - name of the method
Returns:
type of the method

equals

public boolean equals(Type t)
Instances are equal if they are instances of equal classes.

Specified by:
equals in class Type
Parameters:
t - target type
Returns:
true if types are equivalent, false otherwise

coerceTo

public boolean coerceTo(Type t)
Instances coerce if they are instances of equal or parent classes.

Specified by:
coerceTo in class Type
Parameters:
t - target type
Returns:
true if this coerces to t, false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

accept

public void accept(Type.Visitor v)
Description copied from class: Type
A type must accept a visitor

Specified by:
accept in class Type
Parameters:
v - the visitor