org.apache.xalan.xsltc.compiler.util

Class Type

public abstract class Type extends Object implements Constants

Author: Jacek Ambroziak Santiago Pericas-Geertsen Morten Jorgensen

Field Summary
static TypeAttribute
static TypeBoolean
static TypeComment
static TypeElement
static TypeInt
static TypeNode
static TypeNodeSet
static TypeObject
static TypeProcessing_Instruction
static TypeReal
static TypeReference
static TypeResultTree
static TypeRoot
static TypeString
static TypeText
static TypeVoid
Method Summary
InstructionADD()
InstructionCMP(boolean less)
intdistanceTo(Type type)
Returns the distance between two types.
InstructionDIV()
InstructionDUP()
StringgetClassName()
Returns the class name of an internal type's external representation.
BranchInstructionGE(boolean tozero)
BranchInstructionGT(boolean tozero)
abstract booleanidenticalTo(Type other)
Returns true if this and other are identical types.
booleanimplementedAsMethod()
Returns true if this type has no object representaion.
booleanisNumber()
Returns true if this type is a numeric type.
booleanisSimple()
Returns true if this type is a simple type.
BranchInstructionLE(boolean tozero)
InstructionLOAD(int slot)
BranchInstructionLT(boolean tozero)
InstructionMUL()
static TypenewObjectType(String javaClassName)
Factory method to instantiate object types.
static TypenewObjectType(Class clazz)
Factory method to instantiate object types.
InstructionNEG()
InstructionPOP()
InstructionREM()
InstructionSTORE(int slot)
InstructionSUB()
abstract TypetoJCType()
abstract StringtoSignature()
Returns the signature of an internal type's external representation.
abstract StringtoString()
Returns a string representation of this type.
voidtranslateBox(ClassGenerator classGen, MethodGenerator methodGen)
Translates an object of this type to its boxed representation.
voidtranslateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz)
Translates an external (Java) type denoted by clazz to an object of this type.
voidtranslateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type)
Translates an object of this type to an object of type type.
voidtranslateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz)
Translates an object of this type to the external (Java) type denoted by clazz.
FlowListtranslateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, Type type)
Translates object of this type to an object of type type.
FlowListtranslateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type)
Translates an object of this type to an non-synthesized boolean.
voidtranslateUnBox(ClassGenerator classGen, MethodGenerator methodGen)
Translates an object of this type to its unboxed representation.

Field Detail

Attribute

public static final Type Attribute

Boolean

public static final Type Boolean

Comment

public static final Type Comment

Element

public static final Type Element

Int

public static final Type Int

Node

public static final Type Node

NodeSet

public static final Type NodeSet

Object

public static final Type Object

Processing_Instruction

public static final Type Processing_Instruction

Real

public static final Type Real

Reference

public static final Type Reference

ResultTree

public static final Type ResultTree

Root

public static final Type Root

String

public static final Type String

Text

public static final Type Text

Void

public static final Type Void

Method Detail

ADD

public Instruction ADD()

CMP

public Instruction CMP(boolean less)

distanceTo

public int distanceTo(Type type)
Returns the distance between two types. This measure is used to select overloaded functions/operators. This method is typically redefined by the subclasses.

DIV

public Instruction DIV()

DUP

public Instruction DUP()

getClassName

public String getClassName()
Returns the class name of an internal type's external representation.

GE

public BranchInstruction GE(boolean tozero)

GT

public BranchInstruction GT(boolean tozero)

identicalTo

public abstract boolean identicalTo(Type other)
Returns true if this and other are identical types.

implementedAsMethod

public boolean implementedAsMethod()
Returns true if this type has no object representaion. Redefined in ResultTreeType.

isNumber

public boolean isNumber()
Returns true if this type is a numeric type. Redefined in NumberType.

isSimple

public boolean isSimple()
Returns true if this type is a simple type. Redefined in NumberType, BooleanType and StringType.

LE

public BranchInstruction LE(boolean tozero)

LOAD

public Instruction LOAD(int slot)

LT

public BranchInstruction LT(boolean tozero)

MUL

public Instruction MUL()

newObjectType

public static Type newObjectType(String javaClassName)
Factory method to instantiate object types. Returns a pre-defined instance for "java.lang.Object" and "java.lang.String".

newObjectType

public static Type newObjectType(Class clazz)
Factory method to instantiate object types. Returns a pre-defined instance for java.lang.Object.class and java.lang.String.class.

NEG

public Instruction NEG()

POP

public Instruction POP()

REM

public Instruction REM()

STORE

public Instruction STORE(int slot)

SUB

public Instruction SUB()

toJCType

public abstract Type toJCType()

toSignature

public abstract String toSignature()
Returns the signature of an internal type's external representation.

toString

public abstract String toString()
Returns a string representation of this type.

translateBox

public void translateBox(ClassGenerator classGen, MethodGenerator methodGen)
Translates an object of this type to its boxed representation.

translateFrom

public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz)
Translates an external (Java) type denoted by clazz to an object of this type. This method is used to translate return values when external functions are called.

translateTo

public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type)
Translates an object of this type to an object of type type. Expects an object of the former type and pushes an object of the latter.

translateTo

public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz)
Translates an object of this type to the external (Java) type denoted by clazz. This method is used to translate parameters when external functions are called.

translateToDesynthesized

public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, Type type)
Translates object of this type to an object of type type. Expects an object of the former type and pushes an object of the latter if not boolean. If type type is boolean then a branchhandle list (to be appended to the false list) is returned.

translateToDesynthesized

public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type)
Translates an object of this type to an non-synthesized boolean. It does not push a 0 or a 1 but instead returns branchhandle list to be appended to the false list.

translateUnBox

public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen)
Translates an object of this type to its unboxed representation.
Copyright B) 2006 Apache XML Project. All Rights Reserved.