edu.mit.csail.sdg.alloy4compiler.ast
Class Type.ProductType

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4compiler.ast.Type.ProductType
Enclosing class:
Type

public static final class Type.ProductType
extends java.lang.Object

Immutable; represents a list of PrimSig objects.

Invariant: "one of the sig in the list is NONE" iff "every sig in the list is NONE".

Note: the return value of every method is always valid for all time; for example, given ProductType A and B, and you call C=A.intersect(B), then the result C will always be the intersection of A and B even if the caller later constructs more sigs or subsigs or subsetsigs...


Method Summary
 int arity()
          Returns the arity of this ProductType object.
 boolean equals(java.lang.Object that)
          Returns true if this.arity==that.arity and this.types[i]==that.types[i] for each i
 Sig.PrimSig get(int i)
          Returns a specific PrimSig in this ProductType
 int hashCode()
          Returns a hash code consistent with equals()
 boolean isEmpty()
          Returns true if this.arity==0 or this==NONE->..->NONE
 java.lang.String toString()
          Returns the String representation of this ProductType object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Returns a hash code consistent with equals()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object that)
Returns true if this.arity==that.arity and this.types[i]==that.types[i] for each i

Overrides:
equals in class java.lang.Object

arity

public int arity()
Returns the arity of this ProductType object.


get

public Sig.PrimSig get(int i)
Returns a specific PrimSig in this ProductType

Throws:
java.lang.ArrayIndexOutOfBoundsException - if (i < 0) or (i >= arity)

isEmpty

public boolean isEmpty()
Returns true if this.arity==0 or this==NONE->..->NONE


toString

public java.lang.String toString()
Returns the String representation of this ProductType object.

Overrides:
toString in class java.lang.Object