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 aDomainMapper
which 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 aDomain1DMapper
from 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 protected
Domain1DMapper(HorizontalGrid sourceGrid, long targetDomainSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Integer
convertIndexToCoordType(int index)
This performs the conversion from a single long index into whatever coordinate type is required.static Domain1DMapper
forList(HorizontalGrid sourceGrid, Collection<HorizontalPosition> targetPositions)
Creates aDomain1DMapper
from aHorizontalGrid
source and aCollection
ofHorizontalPosition
s 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:DomainMapper
This 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 (seeDomain1DMapper
for this). TODO This currently takes an int. Do we want to support target domains which are bigger than Integer.MAX_VALUE?- Specified by:
convertIndexToCoordType
in 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 aDomain1DMapper
from aHorizontalGrid
source and aCollection
ofHorizontalPosition
s for the target- Parameters:
sourceGrid
- AHorizontalGrid
on which the source data is definedtargetPositions
- ACollection
ofHorizontalPosition
s defining the target domain.- Returns:
- A
Domain1DMapper
which performs the mapping
-
-