00001 package edu.ksu.cis.bandera.bir;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 import ca.mcgill.sable.util.*;
00036 import edu.ksu.cis.bandera.util.DefaultValues;
00037
00038 public abstract class Type implements Definition {
00039
00040 String name;
00041 String typeId;
00042 int extent = 1;
00043
00044 public static Type booleanType = new Bool();
00045 public static Type defaultRangeType = new Range(DefaultValues.birMinIntRange,DefaultValues.birMaxIntRange);
00046 public static final Type intType = new Range();
00047 public static final Type WR_lockType = new Lock(true,true);
00048 public abstract void apply(TypeSwitch sw, Object o);
00049 public boolean compatibleWith(Type type) {
00050 return this.getClass() == type.getClass();
00051 }
00052 public boolean containsValue(Object value) { return false; }
00053 public Expr defaultVal() { return null; }
00054 public Object getDef() { return this.toString(); }
00055 public int getExtent() { return extent; }
00056 public String getName() { return name; }
00057 public String getTypeId() { return typeId; }
00058 public abstract boolean isKind(int kind);
00059 public boolean isSubtypeOf(Type type) { return false; }
00060 public void setName(String name) { this.name = name; }
00061 public void setTypeId(String typeId) { this.typeId = typeId; }
00062 public String typeName() {
00063 return (name == null) ? typeId : name;
00064 }
00065 public String typeSpec() {
00066 return (name == null) ? this.toString() : name;
00067 }
00068 }