PrimitiveValueType.java

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

import edu.udel.cis.vsl.tass.dynamic.IF.type.PrimitiveValueTypeIF;
import edu.udel.cis.vsl.tass.model.IF.type.TypeIF;
import edu.udel.cis.vsl.tass.symbolic.IF.SymbolicUniverseIF;

public class PrimitiveValueType extends ValueType implements
		PrimitiveValueTypeIF {

	private TypeIF type;

	/**
	 * Instantiates new instance of PrimitiveValueType: it is complete, and it
	 * is committed automatically, since nothing in state can change.
	 */
	public PrimitiveValueType(int instanceId, SymbolicUniverseIF universe,
			TypeIF type) {
		super(instanceId, true, new ValueType[0]);
		assert type != null;
		this.type = type;
		commit();
	}

	public TypeIF type() {
		return type;
	}

	@Override
	boolean isIsomorphicTo(ValueType that) {
		return that instanceof PrimitiveValueType
				&& type.equals(((PrimitiveValueType) that).type);
	}

	@Override
	protected int isomorphismHashCode() {
		return classHashCode + type.hashCode();
	}

	@Override
	String stringRecursive() {
		return type.toString();
	}

	boolean computeContainsReferences() {
		return false;
	}
}