1 61 62 63 64 package org.jaxen.expr; 65 66 import java.util.List ; 67 68 abstract class DefaultTruthExpr extends DefaultBinaryExpr 69 { 70 DefaultTruthExpr(Expr lhs, 71 Expr rhs) 72 { 73 super( lhs, 74 rhs ); 75 } 76 77 public String toString() 78 { 79 return "[(DefaultTruthExpr): " + getLHS() + ", " + getRHS() + "]"; 80 } 81 82 protected boolean bothAreSets(Object lhs, 83 Object rhs) 84 { 85 return ( lhs instanceof List 86 && 87 rhs instanceof List ); 88 } 89 90 protected boolean eitherIsSet(Object lhs, 91 Object rhs) 92 { 93 return ( lhs instanceof List 94 || 95 rhs instanceof List ); 96 } 97 98 protected boolean isSet(Object obj) 99 { 100 return ( obj instanceof List ); 101 } 102 103 protected boolean setIsEmpty( List set ) 104 { 105 return (set == null || set.size() == 0); 106 } 107 108 protected boolean eitherIsBoolean(Object lhs, 109 Object rhs) 110 { 111 return ( lhs instanceof Boolean 112 || 113 rhs instanceof Boolean ); 114 } 115 116 protected boolean bothAreBoolean(Object lhs, 117 Object rhs) 118 { 119 return ( lhs instanceof Boolean 120 && 121 rhs instanceof Boolean ); 122 } 123 124 protected boolean eitherIsNumber(Object lhs, 125 Object rhs) 126 { 127 return ( lhs instanceof Number 128 || 129 rhs instanceof Number ); 130 } 131 132 } 133 134 | Popular Tags |