IntegerType.java

package edu.udel.cis.vsl.tass.model.impl.type;

import java.util.Set;

import edu.udel.cis.vsl.tass.model.IF.type.TypeIF;

public class IntegerType extends Type {

	public IntegerType() {
		super(TypeKind.INTEGER);
	}

	public String toString() {
		return "int";
	}

	public boolean equals(Object that) {
		if (that instanceof IntegerType) {
			return true;
		} else {
			return false;
		}
	}

	public int hashCode() {
		return kind().hashCode();
	}

	public boolean isNumeric() {
		return true;
	}

	public boolean isSubtypeOf(TypeIF type) {
		TypeKind kind = type.kind();

		return kind == TypeKind.RATIONAL || kind == TypeKind.INTEGER;
	}

	@Override
	public String longName(Set<Type> stack) {
		return shortName();
	}

	public String shortName() {
		return "int";
	}
}