Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://angel.cs.msu.su/projects/system/toolsdoc/netcdf_java/ucar/multiarray/ConcreteIndexMap.html
Дата изменения: Tue Dec 28 20:59:06 2004 Дата индексирования: Sun Apr 10 00:18:04 2016 Кодировка: |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ucar.multiarray.ConcreteIndexMap
Base class which provides framework for implementations of IndexMap. This class contains two instances of the inner class ZZMap, which are used to implement the two transformations required by IndexMap.
This class also supports a functional composition framework via the link() initializer.
All methods except contructors are final. Specialization in subclasses occurs by subclassing the ZZMap inner class. Subclasses provide different ZZMaps during construction.
This specialization strategy results in an implementation oddity. When instances of a subclass of this are being constructed, this class's constructor (as super(...)) must complete before instances of the subclass inner class may be created. "Can't reference this before the superclass constructor has been called." So, rather that initializing the ZZMap members contained by this in the constructors, we provide init() and link() members functions. One or the other of these should be called by every subclass constructor.
Inner Class Summary | |
protected class |
ConcreteIndexMap.ZZMap
An Map of int by int key. |
Field Summary | |
protected ConcreteIndexMap.ZZMap |
iMap_
Supports the forward tranform. |
protected ConcreteIndexMap.ZZMap |
lengthsMap_
Supports the reverse tranform. |
Constructor Summary | |
protected |
ConcreteIndexMap()
Only constructor is protected. |
Method Summary | |
int[] |
getLengths(int[] output)
Reverse transform the lengths, placing the results in output. |
int |
getOutputLength()
Return the length needed for an output vector. |
int |
getRank()
Return the length of input vectors. |
int[] |
getTransformed(int[] output)
Transform the current input, placing the results in output. |
protected void |
init(ConcreteIndexMap.ZZMap iMap)
Called by subclass constructors to initialize. |
protected void |
init(ConcreteIndexMap.ZZMap iMap,
ConcreteIndexMap.ZZMap lengthsMap)
Called by subclass constructors to initialize. |
protected void |
link(ConcreteIndexMap prev,
ConcreteIndexMap.ZZMap iMap)
Called by subclass constructors to initialize. |
protected void |
link(ConcreteIndexMap prev,
ConcreteIndexMap.ZZMap iMap,
ConcreteIndexMap.ZZMap lengthsMap)
Called by subclass constructors to initialize. |
static void |
main(java.lang.String[] args)
|
void |
setInput(int[] input)
Rebind the domain of getTransformed() |
void |
setLengths(int[] lengths)
Initialize or reinitialize the IndexMap. |
java.lang.String |
toString()
|
int[] |
transform(int[] output,
int[] input)
Perform the forward transform. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected ConcreteIndexMap.ZZMap iMap_
protected ConcreteIndexMap.ZZMap lengthsMap_
Constructor Detail |
protected ConcreteIndexMap()
Method Detail |
protected final void init(ConcreteIndexMap.ZZMap iMap, ConcreteIndexMap.ZZMap lengthsMap)
iMap
- ZZMap defining the forward transform.lengthsMap
- ZZMap defining the reverse transform.protected final void init(ConcreteIndexMap.ZZMap iMap)
iMap
- ZZMap defining the forward transform.protected final void link(ConcreteIndexMap prev, ConcreteIndexMap.ZZMap iMap, ConcreteIndexMap.ZZMap lengthsMap)
prev
- ConcreteIndexMap this is composed with.iMap
- ZZMap defining the forward transform.lengthsMap
- ZZMap defining the reverse transform.protected final void link(ConcreteIndexMap prev, ConcreteIndexMap.ZZMap iMap)
prev
- ConcreteIndexMap this is composed with.iMap
- ZZMap defining the forward transform.public final int getOutputLength()
IndexMap
setInput()
.getOutputLength
in interface IndexMap
public final void setInput(int[] input)
IndexMap
getTransformed()
setInput
in interface IndexMap
ucar.multiarray.IndexMap
input
- int array domain reference member.public final int[] getTransformed(int[] output)
IndexMap
output.
- Specified by:
getTransformed
in interface IndexMap
- Following copied from interface:
ucar.multiarray.IndexMap
- Parameters:
output
- int array storage for the result.
The elements of output are usually
modified by this call.- Returns:
- output
public final int[] transform(int[] output, int[] input)
IndexMap
This function is equivalent to
setInput(input);
return getTransformed(output);
transform
in interface IndexMap
ucar.multiarray.IndexMap
output
- int array storage for the result.
The elements of output are usually
modified by this call.input
- int array which is the index to be transformed.- Returns:
- output
public final int getRank()
IndexMap
setLengths()
.getRank
in interface IndexMap
public final void setLengths(int[] lengths)
IndexMap
getLengths()
,
getRank()
.setLengths
in interface IndexMap
ucar.multiarray.IndexMap
lengths
- int array representing the shape on the forward
transform output.public final int[] getLengths(int[] output)
IndexMap
output.
Will throw an exception if called before setLengths()
.
- Specified by:
getLengths
in interface IndexMap
- Following copied from interface:
ucar.multiarray.IndexMap
- Parameters:
output
- int array storage for the result.
The elements of output are usually
modified by this call.- Returns:
- output
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |