当前位置: 首页>>代码示例>>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;未经允许,请勿转载。