/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return elementTest.getDefaultPriority(); }
/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return elementTest.getDefaultPriority(); }
/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return elementTest.getDefaultPriority(); }
/** * Get the default priority of this nodeTest when used as a pattern. In the case of a union, this will always * be (arbitrarily) the default priority of the first operand. In other cases, again somewhat arbitrarily, it * is 0.25, reflecting the common usage of an intersection to represent the pattern element(E, T). */ public double getDefaultPriority() { if (operator == Token.UNION) { return nodetest1.getDefaultPriority(); } else { // typically it's element(E, T) return 0.25; } }
/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return nodeTest.getDefaultPriority(); }
/** * Get the default priority of this nodeTest when used as a pattern. In the case of a union, this will always * be (arbitrarily) the default priority of the first operand. In other cases, again somewhat arbitrarily, it * is 0.25, reflecting the common usage of an intersection to represent the pattern element(E, T). */ public double getDefaultPriority() { if (operator == Token.UNION) { return nodetest1.getDefaultPriority(); } else { // typically it's element(E, T) return 0.25; } }
/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return nodeTest.getDefaultPriority(); }
/** * Determine the default priority of this node test when used on its own as a Pattern */ public final double getDefaultPriority() { return elementTest.getDefaultPriority(); }
/** * Create an NodeTestPattern that matches all items of a given type * * @param test the type that the items must satisfy for the pattern to match */ public NodeTestPattern(NodeTest test) { nodeTest = test; setPriority(test.getDefaultPriority()); }
/** * Create an NodeTestPattern that matches all items of a given type * * @param test the type that the items must satisfy for the pattern to match */ public NodeTestPattern(NodeTest test) { nodeTest = test; setPriority(test.getDefaultPriority()); }
public void addRule(NodeTestPattern pattern, Stripper.StripRuleTarget action, int precedence, int minImportPrecedence) throws XPathException { NodeTest test = pattern.getNodeTest(); double priority = test.getDefaultPriority(); Rule newRule = new Rule(pattern, action, precedence, minImportPrecedence, priority, sequence++); int prio = priority == 0 ? 2 : priority == -0.25 ? 1 : 0; newRule.setRank((precedence << 18) + (prio << 16) + sequence); if (test instanceof NodeKindTest) { newRule.setAlwaysMatches(true); anyElementRule = addRuleToList(newRule, anyElementRule, true); } else if (test instanceof NameTest) { newRule.setAlwaysMatches(true); int fp = test.getFingerprint(); CodedName key = new CodedName(fp, "", ((NameTest) test).getNamePool()); Rule chain = namedElementRules.get(key); namedElementRules.put(key, addRuleToList(newRule, chain, true)); } else { unnamedElementRuleChain = addRuleToList(newRule, unnamedElementRuleChain, false); } }
public void addRule(NodeTestPattern pattern, Stripper.StripRuleTarget action, int precedence, int minImportPrecedence) throws XPathException { NodeTest test = pattern.getNodeTest(); double priority = test.getDefaultPriority(); Rule newRule = new Rule(pattern, action, precedence, minImportPrecedence, priority, sequence++); int prio = priority == 0 ? 2 : priority == -0.25 ? 1 : 0; newRule.setRank((precedence << 18) + (prio << 16) + sequence); if (test instanceof NodeKindTest) { newRule.setAlwaysMatches(true); anyElementRule = addRuleToList(newRule, anyElementRule, true); } else if (test instanceof NameTest) { newRule.setAlwaysMatches(true); int fp = test.getFingerprint(); NamePool pool = ((NameTest) test).getNamePool(); FingerprintedQName key = new FingerprintedQName(pool.getUnprefixedQName(fp), pool); Rule chain = namedElementRules.get(key); namedElementRules.put(key, addRuleToList(newRule, chain, true)); } else { unnamedElementRuleChain = addRuleToList(newRule, unnamedElementRuleChain, false); } }
private Visibility wildcardAcceptedVisibility(SymbolicName name, List<XSLAccept> acceptors) throws XPathException { // Note: last one wins Visibility vis = null; for (XSLAccept acceptor : acceptors) { for (ComponentTest test : acceptor.getWildcardComponentTests()) { if (((NodeTest) test.getQNameTest()).getDefaultPriority() == -0.25 && test.matches(name)) { vis = acceptor.getVisibility(); } } } if (vis != null) { return vis; } for (XSLAccept acceptor : acceptors) { for (ComponentTest test : acceptor.getWildcardComponentTests()) { if (test.matches(name)) { vis = acceptor.getVisibility(); } } } return vis; }
private Visibility wildcardAcceptedVisibility(SymbolicName name, List<XSLAccept> acceptors) throws XPathException { // Note: last one wins Visibility vis = null; for (XSLAccept acceptor : acceptors) { for (ComponentTest test : acceptor.getWildcardComponentTests()) { if (((NodeTest) test.getQNameTest()).getDefaultPriority() == -0.25 && test.matches(name)) { vis = acceptor.getVisibility(); } } } if (vis != null) { return vis; } for (XSLAccept acceptor : acceptors) { for (ComponentTest test : acceptor.getWildcardComponentTests()) { if (test.matches(name)) { vis = acceptor.getVisibility(); } } } return vis; }