001package org.clafer.instance;
002
003import org.clafer.ast.AstClafer;
004import org.clafer.ast.AstIntClafer;
005import org.clafer.common.Check;
006
007/**
008 *
009 * @author jimmy
010 */
011public class InstanceRef {
012
013    private final AstClafer type;
014    private final int value;
015
016    public InstanceRef(AstClafer type, int value) {
017        this.type = Check.notNull(type);
018        this.value = value;
019    }
020
021    public AstClafer getType() {
022        return type;
023    }
024
025    public int getValue() {
026        return value;
027    }
028
029    @Override
030    public String toString() {
031        return type instanceof AstIntClafer
032                ? Integer.toString(value)
033                : type.getName() + "#" + Integer.toString(value);
034    }
035}