當前位置: 首頁>>代碼示例>>Java>>正文


Java RealmQuery.or方法代碼示例

本文整理匯總了Java中io.realm.RealmQuery.or方法的典型用法代碼示例。如果您正苦於以下問題:Java RealmQuery.or方法的具體用法?Java RealmQuery.or怎麽用?Java RealmQuery.or使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.realm.RealmQuery的用法示例。


在下文中一共展示了RealmQuery.or方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: queryStoredBeaconEvents

import io.realm.RealmQuery; //導入方法依賴的package包/類
private RealmResults<BeaconEventRealm> queryStoredBeaconEvents(Realm realm,
    List<OrchextraBeacon> beacons) {
  RealmQuery<BeaconEventRealm> query = realm.where(BeaconEventRealm.class);

  for (int i = 0; i < beacons.size(); i++) {

    if (i > 0) {
      query = query.or();
    }

    query = query.equalTo(BeaconEventRealm.CODE_FIELD_NAME, beacons.get(i).getCode())
        .equalTo(BeaconEventRealm.DISTANCE_FIELD_NAME,
            beacons.get(i).getBeaconDistance().getStringValue());
  }

  return query.findAll();
}
 
開發者ID:Orchextra,項目名稱:orchextra-android-sdk,代碼行數:18,代碼來源:ProximityEventsUpdater.java

示例2: queryEqualTo

import io.realm.RealmQuery; //導入方法依賴的package包/類
public static <E extends RealmObject> RealmResults<E> queryEqualTo(final Realm realm, final Class<E> eClass, final String field, final boolean... filters) {

        try {
            final RealmQuery<E> realmQuery = realm.where(eClass);
            int i = 0;
            for (final boolean filter : filters) {
                if (i != 0)
                    realmQuery.or();
                realmQuery.equalTo(field, filter);
                i++;
            }
            return getRealmResults(realmQuery);
        } catch (Exception e) {
            Log.d(TAG, "", e);
            return null;
        }

    }
 
開發者ID:murielK,項目名稱:AndroidWPTemplate,代碼行數:19,代碼來源:RealmHelper.java

示例3: queryContains

import io.realm.RealmQuery; //導入方法依賴的package包/類
public static <E extends RealmObject> RealmResults<E> queryContains(final Realm realm, final Class<E> eClass, final String field, final String... filters) {

        try {
            final RealmQuery<E> realmQuery = realm.where(eClass);
            int i = 0;
            for (final String filter : filters) {
                if (i != 0)
                    realmQuery.or();
                realmQuery.contains(field, filter, false);
                i++;
            }
            return getRealmResults(realmQuery);
        } catch (Exception e) {
            Log.d(TAG, "", e);
            return null;
        }

    }
 
開發者ID:murielK,項目名稱:AndroidWPTemplate,代碼行數:19,代碼來源:RealmHelper.java

示例4: filterVehicle

import io.realm.RealmQuery; //導入方法依賴的package包/類
private static RealmQuery<Launch> filterVehicle(RealmQuery<Launch> query, ArrayList<String> vehicleFilter) {
    boolean firstGroup = true;
    for (String key : vehicleFilter) {
        if (key.contains("SLV")) {
            key = "SLV";
        }
        Timber.v("Vehicle key: %s", key);
        if (!firstGroup) {
            query.or();
        } else {
            firstGroup = false;
        }
        query.contains("rocket.name", key);
    }
    return query;
}
 
開發者ID:ItsCalebJones,項目名稱:SpaceLaunchNow-Android,代碼行數:17,代碼來源:QueryBuilder.java

示例5: filterLocation

import io.realm.RealmQuery; //導入方法依賴的package包/類
private static RealmQuery<Launch> filterLocation(RealmQuery<Launch> query, ArrayList<String> locationFilter) {
    boolean firstGroup = true;
    for (String key : locationFilter) {
        String[] parts = key.split(",");
        key = parts[0];
        if (key.length() > 5) {
            key = key.substring(0, 5);
        }
        Timber.v("Location key: %s", key);
        if (!firstGroup) {
            query.or();
        } else {
            firstGroup = false;
        }
        query.beginsWith("location.name", key);
    }
    return query;
}
 
開發者ID:ItsCalebJones,項目名稱:SpaceLaunchNow-Android,代碼行數:19,代碼來源:QueryBuilder.java

示例6: filterCountry

import io.realm.RealmQuery; //導入方法依賴的package包/類
private static RealmQuery<Launch> filterCountry(RealmQuery<Launch> query, ArrayList<String> countryFilter) {
    boolean firstGroup = true;
    for (String key : countryFilter) {
        Timber.v("Country key: %s", key);
        if (key.contains("China")) {
            key = "CHN";
        } else if (key.contains("Russia")) {
            key = "RUS";
        } else if (key.contains("India")) {
            key = "IND";
        } else if (key.contains("Multi")) {
            key = ",";
        }
        if (!firstGroup) {
            query.or();
        } else {
            firstGroup = false;
        }
        query.contains("location.pads.agencies.countryCode", key);
        query.or();
        query.contains("rocket.agencies.countryCode", key);
    }
    return query;
}
 
開發者ID:ItsCalebJones,項目名稱:SpaceLaunchNow-Android,代碼行數:25,代碼來源:QueryBuilder.java

示例7: updateRackList

import io.realm.RealmQuery; //導入方法依賴的package包/類
private void updateRackList() {

		rackList.clear();

		// Build lazy query
		RealmQuery<Rack> query = realm.where(Rack.class);

		if (!accessFilter.equals("")) {
			// isPublic values can be "true", "false", or "" (info not available)
			// Default behaviour will be always bring "" if filtering -- we can change it later
			query.beginGroup()
					.equalTo("isPublic", accessFilter)
					.or()
					.equalTo("isPublic", "")
					.endGroup();
		}

		if (!structureTypeFilter.isEmpty()) {
			query.in("structureType", structureTypeFilter.toArray(new String[structureTypeFilter.size()]));
		}

		if (!ratingRangeFilter.isEmpty()) {
			query.beginGroup();
			for (int i = 0; i < ratingRangeFilter.size(); ++i) {
				Pair<Float, Float> range = ratingRangeFilter.get(i);
				query.between("averageRating", range.first, range.second);
				if (i + 1 < ratingRangeFilter.size()) {
					query.or();
				}
			}
			query.endGroup();
		}

		rackList.addAll(query.findAll());

		if (rackListCallback != null) {
			rackListCallback.onRackListUpdate(rackList);
		}
	}
 
開發者ID:EduardoVernier,項目名稱:bikedeboa-android,代碼行數:40,代碼來源:RackManager.java

示例8: transform

import io.realm.RealmQuery; //導入方法依賴的package包/類
@Override
public <T extends RealmModel> RealmQuery<T> transform(RealmQuery<T> realmQuery, Condition condition) {
    // Check condition.
    if (condition.getType() != Condition.Type.OR)
        throw new IllegalArgumentException("Condition type is not OR.");
    // Transform query.
    return realmQuery.or();
}
 
開發者ID:bkromhout,項目名稱:Ruqus,代碼行數:9,代碼來源:Or.java


注:本文中的io.realm.RealmQuery.or方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。