Package uk.ac.rdg.resc.edal.dataset
Class Domain1DMapper
- java.lang.Object
-
- uk.ac.rdg.resc.edal.dataset.DomainMapper<Integer>
-
- uk.ac.rdg.resc.edal.dataset.Domain1DMapper
-
- All Implemented Interfaces:
Iterable<DomainMapper.DomainMapperEntry<Integer>>
public class Domain1DMapper extends DomainMapper<Integer>
This is an implementation of aDomainMapperwhich maps 2D indices from a source grid onto a single integer in the target domain. It also includes a static methodforList(HorizontalGrid, Collection)which generates aDomain1DMapperfrom a source grid and a list of target positions.- Author:
- Guy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
DomainMapper.DomainMapperEntry<P>, DomainMapper.Scanline<P>
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
log
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDomain1DMapper(HorizontalGrid sourceGrid, long targetDomainSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IntegerconvertIndexToCoordType(int index)This performs the conversion from a single long index into whatever coordinate type is required.static Domain1DMapperforList(HorizontalGrid sourceGrid, Collection<HorizontalPosition> targetPositions)Creates aDomain1DMapperfrom aHorizontalGridsource and aCollectionofHorizontalPositions for the target-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
equals, getBoundingBoxSize, getMaxIIndex, getMaxJIndex, getMinIIndex, getMinJIndex, getNumUniqueIJPairs, getTargetDomainSize, hashCode, isEmpty, iterator, put, scanlineIterator, sortIndices
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Domain1DMapper
protected Domain1DMapper(HorizontalGrid sourceGrid, long targetDomainSize)
-
-
Method Detail
-
convertIndexToCoordType
protected Integer convertIndexToCoordType(int index)
Description copied from class:DomainMapperThis performs the conversion from a single long index into whatever coordinate type is required. The simplest example would be to simply return the index for a 1D array (seeDomain1DMapperfor this). TODO This currently takes an int. Do we want to support target domains which are bigger than Integer.MAX_VALUE?- Specified by:
convertIndexToCoordTypein classDomainMapper<Integer>- Parameters:
index- The index to convert to a co-ordinate- Returns:
- The co-ordinate represented by the index
-
forList
public static Domain1DMapper forList(HorizontalGrid sourceGrid, Collection<HorizontalPosition> targetPositions)
Creates aDomain1DMapperfrom aHorizontalGridsource and aCollectionofHorizontalPositions for the target- Parameters:
sourceGrid- AHorizontalGridon which the source data is definedtargetPositions- ACollectionofHorizontalPositions defining the target domain.- Returns:
- A
Domain1DMapperwhich performs the mapping
-
-