1 13 package com.tonbeller.jpivot.olap.mdxparse; 14 15 import java.util.List ; 16 17 20 public class QueryAxis implements Exp { 21 22 private String name; 23 private boolean nonEmpty; 24 private Exp exp; 25 private List dimProps; 27 31 public QueryAxis(boolean nonEmpty, Exp exp, String name) { 32 this.nonEmpty = nonEmpty; 33 this.exp = exp; 34 this.name = name; 35 } 36 37 41 public Exp getExp() { 42 return exp; 43 } 44 45 49 public String getName() { 50 return name; 51 } 52 53 57 public boolean isNonEmpty() { 58 return nonEmpty; 59 } 60 61 65 public void setExp(Exp exp) { 66 this.exp = exp; 67 } 68 69 73 public void setName(String name) { 74 this.name = name; 75 } 76 77 81 public void setNonEmpty(boolean nonEmpty) { 82 this.nonEmpty = nonEmpty; 83 } 84 85 88 public String toMdx() { 89 StringBuffer sb = new StringBuffer (); 90 if (nonEmpty) { 91 sb.append("NON EMPTY "); 92 } 93 sb.append(exp.toMdx()); 94 if (dimProps != null && dimProps.size() > 0) { 95 sb.append(" DIMENSION PROPERTIES "); 96 for (int i = 0; i < dimProps.size(); i++) { 97 if (i > 0) 98 sb.append(','); 99 sb.append(((CompoundId) dimProps.get(i)).toMdx()); 100 } 101 } 102 sb.append(" ON "); 103 sb.append(name); 104 return sb.toString(); 105 } 106 107 111 public Object clone() { 112 QueryAxis qa = new QueryAxis(nonEmpty, (Exp) exp.clone(), name); 113 qa.setDimProps(dimProps); 114 return qa; 115 } 116 117 120 public List getDimProps() { 121 return dimProps; 122 } 123 124 127 public void setDimProps(List dimProps) { 128 this.dimProps = dimProps; 129 } 130 131 134 public void accept(ExpVisitor visitor) { 135 visitor.visitQueryAxis(this); 136 } 137 138 } | Popular Tags |