|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.array.WrapperArrayImpl
public class WrapperArrayImpl
Base class for NDArray-wrapping implementations of ArrayImpl. Instances of this class present an ArrayImpl interface based on an NDArray object; in a sense doing the reverse of what BridgeNDArray does. On its own this is not useful, but subclasses of this class can arrange to modify some of the method implementations to represent an array object with different qualities based on the wrapped NDArray. The resulting object can then be turned into a new NDArray by passing it to the BridgeNDArray constructor. In this way it is quite easy to produce a new NDArray from a base NDArray (typically with data generated on the fly from the accessor of the base), giving a virtual view of the base NDArray with modified properties such as shape or type. Doing it via an ArrayImpl rather than wrapping the NDArray directly makes the implementation much less effort; for instance tile read/write methods do not need to be implemented and guarantees about the validity of many method parameters can be assumed.
BridgeNDArray
Constructor Summary | |
---|---|
WrapperArrayImpl(NDArray nda)
|
Method Summary | |
---|---|
boolean |
canMap()
Indicates whether mapped access is available. |
void |
close()
Shuts down this ArrayImpl for pixel access. |
AccessImpl |
getAccess()
Returns an object which can access the pixels of this ArrayImpl. |
Number |
getBadValue()
The magic bad value for data. |
Object |
getMapped()
Returns a single primitive array holding all the pixel data of this array. |
OrderedNDShape |
getShape()
Returns an object representing the shape (origin and dimensions) and pixel sequence of this object. |
Type |
getType()
Returns the primitive type of the data held by this object. |
NDArray |
getWrapped()
Returns the NDArray which this Wrapper is wrapping. |
boolean |
isRandom()
Indicates whether random access is possible. |
boolean |
isReadable()
Indicates whether read access is possible. |
boolean |
isWritable()
Indicates whether write access is possible. |
boolean |
multipleAccess()
Indicates whether the getAccess method may be called more than once. |
void |
open()
Prepares this ArrayImpl for pixel access. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WrapperArrayImpl(NDArray nda)
Method Detail |
---|
public OrderedNDShape getShape()
ArrayImpl
getShape
in interface ArrayImpl
public Type getType()
ArrayImpl
getType
in interface ArrayImpl
public Number getBadValue()
ArrayImpl
getBadValue
in interface ArrayImpl
public boolean isReadable()
ArrayImpl
isReadable
in interface ArrayImpl
public boolean isWritable()
ArrayImpl
isWritable
in interface ArrayImpl
public boolean isRandom()
ArrayImpl
isRandom
in interface ArrayImpl
public boolean multipleAccess()
ArrayImpl
multipleAccess
in interface ArrayImpl
public void open()
ArrayImpl
open
in interface ArrayImpl
public boolean canMap()
ArrayImpl
Will only be called after an open call, and before any close call.
canMap
in interface ArrayImpl
public Object getMapped()
ArrayImpl
Will only be called if canMap returns true, and only after an open call and before any close call.
getMapped
in interface ArrayImpl
public AccessImpl getAccess() throws IOException
ArrayImpl
This method will only be called after the sole call to open and before the sole call to close.
This method will only be called more than once if the multipleAccess method returns true.
It is the responsibility of the caller to close the returned AccessImpl when it is no longer required; this enables resources it may hold to be released.
getAccess
in interface ArrayImpl
IOException
- if there is an IO errorpublic void close() throws IOException
ArrayImpl
close
in interface ArrayImpl
IOException
- if there is an IO errorpublic NDArray getWrapped()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |