1 61 62 63 64 package org.jaxen.expr; 65 66 abstract class DefaultBinaryExpr extends DefaultExpr implements BinaryExpr 67 { 68 private Expr lhs; 69 private Expr rhs; 70 71 DefaultBinaryExpr(Expr lhs, 72 Expr rhs) 73 { 74 this.lhs = lhs; 75 this.rhs = rhs; 76 } 77 78 public Expr getLHS() 79 { 80 return this.lhs; 81 } 82 83 public Expr getRHS() 84 { 85 return this.rhs; 86 } 87 88 public void setLHS(Expr lhs) 89 { 90 this.lhs = lhs; 91 } 92 93 public void setRHS(Expr rhs) 94 { 95 this.rhs = rhs; 96 } 97 98 public abstract String getOperator(); 99 100 public String getText() 101 { 102 return "(" + getLHS().getText() + " " + getOperator() + " " + getRHS().getText() + ")"; 103 } 104 105 public String toString() 106 { 107 return "[(" + getClass().getName() + "): " + getLHS() + ", " + getRHS() + "]"; 108 } 109 110 public Expr simplify() 111 { 112 setLHS( getLHS().simplify() ); 113 setRHS( getRHS().simplify() ); 114 115 return this; 116 } 117 } 118 | Popular Tags |