コード例 #1
0
ファイル: Criterion.java プロジェクト: RuedigerMoeller/boon
  private void initForDouble(double value) {

    this.value = (VALUE) (Double) value;

    switch (operator) {
      case EQUAL:
        nativeDelegate = ObjectFilter.eqDouble(name, (value));
        break;

      case NOT_EQUAL:
        nativeDelegate = ObjectFilter.notEqDouble(name, (value));
        break;

      case LESS_THAN:
        nativeDelegate = ObjectFilter.ltDouble(name, (value));
        break;

      case LESS_THAN_EQUAL:
        nativeDelegate = ObjectFilter.lteDouble(name, (value));
        break;

      case GREATER_THAN:
        nativeDelegate = ObjectFilter.gtDouble(name, (value));
        break;

      case GREATER_THAN_EQUAL:
        nativeDelegate = ObjectFilter.gteDouble(name, (value));
        break;

      case BETWEEN:
        nativeDelegate = ObjectFilter.betweenDouble(name, (value), Conversions.toDouble(values[1]));
        break;

      case IN:
        nativeDelegate = ObjectFilter.inDoubles(name, Conversions.darray(values));
        break;

      case NOT_IN:
        nativeDelegate = ObjectFilter.notInDoubles(name, Conversions.darray(values));
        break;

      default:
        useDelegate = false;
    }
  }
コード例 #2
0
ファイル: Criterion.java プロジェクト: RuedigerMoeller/boon
  private void initIfNeeded() {

    if (initialized) return;
    initialized = true;

    String name = this.name.toString();

    FieldAccess field = field();
    if (field == null) {
      return;
    }

    Class type = field.type();

    if (!type.isPrimitive() && type != Typ.date) {
      return;
    }

    if (type == Typ.date) {

      if (!(value instanceof Date)) {
        initForDate();
      }
      return;
    }

    useDelegate = true;

    if (type == Typ.intgr) {
      int v = Conversions.toInt(value);
      initForInt(v);
    } else if (type == Typ.bt) {

      byte v = Conversions.toByte(value);

      initForByte(v);

    } else if (type == Typ.shrt) {

      short v = Conversions.toShort(value);

      initForShortValue(v);

    } else if (type == Typ.lng) {

      long v = Conversions.toLong(value);

      initForLong(v);

    } else if (type == Typ.flt) {

      float v = Conversions.toFloat(value);

      initForFloat(v);

    } else if (type == Typ.dbl) {

      double v = Conversions.toDouble(value);

      initForDouble(v);

    } else if (type == Typ.bln) {

      switch (operator) {
        case EQUAL:
          nativeDelegate = ObjectFilter.eqBoolean(name, Conversions.toBoolean(value));
          break;

        case NOT_EQUAL:
          nativeDelegate = ObjectFilter.notEqBoolean(name, Conversions.toBoolean(value));
          break;

        default:
          useDelegate = false;
      }

    } else if (type == Typ.chr) {

      char v = Conversions.toChar(value);
      initForChar(v);
    }
  }
コード例 #3
0
ファイル: Criterion.java プロジェクト: pchalcol/boon
 @Override
 public double doubleValue() {
   return Conversions.toDouble(value);
 }