@Override public int hashCode() { int x = this.getDirection() ; if ( getExpression() != null ) x ^= getExpression().hashCode() ; return x ; }
@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( ! ( other instanceof SortCondition ) ) return false ; SortCondition sc = (SortCondition)other ; if ( sc.getDirection() != this.getDirection() ) return false ; if ( ! Lib.equal(this.getExpression(), sc.getExpression()) ) return false ; // if ( ! Utils.eq(this.getVariable(), sc.getVariable()) ) // return false ; return true ; }
@Override public int hashCode() { int x = this.getDirection() ; if ( getExpression() != null ) x ^= getExpression().hashCode() ; return x ; }
@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( ! ( other instanceof SortCondition ) ) return false ; SortCondition sc = (SortCondition)other ; if ( sc.getDirection() != this.getDirection() ) return false ; if ( ! Lib.equal(this.getExpression(), sc.getExpression()) ) return false ; // if ( ! Utils.eq(this.getVariable(), sc.getVariable()) ) // return false ; return true ; }
private void formatSortCondition(SortCondition sc) { boolean close = true ; String tag = null ; if ( sc.getDirection() != Query.ORDER_DEFAULT ) { if ( sc.getDirection() == Query.ORDER_ASCENDING ) { tag = Tags.tagAsc ; WriterLib.start(out, tag, NoNL) ; } if ( sc.getDirection() == Query.ORDER_DESCENDING ) { tag = Tags.tagDesc ; WriterLib.start(out, tag, NoNL) ; } } WriterExpr.output(out, sc.getExpression(), sContext) ; if ( tag != null ) WriterLib.finish(out, tag) ; }
private void formatSortCondition(SortCondition sc) { boolean close = true ; String tag = null ; if ( sc.getDirection() != Query.ORDER_DEFAULT ) { if ( sc.getDirection() == Query.ORDER_ASCENDING ) { tag = Tags.tagAsc ; WriterLib.start(out, tag, NoNL) ; } if ( sc.getDirection() == Query.ORDER_DESCENDING ) { tag = Tags.tagDesc ; WriterLib.start(out, tag, NoNL) ; } } WriterExpr.output(out, sc.getExpression(), sContext) ; if ( tag != null ) WriterLib.finish(out, tag) ; }
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 ; } }
out.writeInt(sortCondition.getDirection());
@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) ; }
scList.add(new SortCondition(e, sc.getDirection())) ;