1 13 14 package mondrian.olap; 15 import java.io.PrintWriter ; 16 17 20 public class MemberProperty extends QueryPart { 21 22 private final String name; 23 private Exp exp; 24 25 public MemberProperty(String name, Exp exp) { 26 this.name = name; 27 this.exp = exp; 28 } 29 30 protected Object clone() { 31 return new MemberProperty(name, (Exp) exp.clone()); 32 } 33 34 static MemberProperty[] cloneArray(MemberProperty[] x) { 35 MemberProperty[] x2 = new MemberProperty[x.length]; 36 for (int i = 0; i < x.length; i++) { 37 x2[i] = (MemberProperty) x[i].clone(); 38 } 39 return x2; 40 } 41 42 void resolve(Validator validator) { 43 exp = validator.validate(exp, false); 44 } 45 46 public Exp getExp() { 47 return exp; 48 } 49 50 public String getName() { 51 return name; 52 } 53 54 public Object [] getChildren() { 55 return new Exp[] {exp}; 56 } 57 58 public void unparse(PrintWriter pw) { 59 pw.print(name + " = "); 60 exp.unparse(pw); 61 } 62 63 66 static Exp get(MemberProperty[] a, String name) { 67 for (int i = 0; i < a.length; i++) { 69 if (Util.equalName(a[i].name, name)) { 70 return a[i].exp; 71 } 72 } 73 return null; 74 } 75 } 76 77 78 | Popular Tags |