/** * Creates a new range using the same element class than this range. This method will be * overriden by subclasses in order to create a range of a more specific type. */ Range<T> create( final T minValue, final boolean isMinIncluded, final T maxValue, final boolean isMaxIncluded) { return new Range<T>(elementClass, minValue, isMinIncluded, maxValue, isMaxIncluded); }
return new Range<Byte>(Byte.class, (Byte) firstValue, (Byte) secondValue); } else if (targetClass == Short.class) { return new Range<Short>(Short.class, (Short) firstValue, (Short) secondValue); } else if (targetClass == Integer.class) { return new Range<Integer>(Integer.class, (Integer) firstValue, (Integer) secondValue); } else if (targetClass == Long.class) { return new Range<Long>(Long.class, (Long) firstValue, (Long) secondValue); } else if (targetClass == Float.class) { return new Range<Float>(Float.class, (Float) firstValue, (Float) secondValue); } else if (targetClass == Double.class) { return new Range<Double>(Double.class, (Double) firstValue, (Double) secondValue); } else return null;
/** * Returns a new {@link Range} object initialized with the given values. * * @param lower The lower value, inclusive. * @param upper The upper value, inclusive. */ private Range<T> newRange(final T lower, final T upper) { if (isNumeric) { return new NumberRange(elementClass, lower, upper); } else { return new Range<T>(elementClass, lower, upper); } }
/** Add a metadata element to the FileGroup metadata map */ protected void addMetadaElement( String name, Comparable min, Comparable max, Map<String, Object> metadataMap) { if (Utils.TIME_DOMAIN.equalsIgnoreCase(name) || min instanceof Date) { metadataMap.put(name.toUpperCase(), new DateRange((Date) min, (Date) max)); } else if (Utils.ELEVATION_DOMAIN.equalsIgnoreCase(name) || min instanceof Number) { metadataMap.put( name.toUpperCase(), NumberRange.create( ((Number) min).doubleValue(), true, ((Number) max).doubleValue(), true)); } else { metadataMap.put(name, new Range(String.class, (String) min, (String) max)); } }
/** Add a metadata element to the FileGroup metadata map */ private void addMetadaElement( String name, Comparable min, Comparable max, Map<String, Object> metadataMap) { if (Utils.TIME_DOMAIN.equalsIgnoreCase(name) || min instanceof Date) { metadataMap.put(name.toUpperCase(), new DateRange((Date) min, (Date) max)); } else if (Utils.ELEVATION_DOMAIN.equalsIgnoreCase(name) || min instanceof Number) { metadataMap.put( name.toUpperCase(), NumberRange.create( ((Number) min).doubleValue(), true, ((Number) max).doubleValue(), true)); } else { metadataMap.put(name, new Range(String.class, (String) min, (String) max)); } }
if (value != null) { if (op instanceof PropertyIsLessThan) { range = new Range(binding, null, false, (Comparable) value, false); } else if (op instanceof PropertyIsLessThanOrEqualTo) { range = new Range(binding, null, false, (Comparable) value, true); } else if (op instanceof PropertyIsEqualTo) { range = new Range(binding, (Comparable) value, (Comparable) value); } else if (op instanceof PropertyIsGreaterThanOrEqualTo) { range = new Range(binding, (Comparable) value, true, null, false); } else if (op instanceof PropertyIsGreaterThan) { range = new Range(binding, (Comparable) value, false, null, false); if (value != null) { if (op instanceof PropertyIsLessThan) { range = new Range(binding, (Comparable) value, true, null, false); } else if (op instanceof PropertyIsLessThanOrEqualTo) { range = new Range(binding, (Comparable) value, false, null, false); } else if (op instanceof PropertyIsEqualTo) { range = new Range(binding, (Comparable) value, (Comparable) value); } else if (op instanceof PropertyIsGreaterThanOrEqualTo) { range = new Range(binding, null, false, (Comparable) value, false); } else if (op instanceof PropertyIsGreaterThan) { range = new Range(binding, null, false, (Comparable) value, true);
} else { Range<T> union = new Range<T>( range.getElementClass(), (T) range.getMinValue(),
/** * Creates a new range using the same element class than this range. This method will * be overriden by subclasses in order to create a range of a more specific type. */ Range<T> create(final T minValue, final boolean isMinIncluded, final T maxValue, final boolean isMaxIncluded) { return new Range<T>(elementClass, minValue, isMinIncluded, maxValue, isMaxIncluded); }
} else { Expression expression = pb.getExpression(); Range<?> range = new Range(binding, (Comparable) min, (Comparable) max); addRange(rangeMap, expression, new MultiRange(range));
public ScaleRange(double min, boolean minIncluded, double max, boolean maxIncluded) { this.range = new Range<Double>(Double.class, min, minIncluded, max, maxIncluded); }
/** * Returns a new {@link Range} object initialized with the given values. * * @param lower The lower value, inclusive. * @param upper The upper value, inclusive. */ private Range<T> newRange(final T lower, final T upper) { if (isNumeric) { return new NumberRange(elementClass, lower, upper); } else { return new Range<T>(elementClass, lower, upper); } }
/** Add a metadata element to the FileGroup metadata map */ protected void addMetadaElement( String name, Comparable min, Comparable max, Map<String, Object> metadataMap) { if (Utils.TIME_DOMAIN.equalsIgnoreCase(name) || min instanceof Date) { metadataMap.put(name.toUpperCase(), new DateRange((Date) min, (Date) max)); } else if (Utils.ELEVATION_DOMAIN.equalsIgnoreCase(name) || min instanceof Number) { metadataMap.put( name.toUpperCase(), NumberRange.create( ((Number) min).doubleValue(), true, ((Number) max).doubleValue(), true)); } else { metadataMap.put(name, new Range(String.class, (String) min, (String) max)); } }
/** * Show only commits that lie within the specified time range. * * @param commitRange time range to show commits from * @return {@code this} */ public LogOp setTimeRange(final Range<Date> commitRange) { if (commitRange == null) { this.timeRange = ALWAYS; } else { this.timeRange = new Range<Long>(Long.class, commitRange.getMinValue().getTime(), commitRange.isMinIncluded(), commitRange.getMaxValue().getTime(), commitRange.isMaxIncluded()); } return this; }
/** * Show only commits that lie within the specified time range. * * @param commitRange time range to show commits from * @return {@code this} */ public LogOp setTimeRange(final Range<Date> commitRange) { if (commitRange == null) { this.timeRange = ALWAYS; } else { this.timeRange = new Range<Long>(Long.class, commitRange.getMinValue().getTime(), commitRange.isMinIncluded(), commitRange.getMaxValue().getTime(), commitRange.isMaxIncluded()); } return this; }
/** * Show only commits that lie within the specified time range. * * @param commitRange time range to show commits from * @return {@code this} */ public LogOp setTimeRange(final Range<Date> commitRange) { if (commitRange == null) { this.timeRange = ALWAYS; } else { this.timeRange = new Range<Long>(Long.class, commitRange.getMinValue().getTime(), commitRange.isMinIncluded(), commitRange.getMaxValue().getTime(), commitRange.isMaxIncluded()); } return this; }
@Override public Object getDefaultValue( ResourceInfo resource, String dimensionName, DimensionInfo dimension, Class clz) { if (value instanceof Range) { Range r = (Range) value; if (clz.isAssignableFrom(r.getElementClass())) { return r; } else { Comparable min = (Comparable) Converters.convert(r.getMinValue(), clz); Comparable max = (Comparable) Converters.convert(r.getMaxValue(), clz); return new Range(clz, min, max); } } else { return Converters.convert(this.value, clz); } }
Range<Date> commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp.setTimeRange(commitRange); commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp = geogig.command(LogOp.class).setTimeRange(commitRange);
Range<Date> commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp.setTimeRange(commitRange); commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp = geogig.command(LogOp.class).setTimeRange(commitRange);
Range<Date> commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp.setTimeRange(commitRange); commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp = geogit.command(LogOp.class).setTimeRange(commitRange);