public class NodeType extends ObjectType implements TypeValue, NodePredicate, java.io.Externalizable
Type.NeverReturns
Modifier and Type | Field and Description |
---|---|
static NodeType |
anyNodeTest |
static int |
ATTRIBUTE_OK |
static int |
COMMENT_OK |
static NodeType |
commentNodeTest |
static int |
DOCUMENT_OK |
static NodeType |
documentNodeTest |
static int |
ELEMENT_OK |
static NodeType |
nodeType |
static int |
PI_OK |
static int |
TEXT_OK |
static NodeType |
textNodeTest |
static ClassType |
typeKNode |
static ClassType |
typeNodeType |
flags
boolean_ctype, boolean_type, booleanType, booleanValue_method, byte_type, byteType, char_type, charType, clone_method, double_type, doubleType, doubleValue_method, errorType, float_type, floatType, floatValue_method, int_type, intType, intValue_method, java_lang_Class_type, javalangannotationAnnotationType, javalangBooleanType, javalangCharacterType, javalangClassType, javalanginvokeMethodHandleType, javalangNumberType, javalangObjectType, javalangStringType, javalangThrowableType, long_type, longType, longValue_method, neverReturnsType, nullType, number_type, objectType, pointer_type, reflectClass, short_type, shortType, string_type, throwable_type, toString_method, tostring_type, toStringType, typeArray0, void_type, voidType
Constructor and Description |
---|
NodeType(java.lang.String name) |
NodeType(java.lang.String name,
int kinds) |
Modifier and Type | Method and Description |
---|---|
static KNode |
coerceForce(java.lang.Object obj,
int kinds) |
java.lang.Object |
coerceFromObject(java.lang.Object obj)
Convert an object to a value of this Type.
|
static KNode |
coerceOrNull(java.lang.Object obj,
int kinds) |
int |
compare(Type other)
Return a numeric code showing "subtype" relationship:
1: if other is a pure subtype of this;
0: if has the same values;
-1: if this is a pure subtype of other;
-2: if they have values in common but neither is a subtype of the other;
-3: if the types have no values in common.
|
Expression |
convertValue(Expression value)
Return converted expression or null.
|
void |
emitCoerceFromObject(CodeAttr code)
Compile (in given method) cast from Object to this Type.
|
protected void |
emitCoerceOrNullMethod(Variable incoming,
Compilation comp) |
void |
emitIsInstance(Variable incoming,
Compilation comp,
Target target)
Emit code for incoming instanceof this_type.
|
void |
emitTestIf(Variable incoming,
Declaration decl,
Compilation comp)
Emit code for
if (incoming instanceof this_type) decl = incoming ....
|
Procedure |
getConstructor()
Get the constructor function for this type.
|
Type |
getImplementationType()
Return Java-level implementation type.
|
static boolean |
isInstance(AbstractSequence seq,
int ipos,
int kinds) |
boolean |
isInstance(java.lang.Object obj) |
boolean |
isInstancePos(AbstractSequence seq,
int ipos) |
void |
readExternal(java.io.ObjectInput in) |
java.lang.String |
toString() |
void |
writeExternal(java.io.ObjectOutput out) |
getContextClass, getContextClassLoader, getField, getInterfaces, getInternalName, getMethod, getMethods, getMethods, getReflectClass, getSuperclass, isExisting, setExisting
coerceToObject, emitCoerceToObject, emitConvertFromPrimitive, emitIsInstance, getGenericSignature, getMaybeGenericSignature, getName, getRawType, getRealType, getSignature, getSize, getSizeInWords, getType, hashCode, isCompatibleWithValue, isCompatibleWithValue, isInterface, isMoreSpecific, isSame, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSharedType, lowestCommonSuperType, make, make, printSignature, promote, promoteIfUnsigned, registerTypeForClass, setGenericSignature, setName, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
encodeType
public static final int TEXT_OK
public static final int ELEMENT_OK
public static final int ATTRIBUTE_OK
public static final int DOCUMENT_OK
public static final int COMMENT_OK
public static final int PI_OK
public static final ClassType typeKNode
public static final ClassType typeNodeType
public static final NodeType nodeType
public static final NodeType documentNodeTest
public static final NodeType textNodeTest
public static final NodeType commentNodeTest
public static final NodeType anyNodeTest
public NodeType(java.lang.String name, int kinds)
public NodeType(java.lang.String name)
public void emitCoerceFromObject(CodeAttr code)
ObjectType
emitCoerceFromObject
in class ObjectType
public Expression convertValue(Expression value)
TypeValue
convertValue
in interface TypeValue
public java.lang.Object coerceFromObject(java.lang.Object obj)
Type
coerceFromObject
in class ObjectType
public Type getImplementationType()
Type
getImplementationType
in interface TypeValue
getImplementationType
in class Type
public int compare(Type other)
Type
compare
in class ObjectType
public boolean isInstance(java.lang.Object obj)
isInstance
in class ObjectType
public boolean isInstancePos(AbstractSequence seq, int ipos)
isInstancePos
in interface ItemPredicate
public static boolean isInstance(AbstractSequence seq, int ipos, int kinds)
public static KNode coerceForce(java.lang.Object obj, int kinds)
public static KNode coerceOrNull(java.lang.Object obj, int kinds)
protected void emitCoerceOrNullMethod(Variable incoming, Compilation comp)
public void emitTestIf(Variable incoming, Declaration decl, Compilation comp)
TypeValue
emitTestIf
in interface TypeValue
incoming
- Contains the value we are testing to see if it has the
type of this. If null, use top-of-stack.
May not be null if decl is non-null.decl
- If non-null, assign value after coercion to Declaration.comp
- The compilation state.public void emitIsInstance(Variable incoming, Compilation comp, Target target)
TypeValue
InstanceOf
.emitIsInstance
which is a conveniece method that calls
emitTestIf
.emitIsInstance
in interface TypeValue
incoming
- Contains the value we are testing to see if it has the
the type of 'this'. If null, use top-of-stack.comp
- The compilation state.target
- Where to leave the result.public Procedure getConstructor()
TypeValue
<init>
methods) should be used.getConstructor
in interface TypeValue
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException