gnu.kawa.reflect

Class OccurrenceType

public class OccurrenceType extends ObjectType implements Externalizable, TypeValue

A type that matches some number of repetitions of a basetype.
Field Summary
static TypeemptySequenceType
static ClassTypetypeOccurrenceType
Constructor Summary
OccurrenceType(Type base, int minOccurs, int maxOccurs)
Method Summary
ObjectcoerceFromObject(Object obj)
intcompare(Type other)
voidemitIsInstance(Variable incoming, Compilation comp, Target target)
voidemitTestIf(Variable incoming, Declaration decl, Compilation comp)
TypegetBase()
ProceduregetConstructor()
TypegetImplementationType()
static TypegetInstance(Type base, int minOccurs, int maxOccurs)
booleanisInstance(Object obj)
static charitemCountCode(Type type)
Returna a quantifer kind for a sequence type.
static booleanitemCountIsOne(Type type)
static booleanitemCountIsZeroOrOne(Type type)
static intitemCountRange(Type type)
Return a conservative estimage on the min/max number of items of a type.
static TypeitemPrimeType(Type type)
QUery formal semantics "prime type"
intmaxOccurs()
intminOccurs()
voidreadExternal(ObjectInput in)
StringtoString()
voidwriteExternal(ObjectOutput out)

Field Detail

emptySequenceType

public static final Type emptySequenceType

typeOccurrenceType

public static final ClassType typeOccurrenceType

Constructor Detail

OccurrenceType

public OccurrenceType(Type base, int minOccurs, int maxOccurs)

Method Detail

coerceFromObject

public Object coerceFromObject(Object obj)

compare

public int compare(Type other)

emitIsInstance

public void emitIsInstance(Variable incoming, Compilation comp, Target target)

emitTestIf

public void emitTestIf(Variable incoming, Declaration decl, Compilation comp)

getBase

public Type getBase()

getConstructor

public Procedure getConstructor()

getImplementationType

public Type getImplementationType()

getInstance

public static Type getInstance(Type base, int minOccurs, int maxOccurs)

isInstance

public boolean isInstance(Object obj)

itemCountCode

public static char itemCountCode(Type type)
Returna a quantifer kind for a sequence type.

Returns: '0' if type is known to be a void (0-item) type; '1' if type is known to be a single-item type; '?' if type matches a sequence of 0 or 1 items; '+' if type matches a sequence of 1 or more items; '*' otherwise.

itemCountIsOne

public static boolean itemCountIsOne(Type type)

itemCountIsZeroOrOne

public static boolean itemCountIsZeroOrOne(Type type)

itemCountRange

public static int itemCountRange(Type type)
Return a conservative estimage on the min/max number of items of a type.

Returns: {@code maxCount << 12 | minCount & 0xFFF}, where a {@code maxCount} of -1 means unbounded.

itemPrimeType

public static Type itemPrimeType(Type type)
QUery formal semantics "prime type"

maxOccurs

public int maxOccurs()

minOccurs

public int minOccurs()

readExternal

public void readExternal(ObjectInput in)

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)