Java Code Examples for io.realm.DynamicRealmObject#getList()

The following examples show how to use io.realm.DynamicRealmObject#getList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealmBarDataSet.java    From NetKnight with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, int xIndex) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(values,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    } else {
        float value = dynamicObject.getFloat(mValuesField);
        return new BarEntry(value,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    }
}
 
Example 2
Source File: RealmBarDataSet.java    From JNChartDemo with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, int xIndex) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(values,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    } else {
        float value = dynamicObject.getFloat(mValuesField);
        return new BarEntry(value,
                mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField));
    }
}
 
Example 3
Source File: RealmBarDataSet.java    From MPAndroidChart-Realm with Apache License 2.0 6 votes vote down vote up
@Override
public BarEntry buildEntryFromResultObject(T realmObject, float x) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    if (dynamicObject.getFieldType(mYValuesField) == RealmFieldType.LIST) {

        RealmList<DynamicRealmObject> list = dynamicObject.getList(mYValuesField);
        float[] values = new float[list.size()];

        int i = 0;
        for (DynamicRealmObject o : list) {
            values[i] = o.getFloat(mStackValueFieldName);
            i++;
        }

        return new BarEntry(
                mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField), values);
    } else {
        float value = dynamicObject.getFloat(mYValuesField);
        return new BarEntry(mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField), value);
    }
}
 
Example 4
Source File: RealmBarDataSet.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void build(RealmResults<T> results) {

    for (T realmObject : results) {

        DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

        try { // normal entry

            float value = dynamicObject.getFloat(mValuesField);
            mValues.add(new BarEntry(value, dynamicObject.getInt(mIndexField)));

        } catch (IllegalArgumentException e) { // stacked entry

            RealmList<DynamicRealmObject> list = dynamicObject.getList(mValuesField);
            float[] values = new float[list.size()];

            int i = 0;
            for (DynamicRealmObject o : list) {
                values[i] = o.getFloat(mStackValueFieldName);
                i++;
            }

            mValues.add(new BarEntry(values, dynamicObject.getInt(mIndexField)));
        }
    }

    calcStackSize();
}