/** * Create a range with a begin and an end. * * @param begin the fields forming the beginning of the range * @param beginBound the match type for the begin fields * @param end the fields forming the end of the range * @param endBound the match type for the end fields * @return a range object */ public static Range create(Collection<Field<?>> begin, Bound beginBound, Collection<Field<?>> end, Bound endBound) { return new Range(begin, beginBound, end, endBound); }
/** * Creates a range that only matches one element. This range will read all elements which is equal to the * given keys. * * @param singleton the fields forming the singleton range * @return a range object */ public static Range singleton(Collection<Field<?>> singleton) { return new Range(singleton, Bound.INCLUSIVE, singleton, Bound.INCLUSIVE); }
/** * Create a range that starts from a begin point, but does not have an end. It will include all values that are * greater than (or equal to) the begin point. * * @param begin the fields forming the beginning of the range * @param beginBound the match type for the begin fields * @return a range object */ public static Range from(Collection<Field<?>> begin, Bound beginBound) { return new Range(begin, beginBound, Collections.emptySet(), Bound.INCLUSIVE); }
/** * Create a range that only has an end point. It will include all values less than (or equal to) the end point. * * @param end the fields forming the end of the range * @param endBound the match type for the end fields * @return a range object */ public static Range to(Collection<Field<?>> end, Bound endBound) { return new Range(Collections.emptySet(), Bound.INCLUSIVE, end, endBound); }
/** * Create a range that matches all the elements. * * @return a range object */ public static Range all() { return new Range(Collections.emptySet(), Bound.INCLUSIVE, Collections.emptySet(), Bound.INCLUSIVE); }