/** * Ask whether one occurrence indicator subsumes another. Specifically, * <code>A.subsumes(B)</code> is true if every sequence that satisfies the occurrence * indicator B also satisfies the occurrence indicator A. * * @param other The other occurrence indicator * @return true if this occurrence indicator subsumes the other occurrence indicator * @since 9.1 */ public boolean subsumes(/*@NotNull*/ OccurrenceIndicator other) { return Cardinality.subsumes(getCardinality(), other.getCardinality()); }
/** * Get the declared cardinality of the parameter * * @return the occurrence indicator from the type appearing in the <code>as</code> attribute * of the <code>xsl:param</code> element */ public OccurrenceIndicator getDeclaredCardinality() { return OccurrenceIndicator.getOccurrenceIndicator(type.getCardinality()); }
/** * Get a hash code with semantics corresponding to the equals() method * * @return the hash code * @since 9.5 */ public final int hashCode() { return getItemType().hashCode() ^ (getOccurrenceIndicator().hashCode() << 17); }
/** * Test whether two SequenceType objects represent the same type * * @param other the other SequenceType object * @return true if the other object is a SequenceType representing the same type * @since 9.5 */ public final boolean equals(Object other) { return other instanceof SequenceType && ((SequenceType) other).getOccurrenceIndicator().equals(getOccurrenceIndicator()) && ((SequenceType) other).getItemType().equals(getItemType()); }
/** * Get a hash code with semantics corresponding to the equals() method * * @return the hash code * @since 9.5 */ public final int hashCode() { return getItemType().hashCode() ^ (getOccurrenceIndicator().hashCode() << 17); }
/** * Test whether two SequenceType objects represent the same type * * @param other the other SequenceType object * @return true if the other object is a SequenceType representing the same type * @since 9.5 */ public final boolean equals(Object other) { return other instanceof SequenceType && ((SequenceType) other).getOccurrenceIndicator().equals(getOccurrenceIndicator()) && ((SequenceType) other).getItemType().equals(getItemType()); }
/** * Ask whether one occurrence indicator subsumes another. Specifically, * <code>A.subsumes(B)</code> is true if every sequence that satisfies the occurrence * indicator B also satisfies the occurrence indicator A. * * @param other The other occurrence indicator * @return true if this occurrence indicator subsumes the other occurrence indicator * @since 9.1 */ public boolean subsumes(/*@NotNull*/ OccurrenceIndicator other) { return Cardinality.subsumes(getCardinality(), other.getCardinality()); }
/** * Get the declared cardinality of the parameter * * @return the occurrence indicator from the type appearing in the <code>as</code> attribute * of the <code>xsl:param</code> element */ public OccurrenceIndicator getDeclaredCardinality() { return OccurrenceIndicator.getOccurrenceIndicator(type.getCardinality()); }
/** * Ask whether this occurrence indicator permits an empty sequence. * * @return true if the occurrence indicator is one of {@link #ZERO}, {@link #ZERO_OR_ONE}, * or {@link #ZERO_OR_MORE} * @since 9.2 */ public boolean allowsZero() { return Cardinality.allowsZero(getCardinality()); }
/** * Get the statically-determined cardinality of the result of the expression. This is the most precise cardinality * that the processor is able to determine from static examination of the expression. * * @return the statically-determined cardinality of the result of the expression * @since 9.1 */ public OccurrenceIndicator getResultCardinality() { int card = exp.getInternalExpression().getCardinality(); return OccurrenceIndicator.getOccurrenceIndicator(card); }
/** * Ask whether this occurrence indicator permits an empty sequence. * * @return true if the occurrence indicator is one of {@link #ZERO}, {@link #ZERO_OR_ONE}, * or {@link #ZERO_OR_MORE} * @since 9.2 */ public boolean allowsZero() { return Cardinality.allowsZero(getCardinality()); }
/** * Get the statically-determined cardinality of the result of the query. This is the most precise cardinality * that the processor is able to determine from static examination of the query. * * @return the statically-determined cardinality of the result of the query * @since 9.1 */ /*@NotNull*/ public OccurrenceIndicator getResultCardinality() { int card = exp.getExpression().getCardinality(); return OccurrenceIndicator.getOccurrenceIndicator(card); }
/** * Ask whether this occurrence indicator permits a sequence containing more than one item. * * @return true if the occurrence indicator is one of {@link #ZERO_OR_MORE} or {@link #ONE_OR_MORE} * @since 9.2 */ public boolean allowsMany() { return Cardinality.allowsMany(getCardinality()); }
/** * Get the statically-determined cardinality of the result of the expression. This is the most precise cardinality * that the processor is able to determine from static examination of the expression. * * @return the statically-determined cardinality of the result of the expression * @since 9.1 */ public OccurrenceIndicator getResultCardinality() { int card = exp.getInternalExpression().getCardinality(); return OccurrenceIndicator.getOccurrenceIndicator(card); }
/** * Ask whether this occurrence indicator permits a sequence containing more than one item. * * @return true if the occurrence indicator is one of {@link #ZERO_OR_MORE} or {@link #ONE_OR_MORE} * @since 9.2 */ public boolean allowsMany() { return Cardinality.allowsMany(getCardinality()); }
/** * Get the statically-determined cardinality of the result of the query. This is the most precise cardinality * that the processor is able to determine from static examination of the query. * * @return the statically-determined cardinality of the result of the query * @since 9.1 */ /*@NotNull*/ public OccurrenceIndicator getResultCardinality() { int card = exp.getExpression().getCardinality(); return OccurrenceIndicator.getOccurrenceIndicator(card); }
/** * Get the underlying internal SequenceType * @return the equivalent instance of {@link net.sf.saxon.value.SequenceType} */ public net.sf.saxon.value.SequenceType getUnderlyingSequenceType() { return net.sf.saxon.value.SequenceType.makeSequenceType( itemType.getUnderlyingItemType(), occurrenceIndicator.getCardinality()); }
/** * Get the required cardinality of a declared variable in the static context of the expression. * * @param variableName the name of a declared variable * @return the required cardinality. * <p>If the variable was explicitly declared, this will be the occurrence indicator that was set when the * variable was declared. If no item type was set, it will be {@link OccurrenceIndicator#ZERO_OR_MORE}.</p> * <p>If the variable was implicitly declared by reference (which can happen only when the * <tt>allowUndeclaredVariables</tt> option is set), the returned type will be * {@link OccurrenceIndicator#ZERO_OR_MORE}.</p> * <p>If no variable with the specified QName has been declared either explicitly or implicitly, * the method returns null.</p> * @since 9.2 */ public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName) { XPathVariable var = env.getExternalVariable(variableName.getStructuredQName()); if (var == null) { return null; } else { return OccurrenceIndicator.getOccurrenceIndicator(var.getRequiredType().getCardinality()); } }
/** * Get the underlying internal SequenceType * @return the equivalent instance of {@link net.sf.saxon.value.SequenceType} */ public net.sf.saxon.value.SequenceType getUnderlyingSequenceType() { return net.sf.saxon.value.SequenceType.makeSequenceType( itemType.getUnderlyingItemType(), occurrenceIndicator.getCardinality()); }
/** * Get the required cardinality of a declared variable in the static context of the expression. * * @param variableName the name of a declared variable * @return the required cardinality. * <p>If the variable was explicitly declared, this will be the occurrence indicator that was set when the * variable was declared. If no item type was set, it will be {@link OccurrenceIndicator#ZERO_OR_MORE}.</p> * <p>If the variable was implicitly declared by reference (which can happen only when the * <tt>allowUndeclaredVariables</tt> option is set), the returned type will be * {@link OccurrenceIndicator#ZERO_OR_MORE}.</p> * <p>If no variable with the specified QName has been declared either explicitly or implicitly, * the method returns null.</p> * @since 9.2 */ public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName) { XPathVariable var = env.getExternalVariable(variableName.getStructuredQName()); if (var == null) { return null; } else { return OccurrenceIndicator.getOccurrenceIndicator(var.getRequiredType().getCardinality()); } }