Пример #1
0
 public Evaluator getEvaluator(Class<?> cls, String operator) {
   if (cls == DroolsQuery.class) {
     cls = Object.class;
   }
   return registry.getEvaluator(
       ValueType.determineValueType(cls), Operator.determineOperator(operator, false));
 }
    public void setValue(
        final int index, final InternalReadAccessor extractor, final FieldValue value) {
      this.index = index;

      this.isNull = value.isNull();
      final ValueType vtype = extractor.getValueType();

      if (vtype.isBoolean()) {
        this.type = BOOL;
        if (!isNull) {
          this.bvalue = value.getBooleanValue();
          this.setHashCode(this.bvalue ? 1231 : 1237);
        } else {
          this.setHashCode(0);
        }
      } else if (vtype.isIntegerNumber()) {
        this.type = LONG;
        if (!isNull) {
          this.lvalue = value.getLongValue();
          this.setHashCode((int) (this.lvalue ^ (this.lvalue >>> 32)));
        } else {
          this.setHashCode(0);
        }
      } else if (vtype.isFloatNumber()) {
        this.type = DOUBLE;
        if (!isNull) {
          this.dvalue = value.getDoubleValue();
          final long temp = Double.doubleToLongBits(this.dvalue);
          this.setHashCode((int) (temp ^ (temp >>> 32)));
        } else {
          this.setHashCode(0);
        }
      } else {
        this.type = OBJECT;
        if (!isNull) {
          this.ovalue = vtype.coerce(value.getValue());
          this.setHashCode(this.ovalue != null ? this.ovalue.hashCode() : 0);
        } else {
          this.setHashCode(0);
        }
      }
    }