/** * Determine whether type A is type B or one of its subtypes, recursively * * @param subtype identifies the first type * @param supertype identifies the second type * @return true if the first type is the second type or a (direct or * indirect) subtype of the second type */ public boolean isSubType(ItemType subtype, ItemType supertype) { int relation = relationship(subtype, supertype); return (relation==SAME_TYPE || relation==SUBSUMED_BY); }
/** * Determine whether type A is type B or one of its subtypes, recursively * * @param subtype identifies the first type * @param supertype identifies the second type * @return true if the first type is the second type or a (direct or * indirect) subtype of the second type */ public boolean isSubType(ItemType subtype, ItemType supertype) { int relation = relationship(subtype, supertype); return (relation==SAME_TYPE || relation==SUBSUMED_BY); }
/** * Determine whether type A is type B or one of its subtypes, recursively. * "Subtype" here means a type that is subsumed, that is, a type whose instances * are a subset of the instances of the other type. * * @param subtype identifies the first type * @param supertype identifies the second type * @return true if the first type is the second type or is subsumed by the second type */ public boolean isSubType(ItemType subtype, /*@NotNull*/ ItemType supertype) { int relation = relationship(subtype, supertype); return relation == SAME_TYPE || relation == SUBSUMED_BY; }
/** * Determine whether type A is type B or one of its subtypes, recursively. * "Subtype" here means a type that is subsumed, that is, a type whose instances * are a subset of the instances of the other type. * * @param subtype identifies the first type * @param supertype identifies the second type * @return true if the first type is the second type or is subsumed by the second type */ public boolean isSubType(ItemType subtype, /*@NotNull*/ ItemType supertype) { int relation = relationship(subtype, supertype); return relation == SAME_TYPE || relation == SUBSUMED_BY; }
public boolean isSameType(SequenceType other, TypeHierarchy th) { return cardinality == other.cardinality && th.relationship(primaryType, other.primaryType) == TypeHierarchy.SAME_TYPE; }
public boolean isSameType(SequenceType other, TypeHierarchy th) { return cardinality == other.cardinality && th.relationship(primaryType, other.primaryType) == TypeHierarchy.SAME_TYPE; }
private boolean isNeverNaN(Expression exp, TypeHierarchy th) { return th.relationship(exp.getItemType(), BuiltInAtomicType.DOUBLE) == TypeHierarchy.DISJOINT && th.relationship(exp.getItemType(), BuiltInAtomicType.FLOAT) == TypeHierarchy.DISJOINT; }
private boolean maybeNaN(Expression exp, TypeHierarchy th) { return th.relationship(exp.getItemType(th), BuiltInAtomicType.DOUBLE) != TypeHierarchy.DISJOINT || th.relationship(exp.getItemType(th), BuiltInAtomicType.FLOAT) != TypeHierarchy.DISJOINT; }
private boolean maybeNaN(Expression exp, TypeHierarchy th) { return th.relationship(exp.getItemType(th), BuiltInAtomicType.DOUBLE) != TypeHierarchy.DISJOINT || th.relationship(exp.getItemType(th), BuiltInAtomicType.FLOAT) != TypeHierarchy.DISJOINT; }
private boolean maybeNaN(Expression exp, TypeHierarchy th) { return th.relationship(exp.getItemType(th), BuiltInAtomicType.DOUBLE) != TypeHierarchy.DISJOINT || th.relationship(exp.getItemType(th), BuiltInAtomicType.FLOAT) != TypeHierarchy.DISJOINT; }
private boolean isNeverNaN(Expression exp, TypeHierarchy th) { return th.relationship(exp.getItemType(), BuiltInAtomicType.DOUBLE) == TypeHierarchy.DISJOINT && th.relationship(exp.getItemType(), BuiltInAtomicType.FLOAT) == TypeHierarchy.DISJOINT; }
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet) { PathMap.PathMapNodeSet result = getBaseExpression().addToPathMap(pathMap, pathMapNodeSet); if (result != null) { TypeHierarchy th = getConfiguration().getTypeHierarchy(); ItemType operandItemType = getBaseExpression().getItemType(); if (th.relationship(NodeKindTest.ELEMENT, operandItemType) != TypeHierarchy.DISJOINT || th.relationship(NodeKindTest.DOCUMENT, operandItemType) != TypeHierarchy.DISJOINT) { result.setAtomized(); } } return null; }
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet) { PathMap.PathMapNodeSet result = getBaseExpression().addToPathMap(pathMap, pathMapNodeSet); if (result != null) { TypeHierarchy th = getConfiguration().getTypeHierarchy(); ItemType operandItemType = getBaseExpression().getItemType(); if (th.relationship(NodeKindTest.ELEMENT, operandItemType) != TypeHierarchy.DISJOINT || th.relationship(NodeKindTest.DOCUMENT, operandItemType) != TypeHierarchy.DISJOINT) { result.setAtomized(); } } return null; }
public ItemType getItemType(TypeHierarchy th) { if (schemaType != null) { Configuration config = getExecutable().getConfiguration(); ItemType in = select.getItemType(th); int e = th.relationship(in, NodeKindTest.ELEMENT); if (e == TypeHierarchy.SAME_TYPE || e == TypeHierarchy.SUBSUMED_BY) { return new ContentTypeTest(Type.ELEMENT, schemaType, config); } int a = th.relationship(in, NodeKindTest.ATTRIBUTE); if (a == TypeHierarchy.SAME_TYPE || a == TypeHierarchy.SUBSUMED_BY) { return new ContentTypeTest(Type.ATTRIBUTE, schemaType, config); } } return select.getItemType(th); }
private boolean operandsAreDisjoint(TypeHierarchy th) { return th.relationship(getLhsExpression().getItemType(), getRhsExpression().getItemType()) == TypeHierarchy.DISJOINT; }
private boolean operandsAreDisjoint(TypeHierarchy th) { return th.relationship(getLhsExpression().getItemType(), getRhsExpression().getItemType()) == TypeHierarchy.DISJOINT; }
private boolean mayInvolveCastToQName(TypeHierarchy th, Expression e1, Expression e2) { SimpleType s1 = (SimpleType) e1.getItemType().getAtomizedItemType(); return (s1 == BuiltInAtomicType.ANY_ATOMIC || s1.isNamespaceSensitive()) && th.relationship(e2.getItemType().getAtomizedItemType(), BuiltInAtomicType.UNTYPED_ATOMIC) != TypeHierarchy.DISJOINT && (e2.getSpecialProperties() & StaticProperty.NOT_UNTYPED_ATOMIC) == 0; }
private boolean mayInvolveCastToQName(TypeHierarchy th, Expression e1, Expression e2) { SimpleType s1 = (SimpleType) e1.getItemType().getAtomizedItemType(); return (s1 == BuiltInAtomicType.ANY_ATOMIC || s1.isNamespaceSensitive()) && th.relationship(e2.getItemType().getAtomizedItemType(), BuiltInAtomicType.UNTYPED_ATOMIC) != TypeHierarchy.DISJOINT && (e2.getSpecialProperties() & StaticProperty.NOT_UNTYPED_ATOMIC) == 0; }
@Override public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { Expression e2 = super.typeCheck(visitor, contextInfo); if (e2 != this) { return e2; } TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); Expression base = getBaseExpression(); if (th.relationship(base.getItemType(), BuiltInAtomicType.UNTYPED_ATOMIC) == TypeHierarchy.DISJOINT || base.hasSpecialProperty(StaticProperty.NOT_UNTYPED_ATOMIC)) { // operand cannot return untyped atomic values, so there's nothing to convert return getBaseExpression(); } return this; }
@Override public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { Expression e2 = super.typeCheck(visitor, contextInfo); if (e2 != this) { return e2; } TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); Expression base = getBaseExpression(); if (th.relationship(base.getItemType(), BuiltInAtomicType.UNTYPED_ATOMIC) == TypeHierarchy.DISJOINT || base.hasSpecialProperty(StaticProperty.NOT_UNTYPED_ATOMIC)) { // operand cannot return untyped atomic values, so there's nothing to convert return getBaseExpression(); } return this; }