/** * Return a list of values resulting from evaluating each given * candidate. By default, this implementation invokes * {@link #eval(Object,Object,StoreContext,Map)} for * each instance and packs the return value into a new list. Aggregates * should override. */ protected Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params) { Collection ret = new ArrayList(candidates.size()); Object candidate; for (Iterator itr = candidates.iterator(); itr.hasNext();) { candidate = itr.next(); ret.add(evaluate(candidate, (orig == null) ? candidate : orig, ctx, params)); } return ret; }
/** * Return a list of values resulting from evaluating each given * candidate. By default, this implementation invokes * {@link #eval(Object,Object,StoreContext,Map)} for * each instance and packs the return value into a new list. Aggregates * should override. */ protected Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params) { Collection ret = new ArrayList(candidates.size()); Object candidate; for (Iterator itr = candidates.iterator(); itr.hasNext();) { candidate = itr.next(); ret.add(evaluate(candidate, (orig == null) ? candidate : orig, ctx, params)); } return ret; }
/** * Return a list of values resulting from evaluating each given * candidate. By default, this implementation invokes * {@link #eval(Object,Object,StoreContext,Map)} for * each instance and packs the return value into a new list. Aggregates * should override. */ protected Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params) { Collection ret = new ArrayList(candidates.size()); Object candidate; for (Iterator itr = candidates.iterator(); itr.hasNext();) { candidate = itr.next(); ret.add(evaluate(candidate, (orig == null) ? candidate : orig, ctx, params)); } return ret; }
/** * Return a list of values resulting from evaluating each given * candidate. By default, this implementation invokes * {@link #eval(Object,Object,StoreContext,Map)} for * each instance and packs the return value into a new list. Aggregates * should override. */ protected Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params) { Collection ret = new ArrayList(candidates.size()); Object candidate; for (Iterator itr = candidates.iterator(); itr.hasNext();) { candidate = itr.next(); ret.add(evaluate(candidate, (orig == null) ? candidate : orig, ctx, params)); } return ret; }
/** * Return a list of values resulting from evaluating each given * candidate. By default, this implementation invokes * {@link #eval(Object,Object,StoreContext,Map)} for * each instance and packs the return value into a new list. Aggregates * should override. */ protected Collection eval(Collection candidates, Object orig, StoreContext ctx, Object[] params) { Collection ret = new ArrayList(candidates.size()); Object candidate; for (Iterator itr = candidates.iterator(); itr.hasNext();) { candidate = itr.next(); ret.add(evaluate(candidate, (orig == null) ? candidate : orig, ctx, params)); } return ret; }
public int compare(Object o1, Object o2) { if (_idx != -1) { o1 = ((Object[]) o1)[_idx]; o2 = ((Object[]) o2)[_idx]; } else { o1 = _val.evaluate(o1, o1, _ctx, _params); o2 = _val.evaluate(o2, o2, _ctx, _params); } if (o1 == null && o2 == null) return 0; if (o1 == null) return (_asc) ? 1 : -1; if (o2 == null) return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; return i1 - i2; } try { if (_asc) return ((Comparable) o1).compareTo(o2); return ((Comparable) o2).compareTo(o1); } catch (ClassCastException cce) { Localizer loc = Localizer.forPackage (InMemoryExpressionFactory.class); throw new UserException(loc.get("not-comp", o1, o2)); } } }
public int compare(Object o1, Object o2) { if (_idx != -1) { o1 = ((Object[]) o1)[_idx]; o2 = ((Object[]) o2)[_idx]; } else { o1 = _val.evaluate(o1, o1, _ctx, _params); o2 = _val.evaluate(o2, o2, _ctx, _params); } if (o1 == null && o2 == null) return 0; if (o1 == null) return (_asc) ? 1 : -1; if (o2 == null) return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; return i1 - i2; } try { if (_asc) return ((Comparable) o1).compareTo(o2); return ((Comparable) o2).compareTo(o1); } catch (ClassCastException cce) { Localizer loc = Localizer.forPackage (InMemoryExpressionFactory.class); throw new UserException(loc.get("not-comp", o1, o2)); } } }
public int compare(Object o1, Object o2) { if (_idx != -1) { o1 = ((Object[]) o1)[_idx]; o2 = ((Object[]) o2)[_idx]; } else { o1 = _val.evaluate(o1, o1, _ctx, _params); o2 = _val.evaluate(o2, o2, _ctx, _params); } if (o1 == null && o2 == null) return 0; if (o1 == null) return (_asc) ? 1 : -1; if (o2 == null) return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; return i1 - i2; } try { if (_asc) return ((Comparable) o1).compareTo(o2); return ((Comparable) o2).compareTo(o1); } catch (ClassCastException cce) { Localizer loc = Localizer.forPackage (InMemoryExpressionFactory.class); throw new UserException(loc.get("not-comp", o1, o2)); } } }
public int compare(Object o1, Object o2) { if (_idx != -1) { o1 = ((Object[]) o1)[_idx]; o2 = ((Object[]) o2)[_idx]; } else { o1 = _val.evaluate(o1, o1, _ctx, _params); o2 = _val.evaluate(o2, o2, _ctx, _params); } if (o1 == null && o2 == null) return 0; if (o1 == null) return (_asc) ? 1 : -1; if (o2 == null) return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; return i1 - i2; } try { if (_asc) return ((Comparable) o1).compareTo(o2); return ((Comparable) o2).compareTo(o1); } catch (ClassCastException cce) { Localizer loc = Localizer.forPackage (InMemoryExpressionFactory.class); throw new UserException(loc.get("not-comp", o1, o2)); } } }
public int compare(Object o1, Object o2) { if (_idx != -1) { o1 = ((Object[]) o1)[_idx]; o2 = ((Object[]) o2)[_idx]; } else { o1 = _val.evaluate(o1, o1, _ctx, _params); o2 = _val.evaluate(o2, o2, _ctx, _params); } if (o1 == null && o2 == null) return 0; if (o1 == null) return (_asc) ? 1 : -1; if (o2 == null) return (_asc) ? -1 : 1; if (o1 instanceof Boolean && o2 instanceof Boolean) { int i1 = ((Boolean) o1).booleanValue() ? 1 : 0; int i2 = ((Boolean) o2).booleanValue() ? 1 : 0; return i1 - i2; } try { if (_asc) return ((Comparable) o1).compareTo(o2); return ((Comparable) o2).compareTo(o1); } catch (ClassCastException cce) { Localizer loc = Localizer.forPackage (InMemoryExpressionFactory.class); throw new UserException(loc.get("not-comp", o1, o2)); } } }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // use the parsed ordering expression to extract the ordering value Val val = (Val) _exps[0].ordering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext(). getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // use the parsed ordering expression to extract the ordering value Val val = (Val) _exps[0].ordering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext(). getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // use the parsed ordering expression to extract the ordering value Val val = (Val) _exps[0].ordering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext(). getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // use the parsed ordering expression to extract the ordering value Val val = (Val) _exps[0].ordering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext(). getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // use the parsed ordering expression to extract the ordering value Val val = (Val) _exps[0].ordering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext(). getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // need to parse orderings? synchronized (this) { if (_inMemOrdering == null) { ExpressionFactory factory = new InMemoryExpressionFactory(); _inMemOrdering = _parser.eval(_exps[0].orderingClauses, (ExpressionStoreQuery) q, factory, _meta); } if (_inMemOrdering == null) _inMemOrdering = _exps[0].ordering; } // use the parsed ordering expression to extract the ordering value Val val = (Val) _inMemOrdering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext().getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // need to parse orderings? synchronized (this) { if (_inMemOrdering == null) { ExpressionFactory factory = new InMemoryExpressionFactory(); _inMemOrdering = _parser.eval(_exps[0].orderingClauses, (ExpressionStoreQuery) q, factory, _meta); } if (_inMemOrdering == null) _inMemOrdering = _exps[0].ordering; } // use the parsed ordering expression to extract the ordering value Val val = (Val) _inMemOrdering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext().getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // need to parse orderings? synchronized (this) { if (_inMemOrdering == null) { ExpressionFactory factory = new InMemoryExpressionFactory(); _inMemOrdering = _parser.eval(_exps[0].orderingClauses, (ExpressionStoreQuery) q, factory, _meta); } if (_inMemOrdering == null) _inMemOrdering = _exps[0].ordering; } // use the parsed ordering expression to extract the ordering value Val val = (Val) _inMemOrdering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext().getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // need to parse orderings? synchronized (this) { if (_inMemOrdering == null) { ExpressionFactory factory = new InMemoryExpressionFactory(); _inMemOrdering = _parser.eval(_exps[0].orderingClauses, (ExpressionStoreQuery) q, factory, _meta); } if (_inMemOrdering == null) _inMemOrdering = _exps[0].ordering; } // use the parsed ordering expression to extract the ordering value Val val = (Val) _inMemOrdering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext().getStoreContext(), params); }
public Object getOrderingValue(StoreQuery q, Object[] params, Object resultObject, int orderIndex) { // if this is a projection, then we have to order on something // we selected if (_exps[0].projections.length > 0) { String ordering = _exps[0].orderingClauses[orderIndex]; for (int i = 0; i < _exps[0].projectionClauses.length; i++) if (ordering.equals(_exps[0].projectionClauses[i])) return ((Object[]) resultObject)[i]; throw new InvalidStateException(_loc.get ("merged-order-with-result", q.getContext().getLanguage(), q.getContext().getQueryString(), ordering)); } // need to parse orderings? synchronized (this) { if (_inMemOrdering == null) { ExpressionFactory factory = new InMemoryExpressionFactory(); _inMemOrdering = _parser.eval(_exps[0].orderingClauses, (ExpressionStoreQuery) q, factory, _meta); } if (_inMemOrdering == null) _inMemOrdering = _exps[0].ordering; } // use the parsed ordering expression to extract the ordering value Val val = (Val) _inMemOrdering[orderIndex]; return val.evaluate(resultObject, resultObject, q.getContext().getStoreContext(), params); }