## Package com.saxonica.codegen

The codegen package contains the Java code generator for XQuery.

See:
Description

Interface Summary
ReturnAction: Defines how the result of compiling an expression should be returned to the calling expression

Class Summary
AdjustCompiler: Generate Java code to implement the XPath adjust-xx-to-timezone() family of functions
AggregateCompiler: Generate Java code for the count(), sum(), and avg() functions.
AnyURIValueCompiler: Generate Java code for an xs:anyURI constant
ArithmeticCompiler: Compiler for arithmetic expressions where it is not known in advance whether numeric arithmetic or date/time/duration arithmetic will be used
AtomicMappingCompiler: Generate Java code to evaluate a simple mapping expression (that is, the "/" operator, when the expression on the rhs is known to return atomic values)
AtomicSequenceConverterCompiler: Compile Java code to implement an atomic sequence converter
AtomizerCompiler
AxisExpressionCompiler: Generate code for an AxisExpression
Base64BinaryValueCompiler: Compile Java code representing a Base64Binary constant value
BaseURICompiler: Generate Java code to support XPath functions such as name(), local-name(), namespace-uri(), node-name()
BigIntegerValueCompiler: Compile Java code representing a big integer constant value.
BlockCompiler: Generate Java code for a Block, that is a sequence of expressions or instructions
BooleanExpressionCompiler: Compile a boolean expression (and/or) to Java code
BooleanFnCompiler: Generate Java code to implement the XPath boolean() and not() functions
BooleanValueCompiler
CardinalityCheckerCompiler: Compile Java code for a cardinality check (this is typically an expression added to the expression tree during static type checking)
CastableExpressionCompiler: Generate Java code to implement the XPath castable expression
CastExpressionCompiler: Generate Java code to implement the XPath cast expression
ChooseCompiler: Generate Java code to implement a conditional ("if/choose") expression
CodepointEqualCompiler: Generate Java code to implement the codepoint-equal() function
CodepointsToStringCompiler: Generate Java code to implement the XPath codepoints-to-string() function
CollectionCompiler: Compile code to implement the XPath collection() function.
CommentCompiler: Compile a comment constructor to Java source code
CompareCompiler: Generate Java code to implement the compare() function
CompareToIntegerConstantCompiler: Generate Java code for a comparison to an integer constant, for example EXP gt 22
CompilerService: The class contains the generic logic for generating Java code to evaluate an XQuery expression.
ComponentCompiler: Generate Java code to implement XPath component extractions functions, such as month-from-dateTime() or namespace-uri-from-QName()
ComputedAttributeCompiler: Compile a computed attribute constructor to Java source code
ComputedElementCompiler: Compile a computed element constructor to Java source code
ConcatCompiler: Generate Java code to implement the concat() function
ConditionalSorterCompiler: Generate code for a DocumentSorter (which conditionally sorts nodes into document order)
ContainsCompiler: Generate Java code to implement one of the functions contains(), starts-with(), ends-with(), substring-before(), substring-after()
ContextItemCompiler: Compile code to implement a ContextItemExpression
CopyOfCompiler: Compile a CopyOf expression/instruction to Java source code.
CurrentDateTimeCompiler: Generate Java code to implement the current-dateTime, current-date, and current-time() functions; also implicit-timezone()
DateTimeConstructorCompiler: Generate Java code to implement the XPath dateTime(date, time) function
DateTimeValueCompiler: Compile Java code representing a dateTime constant value
DateValueCompiler: Compile Java code representing a date constant value
DayTimeDurationValueCompiler: Compile Java code representing an xs:dayTimeDuration constant value
DecimalValueCompiler: Compile Java code representing a decimal constant value
DeepEqualCompiler: Compile the XPath function deep-equal() to Java code
DistinctValuesCompiler: Compile code to implement the distinct-values() function.
DocAvailableCompiler: Compile code to implement the doc-available\() function.
DocCompiler: Compile code to implement the doc() function.
DocumentInstrCompiler: Compile a document node constructor to Java source code
DocumentSorterCompiler: Generate code for a DocumentSorter (which sorts nodes into document order
DoubleValueCompiler: The class generates Java code to implement an XPath xs:double literal
DurationValueCompiler: Compile Java code representing an xs:duration constant value
EmptySequenceCompiler: Generate Java code to implement an XPath empty sequence
ErrorCompiler: Generate Java code to implement a call on the XPath error() function
ErrorExpressionCompiler: Generate Java code to implement an ErrorExpression: this is an expression generated by the parser when it is known statically that execution of an expression will necessarily fail, but where the error is not generated at compile time because the expression might not be evalauated.
EscapeURICompiler: Generate Java code for the three functions encode-for-uri(), iri-to-uri(), escape-html-uri()
ExistenceCompiler: Generate Java code for an exists() or empty() function call
ExpressionClassMapper: For each class of expression found on the expression tree, deliver a corresponding instance of the helper class used to generate Java code for the expression
ExpressionCompiler: This abstract class represents the compiler (that is, Java code generator) for a particular kind of expression on the expression tree.
ExtensionFunctionCallCompiler: Generate Java code to implement an extension function call
FilterExpressionCompiler: Generate Java code to implement an XPath filter expression
FirstItemExpressionCompiler: Compiler for a FirstItemExpression.
FixedAttributeCompiler: Compile a FixedAttribute expression to Java source code
FixedElementCompiler: Compile a FixedElement expression to Java source code
FloatValueCompiler: The class generates Java code to implement an XPath xs:float literal
ForceCaseCompiler: Generate Java code for the upper-case() and lower-case() functions
ForExpressionCompiler: Compile code to implement a "for" expression (for $x in sequence return action)
GDayValueCompiler: Compile Java code representing a date constant value
GeneralComparisonCompiler
GMonthDayValueCompiler: Compile Java code representing an xs:gYearMonth constant value
GMonthValueCompiler: Compile Java code representing an xs:gMonth constant value
GYearMonthValueCompiler: Compile Java code representing an xs:gYearMonth constant value
GYearValueCompiler: Compile Java code representing an xs:gYear constant value
HexBinaryValueCompiler: Compile Java code representing a HexBinary constant value
IdCompiler: Compile code to implement the id() function.
IdentityComparisonCompiler: Generate Java code to implement an identity comparison (a is b) or a node order comparison (a << b, a >> b)
IdrefCompiler: Compile code to implement the idref() function.
IndexedFilterExpressionCompiler: Generate Java code to implement an XPath filter expression, one that has already been marked by the Saxon-SA optimizer as suitable for implementation using an indexed lookup
IndexedLookupExpressionCompiler: Generate Java code to implement an indexed lookup expression.
IndexOfCompiler: Generate Java code to implement the XPath index-of() function
InScopePrefixesCompiler: Generate Java code to implement the in-scope-prefixes function
InsertCompiler: Generate Java code to implement the XPath insert-before() function
InstanceOfCompiler: Generate Java code for an "instance of" expression
Int64ValueCompiler: Compile Java code representing an integer constant value.
IntegerRangeCompiler: Generate Java code to implement an XPath integer range expression of the form (1 to 10) with constant end points.
IntegerRangeTestCompiler: Generate Java code for a integer range test (a = (b to c))
IsLastExpressionCompiler: Generate Java code for an IsLastExpression (position() = last())
IsWholeNumberCompiler: Generate Java code for a call on saxon:is-whole-number()
ItemAtCompiler: Generate Java code to implement a saxon:item-at() expression
ItemCheckerCompiler: Generate Java code to implement an item type check
JavaAssignment: A return action that assigns the value of the expression to a variable supplied by the caller
JavaDeclaration: A return action that assigns the value of the expression to a variable supplied by the caller
JavaVariable: A top-level field within the Java class being generated by the `CompilerService`
KeyFnCompiler: Compile code to implement the key() function.
LangCompiler: Generate Java code for the lang() function
LastCompiler: Generate Java code to implement the XPath last() function
LastItemExpressionCompiler: Compiler for a FirstItemExpression.
LazyExpressionCompiler: Compile code for a LazyExpression - an expression which is always evaluated lazily
LetExpressionCompiler: Compiles Java code to implement a Let expression
LiteralCompiler: Compile an literal expression to Java code
LocalVariableReferenceCompiler: Generate Java code to implement an XPath local variable reference
LoopAction: Callback interface to generate code to insert within a compiled loop
MatchesCompiler: Compile the XPath function matches() to Java code
MinimaxCompiler: Generate Java code for a call on the min() or max() function
NamePartCompiler: Generate Java code to support XPath functions such as name(), local-name(), namespace-uri(), node-name()
NamespaceForPrefixCompiler: Generate Java code for the XPath namespace-uri-for-prefix() function
NegateExpressionCompiler: Generate Java code to implement the XPath unary minus operator
NilledCompiler: Generate Java code for the nilled() function
NormalizeSpaceCompiler: Generate Java code for the normalize-space() functions
NormalizeUnicodeCompiler: Generate Java code for the normalize-unicode function
NotationValueCompiler: Generate Java code for a Notation literal
NumberFnCompiler: Generate Java code to implement the XPath number() function
NumericPromoterCompiler: Generate Java code to implement a numeric promotion
ParentNodeExpressionCompiler: Compile code to implement a ContextItemExpression
PathExpressionCompiler: Generate Java code to evaluate a path expression (that is, the "/" operator, when the expression on the rhs is known to return nodes)
PatternCompiler: Compile a PatternMatchExpression (.
PatternMatchExpressionCompiler: Compile a PatternMatchExpression (.
PositionCompiler: Generate Java code to implement the XPath position() function
ProcessingInstructionCompiler: Compile a processing-instruction constructor to Java source code
PushExpressionCompiler: Superclass for compiling expressions whose natural evaluation mode is "push", that is, expressions that construct new nodes.
QNameFnCompiler: Generate Java code to implement the XPath QName() function
QNameValueCompiler: Generate Java code for a QName literal
QuantifiedExpressionCompiler
QueryCompiler: This class handles the compilation (to Java) of a query
QuerySimpleContentCompiler: Compile a comment constructor to Java source code
RangeExpressionCompiler: Generate Java code to implement an XPath integer range expression of the form (1 to 10) with computed end points
RemoveCompiler: Generate Java code to implement the XPath remove() function
ReplaceCompiler: Compile the XPath function matches() to Java code
ResolveQNameCompiler: Generate Java code to implement the XPath resolve-QName() function
ResolveURICompiler: Generate Java code to implement the XPath resolve-uri() function
ReverseCompiler: Generate Java code to implement the XPath reverse() function
RootExpressionCompiler: Generate Java code to implement the expression "/"
RootFunctionCompiler: Generate Java code to implement the expression "root()"
RoundingCompiler: Generate Java code for the rounding functions: round(), floor(), ceiling(), abs(), round-half-to-even()
SequenceExpressionCompiler: Superclass for compiling expressions whose natural evaluation mode is "pull", for example, expressions that read and return existing nodes.
SequenceExtentCompiler: Generate Java code for a SequenceExtent, that is a sequence of items.
SingletonAtomizerCompiler: Generate Java code for an expression that atomizes a singleton
SingletonComparisonCompiler: Generate Java code to implement a value comparison operator
SingletonExpressionCompiler: Generate Java code for an expression that returns a single value.
SlashExpressionCompiler: Generate Java code to evaluate a general slash expression (that is, the "/" operator, when it is not known whether the expression on the rhs will return nodes or atomic values)
StringFnCompiler: Generate Java code to implement the XPath string() function
StringJoinCompiler: Generate Java code to implement the string-join function
StringLengthCompiler: Generate Java code to implement the XPath string-length() function
StringToCodepointsCompiler: Generate Java code to implement the XPath string-to-codepoints() function
StringValueCompiler: Generate Java code for a string literal
SubsequenceCompiler: Generate Java code to implement the XPath remove() function
SubstringCompiler: Generate Java code to implement the XPath translate() function
TailCallLoopCompiler: Generate Java code to implement a tail call loop expression.
TailExpressionCompiler: Generate code for a TailExpression
TimeValueCompiler: Compile Java code representing an xs:time constant value
ToBooleanCompiler: Abstract class for compiling expressions that yield a boolean value and are generally used in a boolean context.
TokenizeCompiler: Compile the XPath function tokenize() to Java code
TraceCompiler: Generate Java code for the trace() function.
TranslateCompiler: Generate Java code to implement the XPath translate() function
TreatFnCompiler: Generate Java code to implement the "treat as" functions exactly-one, etc.
TupleExpressionCompiler: Compiler for tuple expressions.
TupleSorterCompiler: Generate code for a TupleSorter
UntypedAtomicConverterCompiler: Compile Java code for an UntypedAtomicConverter, an expression inserted by the type checker to convert untyped atomic values in a sequence to a given target type.
UntypedAtomicValueCompiler: Generate Java code for an untypedAtomic literal
UserFunctionCallCompiler: Compiles Java code to implement a Let expression
ValueComparisonCompiler: Generate Java code to implement a value comparison operator
ValueCompiler: Compile a literal value to Java code
ValueOfCompiler: Compile a FixedElement expression to Java source code
VariableReferenceCompiler: Generate Java code to implement an XPath variable reference
VennExpressionCompiler: Generate code for a union, intersect, or except expression
YearMonthDurationValueCompiler: Compile Java code representing an xs:dayTimeDuration constant value

## Package com.saxonica.codegen Description

The codegen package contains the Java code generator for XQuery.

The only class designed to be used directly by user applications is `QueryCompiler`, which can be used to drive the compilation of a query from a Java application. Normally, however, query compilation will be done from the command line using the `com.saxonica.CompileQuery` entry point.

The other classes in this package fall into two categories:

- Support classes for compiling particular kinds of expression found on the expression tree, for example the class `CastExpressionCompiler` is used to generate code for a cast expression;
- General-purpose support classes, such as `CompilerService`, which handles much of the logic for tracking the generation of different parts of the Java output.

Copyright (c) Saxonica Limited. All rights reserved.