Example usage for com.mongodb BasicDBObject getDouble

List of usage examples for com.mongodb BasicDBObject getDouble

Introduction

In this page you can find the example usage for com.mongodb BasicDBObject getDouble.

Prototype

public double getDouble(final String key) 

Source Link

Document

Returns the value of a field as a double .

Usage

From source file:tango.mongo.MongoUtils.java

License:Open Source License

public static float[] getFloatArray(BasicDBList list, String key) {
    float[] res = new float[list.size()];
    boolean field = false;
    for (int i = 0; i < list.size(); i++) {
        BasicDBObject o = ((BasicDBObject) list.get(i));
        if (o.containsField(key)) {
            field = true;// ww  w  .ja  va  2s  .co m
            res[i] = (float) o.getDouble(key);
        }
    }
    return field ? res : null;
}

From source file:tango.parameter.DoubleParameter.java

License:Open Source License

@Override
public void dbGet(BasicDBObject DBO) {
    if (DBO.containsField(id) && DBO.get(id) != null) {
        number.setValue(DBO.getDouble(id));
    }//from   w ww  .  ja  v a2s .c  o  m
    setColor();
}

From source file:tango.parameter.SliderDoubleParameter.java

License:Open Source License

@Override
public void dbGet(BasicDBObject DBO) {
    if (DBO.containsField(id) && DBO.get(id) != null) {
        double value = DBO.getDouble(id);
        if (value < this.min)
            setSliderValue(min);//from   w ww  .j a  v  a2 s.c  o  m
        else if (value > this.max)
            setSliderValue(max);
        else
            setSliderValue(value);
    }
    setColor();
}