/** * Get a string representation of the pattern. This will be in a form similar to the * original pattern text, but not necessarily identical. It is not guaranteed to be * in legal pattern syntax. */ public String toString() { return "pattern matching " + getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy * * @return an ItemType, as specific as possible, which all the matching items satisfy */ @Override public ItemType getItemType() { return wrappedPattern.getItemType(); }
/** * Get a NodeTest that all the nodes matching this pattern must satisfy */ public ItemType getItemType() { if (refinedItemType != null) { return refinedItemType; } return basePattern.getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy */ @Override public ItemType getItemType() { return p1.getItemType(); }
/** * Get a string representation of the pattern. This will be in a form similar to the * original pattern text, but not necessarily identical. It is not guaranteed to be * in legal pattern syntax. */ public String toString() { return "pattern matching " + getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy */ @Override public ItemType getItemType() { return p1.getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy */ @Override public ItemType getItemType() { return p1.getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy */ @Override public ItemType getItemType() { return p1.getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy * * @return an ItemType, as specific as possible, which all the matching items satisfy */ @Override public ItemType getItemType() { return wrappedPattern.getItemType(); }
/** * Get a NodeTest that all the nodes matching this pattern must satisfy */ public ItemType getItemType() { if (refinedItemType != null) { return refinedItemType; } return basePattern.getItemType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy */ @Override public ItemType getItemType() { ItemType t1 = p1.getItemType(); ItemType t2 = p2.getItemType(); return Type.getCommonSuperType(t1, t2); }
/** * Get an ItemType that all the items matching this pattern must satisfy * * @return an ItemType, as specific as possible, which all the matching items satisfy */ /*@Nullable*/ @Override public ItemType getItemType() { return getBasePattern().getItemType(); }
private void mustBeNodePattern(Pattern p) throws XPathException { if (p instanceof NodeTestPattern) { ItemType it = p.getItemType(); if (!(it instanceof NodeTest)) { XPathException err = new XPathException("The operands of a union, intersect, or except pattern " + "must be patterns that match nodes", "XPTY0004"); err.setIsTypeError(true); throw err; } } }
private void mustBeNodePattern(Pattern p) throws XPathException { if (p instanceof NodeTestPattern) { ItemType it = p.getItemType(); if (!(it instanceof NodeTest)) { XPathException err = new XPathException("The operands of a union, intersect, or except pattern " + "must be patterns that match nodes", "XPTY0004"); err.setIsTypeError(true); throw err; } } }
/** * Get a NodeTest to use as a filter for nodes, given a pattern. */ private static NodeTest getNodeTestForPattern(Pattern pattern) { ItemType type = pattern.getItemType(); if (type instanceof NodeTest) { return (NodeTest) type; } else if (pattern.getUType().overlaps(UType.ANY_NODE)) { return AnyNodeTest.getInstance(); } else { return ErrorType.getInstance(); } }
/** * Get a NodeTest to use as a filter for nodes, given a pattern. */ private static NodeTest getNodeTestForPattern(Pattern pattern) { ItemType type = pattern.getItemType(); if (type instanceof NodeTest) { return (NodeTest) type; } else if (pattern.getUType().overlaps(UType.ANY_NODE)) { return AnyNodeTest.getInstance(); } else { return ErrorType.getInstance(); } }
public PatternThatSetsCurrent(Pattern wrappedPattern, LocalVariableBinding binding) { this.wrappedPattern = wrappedPattern; this.binding = binding; binding.setRequiredType(SequenceType.makeSequenceType(wrappedPattern.getItemType(), StaticProperty.EXACTLY_ONE)); adoptChildExpression(wrappedPattern); setPriority(wrappedPattern.getDefaultPriority()); }
public PatternThatSetsCurrent(Pattern wrappedPattern, LocalVariableBinding binding) { this.wrappedPattern = wrappedPattern; this.binding = binding; binding.setRequiredType(SequenceType.makeSequenceType(wrappedPattern.getItemType(), StaticProperty.EXACTLY_ONE)); adoptChildExpression(wrappedPattern); setPriority(wrappedPattern.getDefaultPriority()); }
private static void exportRule(Rule rule, ExpressionPresenter presenter) { String which = rule.getAction() == Stripper.STRIP ? "s" : "p"; presenter.startElement(which); presenter.emitAttribute("test", rule.getPattern().getItemType().toExportString()); presenter.emitAttribute("prec", rule.getPrecedence()+""); presenter.endElement(); }
private static void exportRule(Rule rule, ExpressionPresenter presenter) { String which = rule.getAction() == Stripper.STRIP ? "s" : "p"; presenter.startElement(which); presenter.emitAttribute("test", rule.getPattern().getItemType().toExportString()); presenter.emitAttribute("prec", rule.getPrecedence()+""); presenter.endElement(); }