/** * Display the pattern for diagnostics */ public String toString() { return ".[" + getPredicate() + "]"; }
/** * Display the pattern for diagnostics */ public String toString() { return ".[" + getPredicate() + "]"; }
/** * Determine whether this pattern is the same as another pattern * * @param other the other object */ public boolean equals(/*@NotNull*/ Object other) { return (other instanceof BooleanExpressionPattern) && ((BooleanExpressionPattern) other).getPredicate().isEqual(getPredicate()); }
/** * Determine whether this pattern is the same as another pattern * * @param other the other object */ public boolean equals(/*@NotNull*/ Object other) { return (other instanceof BooleanExpressionPattern) && ((BooleanExpressionPattern) other).getPredicate().isEqual(getPredicate()); }
/** * Allocate slots to any variables used within the pattern * * @param slotManager holds details of the allocated slots * @param nextFree the next slot that is free to be allocated @return the next slot that is free to be allocated */ public int allocateSlots(SlotManager slotManager, int nextFree) { return ExpressionTool.allocateSlots(getPredicate(), nextFree, slotManager); }
/** * Hashcode supporting equals() */ public int computeHashCode() { return 0x7aeffea9 ^ getPredicate().hashCode(); }
/** * Get a UType indicating which kinds of items this Pattern can match. * * @return a UType indicating all the primitive types of item that the pattern can match. */ @Override public UType getUType() { if (getPredicate() instanceof InstanceOfExpression) { return ((InstanceOfExpression) getPredicate()).getRequiredItemType().getUType(); } else { return UType.ANY; } }
/** * Get a UType indicating which kinds of items this Pattern can match. * * @return a UType indicating all the primitive types of item that the pattern can match. */ @Override public UType getUType() { if (getPredicate() instanceof InstanceOfExpression) { return ((InstanceOfExpression) getPredicate()).getRequiredItemType().getUType(); } else { return UType.ANY; } }
/** * Hashcode supporting equals() */ public int computeHashCode() { return 0x7aeffea9 ^ getPredicate().hashCode(); }
/** * Allocate slots to any variables used within the pattern * * @param slotManager holds details of the allocated slots * @param nextFree the next slot that is free to be allocated @return the next slot that is free to be allocated */ public int allocateSlots(SlotManager slotManager, int nextFree) { return ExpressionTool.allocateSlots(getPredicate(), nextFree, slotManager); }
/** * Get an Itemtype that all the items matching this pattern must satisfy */ public ItemType getItemType() { if (getPredicate() instanceof InstanceOfExpression) { InstanceOfExpression ioe = (InstanceOfExpression)getPredicate(); if (ioe.getBaseExpression() instanceof ContextItemExpression) { return ioe.getRequiredItemType(); } } return AnyItemType.getInstance(); }
/** * Get an Itemtype that all the items matching this pattern must satisfy */ public ItemType getItemType() { if (getPredicate() instanceof InstanceOfExpression) { InstanceOfExpression ioe = (InstanceOfExpression)getPredicate(); if (ioe.getBaseExpression() instanceof ContextItemExpression) { return ioe.getRequiredItemType(); } } return AnyItemType.getInstance(); }
/** * Copy a pattern. This makes a deep copy. * * @return the copy of the original pattern * @param rebindings variables that need to be re-bound */ /*@NotNull*/ public Pattern copy(RebindingMap rebindings) { BooleanExpressionPattern n = new BooleanExpressionPattern(getPredicate().copy(rebindings)); ExpressionTool.copyLocationInfo(this, n); return n; }
/** * Copy a pattern. This makes a deep copy. * * @return the copy of the original pattern * @param rebindings variables that need to be re-bound */ /*@NotNull*/ public Pattern copy(RebindingMap rebindings) { BooleanExpressionPattern n = new BooleanExpressionPattern(getPredicate().copy(rebindings)); ExpressionTool.copyLocationInfo(this, n); return n; }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.booleanExp"); /*if (comp != null) { comp.export(presenter); } else { */ getPredicate().export(presenter); //} presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.booleanExp"); /*if (comp != null) { comp.export(presenter); } else { */ getPredicate().export(presenter); //} presenter.endElement(); }
@Override public Pattern optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { ContextItemStaticInfo cit = visitor.getConfiguration().getDefaultContextItemStaticInfo(); expressionOp.setChildExpression(getPredicate().optimize(visitor, cit)); return this; }
@Override public Pattern optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { ContextItemStaticInfo cit = visitor.getConfiguration().getDefaultContextItemStaticInfo(); expressionOp.setChildExpression(getPredicate().optimize(visitor, cit)); return this; }
/** * Type-check the pattern. * * @param visitor the expression visitor * @param contextItemType the type of the context item at the point where the pattern * is defined. Set to null if it is known that the context item is undefined. * @return the optimised Pattern */ @Override public Pattern typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { ContextItemStaticInfo cit = visitor.getConfiguration().getDefaultContextItemStaticInfo(); expressionOp.setChildExpression(getPredicate().typeCheck(visitor, cit)); return this; }
/** * Type-check the pattern. * * @param visitor the expression visitor * @param contextItemType the type of the context item at the point where the pattern * is defined. Set to null if it is known that the context item is undefined. * @return the optimised Pattern */ @Override public Pattern typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { ContextItemStaticInfo cit = visitor.getConfiguration().getDefaultContextItemStaticInfo(); expressionOp.setChildExpression(getPredicate().typeCheck(visitor, cit)); return this; }