public void addOrderBy(Expr expr, int direction) { SortCondition sc = new SortCondition(expr, direction) ; addOrderBy(sc) ; }
public void addOrderBy(Expr expr, int direction) { SortCondition sc = new SortCondition(expr, direction) ; addOrderBy(sc) ; }
public static List<SortCondition> transform(NodeTransform nodeTransform, List<SortCondition> conditions) { List<SortCondition> conditions2 = new ArrayList<SortCondition>() ; boolean same = true ; for ( SortCondition sc : conditions ) { Expr expr = sc.getExpression() ; Expr expr2 = transform(nodeTransform, expr) ; if ( expr != expr2 ) same = false ; SortCondition sc2 = new SortCondition(expr2, sc.getDirection()) ; conditions2.add(sc2) ; } if ( same ) return conditions ; return conditions2 ; } }
public void addOrderBy(Node var, int direction) { if ( ! var.isVariable() ) throw new QueryException("Not a variable: "+var) ; SortCondition sc = new SortCondition(var, direction) ; addOrderBy(sc) ; }
@Override public List<SortCondition> getOrderBy() { List<SortCondition> conditions = new ArrayList<SortCondition>(); List<OrderCondition> orderConditions = selectQuery .getSolutionModifier().getOrderClause(); for (OrderCondition condition : orderConditions) { Var expr = null; int dir = ORDER_UNKNOW; if (condition.getType() == OrderCondition.EOrderType.ASC) { dir = ORDER_ASCENDING; } else if (condition.getType() == OrderCondition.EOrderType.DESC) { dir = ORDER_DESCENDING; } SortCondition sortCondition = new SortCondition(expr, dir); conditions.add(sortCondition); } return conditions.size() > 0 ? conditions : null; }
public void addOrderBy(Node var, int direction) { if ( ! var.isVariable() ) throw new QueryException("Not a variable: "+var) ; SortCondition sc = new SortCondition(var, direction) ; addOrderBy(sc) ; }
public void addOrderBy(String varName, int direction) { varName = Var.canonical(varName) ; SortCondition sc = new SortCondition(new ExprVar(varName), direction) ; addOrderBy(sc) ; }
public void addOrderBy(String varName, int direction) { varName = Var.canonical(varName) ; SortCondition sc = new SortCondition(new ExprVar(varName), direction) ; addOrderBy(sc) ; }
Expr expr = ExprUtils.parse(s); this.orderBy.add(new SortCondition(expr, direction));
@Override public void visit(OpOrder opOrder) { List<SortCondition> conditions = opOrder.getConditions() ; List<SortCondition> conditions2 = new ArrayList<SortCondition>() ; boolean changed = false ; for ( SortCondition sc : conditions ) { Expr e = sc.getExpression() ; Expr e2 = ExprTransformer.transform(exprTransform, e) ; conditions2.add(new SortCondition(e2, sc.getDirection())) ; if ( e != e2 ) changed = true ; } OpOrder x = opOrder ; if ( changed ) x = new OpOrder(opOrder.getSubOp(), conditions2) ; visit1(x) ; }
@Override public void visit(OpOrder opOrder) { List<SortCondition> conditions = opOrder.getConditions() ; List<SortCondition> conditions2 = new ArrayList<SortCondition>() ; boolean changed = false ; for ( SortCondition sc : conditions ) { Expr e = sc.getExpression() ; Expr e2 = transform(e, exprTransform) ; conditions2.add(new SortCondition(e2, sc.getDirection())) ; if ( e != e2 ) changed = true ; } OpOrder x = opOrder ; if ( changed ) x = new OpOrder(opOrder.getSubOp(), conditions2) ; visit1(x) ; }
SortCondition scBuilder(Item item) { int direction = Query.ORDER_DEFAULT ; if ( item.isTagged("asc") || item.isTagged("desc") ) { BuilderLib.checkList(item) ; BuilderLib.checkLength(2, item.getList(), "Direction corrupt") ; if ( item.isTagged("asc") ) direction = Query.ORDER_ASCENDING ; else direction = Query.ORDER_DESCENDING ; item = item.getList().get(1) ; } Expr expr = BuilderExpr.buildExpr(item) ; if ( expr.isVariable() ) return new SortCondition(expr.getExprVar().asVar(), direction) ; else return new SortCondition(expr, direction) ; }
SortCondition scBuilder(Item item) { int direction = Query.ORDER_DEFAULT ; if ( item.isTagged("asc") || item.isTagged("desc") ) { BuilderLib.checkList(item) ; BuilderLib.checkLength(2, item.getList(), "Direction corrupt") ; if ( item.isTagged("asc") ) direction = Query.ORDER_ASCENDING ; else direction = Query.ORDER_DESCENDING ; item = item.getList().get(1) ; } Expr expr = BuilderExpr.buildExpr(item) ; if ( expr.isVariable() ) return new SortCondition(expr.getExprVar().asVar(), direction) ; else return new SortCondition(expr, direction) ; }
scList.add(new SortCondition(e, sc.getDirection())) ;