Interval<?, ?> origInter = it.next(); if ( origInter != null ) { Interval<?, ?> converted = Interval.createFromStrings( type, origInter.getMin().value.toString(), origInter.getMax().value.toString(), origInter.getClosure(), origInter.getSemantic(), origInter.isAtomic(), origInter.getSpacing() ); if ( converted != null ) { convertedIntervals.add( converted );
/** * @param otherIntervals * @param convert * if true the given intervals will be converted to the type they match if they were of type void. * @return true if the given intervals match this intervals. */ private boolean checkIntervals( List<Interval<?, ?>> otherIntervals ) { boolean result = false; if ( intervals == null || intervals.isEmpty() ) { // if this axissubset has no intervals, than they match return true; } for ( Interval<?, ?> inter : intervals ) { if ( inter != null ) { Iterator<Interval<?, ?>> iterator = otherIntervals.iterator(); while ( iterator.hasNext() && !result ) { Interval<?, ?> oi = iterator.next(); result = inter.isInBounds( oi ); } if ( !result ) { // could not find a single value matching. break; } } } return result; }
/** * @param writer * @param interval * @throws XMLStreamException */ protected static void exportInterval( XMLStreamWriter writer, Interval<?, ?> interval ) throws XMLStreamException { if ( interval != null ) { writer.writeStartElement( WCS_100_NS, "interval" ); writer.writeNamespace( WCS_100_PRE, WCS_100_NS ); if ( interval.getSemantic() != null ) { writer.writeAttribute( WCS_100_PRE, WCS_100_NS, "semantic", interval.getSemantic() ); } writer.writeAttribute( "atomic", interval.isAtomic() ? "true" : "false" ); Closure closure = interval.getClosure(); writer.writeAttribute( WCS_100_PRE, WCS_100_NS, "closure", closure.name().replaceAll( "_", "-" ) ); exportSingleValueType( writer, interval.getMin(), "min" ); exportSingleValueType( writer, interval.getMax(), "max" ); exportSingleValueType( writer, interval.getSpacing(), "res" ); writer.writeEndElement();// WCS_100_NS, "interval" ); } }
max = iv.max.toString(); intervals.add( new Interval<String, String>( new SingleValue<String>( Void, min ), new SingleValue<String>( Void, max ), open, null, false, null ) ); } else {
/** * @param inters * @return */ private ValueType determineType( List<Interval<?, ?>> inters ) { ValueType result = null; if ( inters != null && !inters.isEmpty() ) { Iterator<Interval<?, ?>> it = intervals.iterator(); while ( it.hasNext() && result == null ) { Interval<?, ?> interval = it.next(); if ( interval != null ) { result = interval.getMin().type; } } } return result; }
/** * Get the interval defined by the given String. * * @param interval * @return */ private static Interval<?, ?> parseInterval( String interval, ValueType type ) { Interval<?, ?> result = null; String[] split = interval.split( "/" ); if ( split.length == 2 || split.length == 3 ) { // should be min/max/res String min = split[0]; String max = split[1]; String res = null; if ( split.length == 3 ) { res = split[2]; } SingleValue<?> spacing = res == null ? null : SingleValue.createFromString( ValueType.Void.name(), res ); result = Interval.createFromStrings( type.toString(), min, max, Closure.closed, null, false, spacing ); } else { LOG.warn( "Given intervall: " + interval + " has not enough values, maybe a default value is ment?" ); } return result; }
short smin = Short.valueOf( min ); short smax = Short.valueOf( max ); result = new Interval<Short, RS>( new SingleValue<Short>( determined, smin ), new SingleValue<Short>( determined, smax ), closure, semantic, atomic, resolution ); int imin = Integer.valueOf( min ); int imax = Integer.valueOf( max ); result = new Interval<Integer, RS>( new SingleValue<Integer>( determined, imin ), new SingleValue<Integer>( determined, imax ), closure, semantic, atomic, resolution ); long lmin = Long.valueOf( min ); long lmax = Long.valueOf( max ); result = new Interval<Long, RS>( new SingleValue<Long>( determined, lmin ), new SingleValue<Long>( determined, lmax ), closure, semantic, atomic, resolution ); Double dmin = Double.valueOf( min ); Double dmax = Double.valueOf( max ); result = new Interval<Double, RS>( new SingleValue<Double>( determined, dmin ), new SingleValue<Double>( determined, dmax ), closure, semantic, atomic, resolution ); Float fmin = Float.valueOf( min ); Float fmax = Float.valueOf( max ); result = new Interval<Float, RS>( new SingleValue<Float>( determined, fmin ), new SingleValue<Float>( determined, fmax ), closure, semantic, atomic, resolution );
SingleValue<?> max = mapTT( it.getMax() ); Closure closure = Closure.fromString( it.getClosure().get( 0 ) ); intervals.add( new Interval( min, max, closure, null, false, null ) );
SingleValue<?> min = tmpInter.getMin(); if ( min.type != sv.type ) { if ( min.type == ValueType.Void ) { tmpInter = Interval.createFromStrings( sv.type.toString(), tmpInter.getMin().value.toString(), tmpInter.getMax().value.toString(), tmpInter.getClosure(), tmpInter.getSemantic(), tmpInter.isAtomic(), tmpInter.getSpacing() ); } else if ( sv.type == ValueType.Void ) { sv = SingleValue.createFromString( min.type.toString(), sv.value.toString() ); result = tmpInter.liesWithin( sv.value );
switch ( rasterDataInfo.dataType ) { case BYTE: interval = new Interval<Short, String>( new SingleValue<Short>( ValueType.Byte, (short) 0 ), new SingleValue<Short>( ValueType.Byte, (short) 255 ), Interval.Closure.open, semantic, false, null ); case SHORT: case USHORT: interval = new Interval<Short, String>( new SingleValue<Short>( ValueType.Short, Short.MIN_VALUE ), new SingleValue<Short>( ValueType.Short, Short.MAX_VALUE ), Interval.Closure.open, semantic, false, null ); break; case INT: interval = new Interval<Integer, String>( new SingleValue<Integer>( ValueType.Integer, Integer.MIN_VALUE ), new SingleValue<Integer>( ValueType.Integer, break; case FLOAT: interval = new Interval<Float, String>( new SingleValue<Float>( ValueType.Float, Float.MIN_VALUE ), new SingleValue<Float>( ValueType.Float, Float.MAX_VALUE ), Interval.Closure.open, semantic, false, null ); break; case DOUBLE: interval = new Interval<Double, String>( new SingleValue<Double>( ValueType.Double, Double.MIN_VALUE ), new SingleValue<Double>( ValueType.Double, break;
intervals.add( new Interval( min, max, closure, semantic, atomic, spacing ) ); } else if ( "singleValue".equals( localName ) ) { SingleValue<?> single = parseTypedLiteral( rangeElem );