1 15 package org.josql.internal; 16 17 import org.josql.expressions.Expression; 18 19 public class OrderBy 20 { 21 22 public static final int ASC = 0; 23 public static final int DESC = 1; 24 25 private int type = -1; 26 private int ci = -1; 27 private Expression exp = null; 28 29 public void setExpression (Expression exp) 30 { 31 32 this.exp = exp; 33 34 } 35 36 public int getIndex () 37 { 38 39 return this.ci; 40 41 } 42 43 public Expression getExpression () 44 { 45 46 return this.exp; 47 48 } 49 50 public void setIndex (int ci) 51 { 52 53 this.ci = ci; 54 55 } 56 57 public int getType () 58 { 59 60 return this.type; 61 62 } 63 64 public void setType (int t) 65 { 66 67 this.type = t; 68 69 } 70 71 public String toString () 72 { 73 74 StringBuffer b = new StringBuffer (); 75 76 if (this.ci > -1) 77 { 78 79 b.append (this.ci); 80 81 } else { 82 83 b.append (this.exp); 84 85 } 86 87 if (this.type == OrderBy.ASC) 88 { 89 90 b.append (" ASC"); 91 92 } 93 94 if (this.type == OrderBy.DESC) 95 { 96 97 b.append (" DESC"); 98 99 } 100 101 return b.toString (); 102 103 } 104 105 } 106 | Popular Tags |