|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Type
public class Type
Represents a type in a BLOG model. Stores a set of potential object patterns (POPs), a set of origin functions, and a set of explicitly enumerated guaranteed objects.
We ensure that there is only one Type object for each type, so Type objects can be compared with ==.
Constructor Summary | |
---|---|
Type(java.lang.String name)
Creates a new type with the given name that is not a sub-type of any other type. |
|
Type(java.lang.String name,
Type supertype)
Creates a type with the given name that is a direct sub-type of supertype . |
|
Type(java.lang.String name,
Type supertype,
boolean infinite)
Creates a type with the given name that is a direct sub-type of supertype . |
Method Summary | |
---|---|
EnumeratedObject |
addGuaranteedObject(NonRandomFunction constant)
Adds a new guaranteed object with the given canonical constant symbol. |
void |
addOriginFunction(OriginFunction f)
Adds the given function as a origin function for this type. |
void |
addPOP(POP pop)
Adds the given POP to the set of POPs for this type. |
Term |
getCanonicalTerm(java.lang.Object o)
Returns the canonical term for the given object, or null if the object has no canonical term. |
int |
getCreationIndex()
Returns an index indicating when this type was declared (or otherwise created). |
java.lang.Object |
getDefaultValue()
Returns the default value for functions with this return type. |
java.lang.Object |
getGuaranteedObject(int index)
Returns the guaranteed object of this type that has the given index, or null if no such object exists. |
java.util.List |
getGuaranteedObjects()
Returns the list of explicitly enumerated guaranteed objects of this type, in the order they were introduced in the model file. |
int |
getGuaranteedObjIndex(java.lang.Object obj)
Returns the index of the given object in this type's list of guaranteed objects. |
java.lang.String |
getName()
Returns the name of this type. |
java.util.List |
getOriginFunctions()
Returns a list of origin functions for this type. |
java.util.Collection |
getPOPs()
Returns the set of potential object patterns (POPs) for this type. |
POP |
getPOPWithOriginFuncs(java.util.BitSet originFuncSet)
Returns the POP that uses the given set of origin functions, or null if no such POP exists. |
POP |
getPOPWithOriginFuncs(java.util.Set originFuncSet)
Returns the POP that uses the given set of origin functions, or null if not such POP exists. |
java.util.Set |
getStrictAncestors()
Returns the types that are strict ancestors of this type in the type graph. |
boolean |
hasFiniteGuaranteed()
Returns true if this type has a finite number of guaranteed objects. |
boolean |
isBuiltIn()
Returns true if this is a built-in type. |
boolean |
isSubtypeOf(Type other)
Returns true if this type is a subtype of the given type. |
void |
print(java.io.PrintStream s)
Prints the type name. |
java.util.List |
range()
Returns a list of all the values that can be returned by an expression with this return type. |
java.lang.String |
toString()
Returns the name of this type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Type(java.lang.String name)
public Type(java.lang.String name, Type supertype)
supertype
. It initially has no POPs, no origin
functions, and no enumerated guaranteed objects.
Note that there's no way to change the supertype of a type once it's created. Thus, the types must be created in order from the root of the type hierarchy downward. So it is impossible to make the supertype relation cyclic.
supertype
- a Type object or nullpublic Type(java.lang.String name, Type supertype, boolean infinite)
supertype
. It initially has no POPs, no origin
functions, and no enumerated guaranteed objects. If
infinite
is true, the type has infinitely many
guaranteed objects.
supertype
- a Type object or nullMethod Detail |
---|
public java.lang.String getName()
public boolean isSubtypeOf(Type other)
public boolean isBuiltIn()
public void print(java.io.PrintStream s)
public java.util.Collection getPOPs()
public java.util.List getOriginFunctions()
public java.util.List getGuaranteedObjects()
public java.util.List range()
get
and indexOf
methods can be used
to convert efficiently between objects and indices.
java.lang.IllegalStateException
- if the set of objects of this
type is infinite or randompublic int getGuaranteedObjIndex(java.lang.Object obj)
public java.lang.Object getGuaranteedObject(int index)
public java.lang.Object getDefaultValue()
public boolean hasFiniteGuaranteed()
public Term getCanonicalTerm(java.lang.Object o)
java.lang.IllegalArgumentException
- if the given object is not of
this typepublic POP getPOPWithOriginFuncs(java.util.BitSet originFuncSet)
originFuncSet
- a BitSet where bit i stands for the ith origin
function in the list returned by
getOriginFunctionspublic POP getPOPWithOriginFuncs(java.util.Set originFuncSet)
originFuncSet
- Set of OriginFunction objectspublic java.util.Set getStrictAncestors()
public void addPOP(POP pop)
java.lang.IllegalArgumentException
- if the given POP uses the same set
of origin functions as an
existing POPpublic void addOriginFunction(OriginFunction f)
public EnumeratedObject addGuaranteedObject(NonRandomFunction constant)
public int getCreationIndex()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |