private void addPeriod(Collection result, NumberRange<Double> newRange) { for (Iterator it = result.iterator(); it.hasNext(); ) { final Object element = it.next(); if (element instanceof Double) { // convert if (newRange.contains((Number) element)) { it.remove(); } } else { // convert final NumberRange<Double> local = (NumberRange<Double>) element; if (local.contains(newRange)) return; if (newRange.contains(local)) it.remove(); } } result.add(newRange); } }
if (range.contains((Number) o)) { result.add(o);
/** * Returns {@code true} if the specified value is within this range. * * @param value The value to check for inclusion. * @return {@code true} if the given value is withing this range. * @throws IllegalArgumentException if the given value is not comparable. */ public boolean contains(final Number value) throws IllegalArgumentException { if (value != null && !(value instanceof Comparable)) { throw new IllegalArgumentException( Errors.format(ErrorKeys.NOT_COMPARABLE_CLASS_$1, value.getClass())); } return contains((Comparable<?>) value); }
/** * Returns {@code true} if the specified value is within this range. */ //@Override public boolean contains(final Comparable value) { return contains((Number) value); }
/** * @see DomainElement1D#contains(Number) */ public boolean contains(Number value) { return range.contains(value); }
/** * @see DomainElement1D#contains(NumberRange) */ public boolean contains(NumberRange<? extends Number> range) { return this.range.contains(range); }
&& !verticalExtent.iterator().next().contains(requestedVerticalEnv)) {
/** * Returns {@code true} if the specified value is within this range. * * @param value The value to check for inclusion. * @return {@code true} if the given value is withing this range. * @throws IllegalArgumentException if the given value is not comparable. */ public boolean contains(final Number value) throws IllegalArgumentException { if (value != null && !(value instanceof Comparable)) { throw new IllegalArgumentException(Errors.format( ErrorKeys.NOT_COMPARABLE_CLASS_$1, value.getClass())); } return contains((Comparable<?>) value); }
@Override public void validate(Object target, Errors errors) { if (range != null && !range.isEmpty() && !range.contains((Number) target)) { errors.reject(CODE, "Value " + target + " is out of the valid range " + range); } }
if (range.contains(sliceNumber)) { return true; } else if (range.getMaxValue().compareTo(sliceNumber) < 0) {
&& !verticalExtent.iterator().next().contains(requestedVerticalEnv)) {
needScaling = !targetRange.contains(TypeMap.getRange(sourceType));
needScaling = !targetRange.contains(TypeMap.getRange(sourceType));
for (Object o : elevationDomain) { if (o instanceof Number) { intersectionFound |= requestedElevationRange.contains((Comparable<?>) o); } else if (o instanceof NumberRange) { intersectionFound |= requestedElevationRange.intersects((Range<?>) o);
@Test public void testReprojectedLayer() throws Exception { String layer = getLayerId(MockData.MPOLYGONS); String request = "wms?version=1.1.1&bbox=500525,500025,500575,500050&styles=&format=jpeg" + "&request=GetFeatureInfo&layers=" + layer + "&query_layers=" + layer + "&width=20&height=20&x=10&y=10" + "&info_format=" + JSONType.json; // JSON JSONObject json = (JSONObject) getAsJSON(request); JSONObject feature = (JSONObject) json.getJSONArray("features").get(0); JSONObject geom = feature.getJSONObject("geometry"); // unroll the geometry and get the first coordinate JSONArray coords = geom.getJSONArray("coordinates").getJSONArray(0).getJSONArray(0).getJSONArray(0); assertTrue( new NumberRange<Double>(Double.class, 500525d, 500575d) .contains((Number) coords.getDouble(0))); assertTrue( new NumberRange<Double>(Double.class, 500025d, 500050d) .contains((Number) coords.getDouble(1))); }