@Override public boolean canRestrictSelector(SelectorImpl s) { return operand.canRestrictSelector(s); }
@Override public DynamicOperandImpl createCopy() { return new CoalesceImpl(operand1.createCopy(), operand2.createCopy()); }
@Override public PropertyValue currentProperty() { PropertyValue p = operand1.currentProperty(); return p != null ? p : operand2.currentProperty(); }
if (!ValueConverter.canConvert( operand2.getPropertyType(), operand1.getPropertyType())) { throw new IllegalArgumentException( "Unsupported conversion from property type " + PropertyType.nameFromValue(operand2.getPropertyType()) + " to property type " + PropertyType.nameFromValue(operand1.getPropertyType())); operand1.restrict(f, Operator.EQUAL, pv); } else if (operand1.supportsRangeConditions()) { if (lowerBound != null) { PropertyValue pv = PropertyValues.newString(lowerBound); operand1.restrict(f, Operator.GREATER_OR_EQUAL, pv); operand1.restrict(f, Operator.LESS_OR_EQUAL, pv); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v);
/** * Calls accept on the dynamic operand in the lower-case node. */ @Override public boolean visit(UpperCaseImpl node) { return node.getOperand().accept(this); }
@Override public PropertyExistenceImpl getPropertyExistence() { PropertyExistenceImpl pe = operand1.getPropertyExistence(); return pe != null ? pe : operand2.getPropertyExistence(); }
@Override public String getFunction(SelectorImpl s) { String f = operand.getFunction(s); if (f == null) { return null; } return "length*" + f; }
@Override public Set<SelectorImpl> getSelectors() { return operand1.getSelectors(); }
@Override public void restrict(FilterImpl f) { ArrayList<PropertyValue> list = new ArrayList<PropertyValue>(); for (StaticOperandImpl s : operand2) { if (!ValueConverter.canConvert( s.getPropertyType(), operand1.getPropertyType())) { throw new IllegalArgumentException( "Unsupported conversion from property type " + PropertyType.nameFromValue(s.getPropertyType()) + " to property type " + PropertyType.nameFromValue(operand1.getPropertyType())); } list.add(s.currentValue()); } if (list != null) { operand1.restrictList(f, list); } }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof InImpl) { return operand1.equals(((InImpl) that).operand1) && newHashSet(operand2).equals(newHashSet(((InImpl) that).operand2)); } else { return false; } }
private List<OrderEntry> getSortOrder(FilterImpl filter) { if (orderings == null) { return null; } ArrayList<OrderEntry> sortOrder = new ArrayList<OrderEntry>(); for (OrderingImpl o : orderings) { DynamicOperandImpl op = o.getOperand(); OrderEntry e = op.getOrderEntry(filter.getSelector(), o); if (e == null) { continue; } sortOrder.add(e); } if (sortOrder.size() == 0) { return null; } return sortOrder; }
if (!ValueConverter.canConvert( operand2.getPropertyType(), operand1.getPropertyType())) { throw new IllegalArgumentException( "Unsupported conversion from property type " + PropertyType.nameFromValue(operand2.getPropertyType()) + " to property type " + PropertyType.nameFromValue(operand1.getPropertyType())); operand1.restrict(f, Operator.EQUAL, pv); } else if (operand1.supportsRangeConditions()) { if (lowerBound != null) { PropertyValue pv = PropertyValues.newString(lowerBound); operand1.restrict(f, Operator.GREATER_OR_EQUAL, pv); operand1.restrict(f, Operator.LESS_OR_EQUAL, pv); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v);
@Override public PropertyExistenceImpl getPropertyExistence() { PropertyExistenceImpl pe = operand1.getPropertyExistence(); return pe != null ? pe : operand2.getPropertyExistence(); }
@Override public String getFunction(SelectorImpl s) { String f1 = operand1.getFunction(s); if (f1 == null) { return null; } String f2 = operand2.getFunction(s); if (f2 == null) { return null; } return "coalesce*" + f1 + "*" + f2; }
@Override public Set<SelectorImpl> getSelectors() { return operand.getSelectors(); }
@Override public void restrict(FilterImpl f) { ArrayList<PropertyValue> list = new ArrayList<PropertyValue>(); for (StaticOperandImpl s : operand2) { if (!ValueConverter.canConvert( s.getPropertyType(), operand1.getPropertyType())) { throw new IllegalArgumentException( "Unsupported conversion from property type " + PropertyType.nameFromValue(s.getPropertyType()) + " to property type " + PropertyType.nameFromValue(operand1.getPropertyType())); } list.add(s.currentValue()); } if (list != null) { operand1.restrictList(f, list); } }
@Override public boolean equals(Object that) { if (this == that) { return true; } else if (that instanceof InImpl) { return operand1.equals(((InImpl) that).operand1) && newHashSet(operand2).equals(newHashSet(((InImpl) that).operand2)); } else { return false; } }
private List<OrderEntry> getSortOrder(FilterImpl filter) { if (orderings == null) { return null; } ArrayList<OrderEntry> sortOrder = new ArrayList<OrderEntry>(); for (OrderingImpl o : orderings) { DynamicOperandImpl op = o.getOperand(); OrderEntry e = op.getOrderEntry(filter.getSelector(), o); if (e == null) { continue; } sortOrder.add(e); } if (sortOrder.size() == 0) { return null; } return sortOrder; }
if (!ValueConverter.canConvert( operand2.getPropertyType(), operand1.getPropertyType())) { throw new IllegalArgumentException( "Unsupported conversion from property type " + PropertyType.nameFromValue(operand2.getPropertyType()) + " to property type " + PropertyType.nameFromValue(operand1.getPropertyType())); operand1.restrict(f, Operator.EQUAL, pv); } else if (operand1.supportsRangeConditions()) { if (lowerBound != null) { PropertyValue pv = PropertyValues.newString(lowerBound); operand1.restrict(f, Operator.GREATER_OR_EQUAL, pv); operand1.restrict(f, Operator.LESS_OR_EQUAL, pv); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v); operand1.restrict(f, operator, v);