Package ome.util.mem
Class CopiableArray
- java.lang.Object
-
- ome.util.mem.CopiableArray
-
- All Implemented Interfaces:
Copiable
public abstract class CopiableArray extends java.lang.Object implements Copiable
This abstract class provides an implementation of theCopiableinterface. It constructs an array ofCopiables , note that all subclasses must implement themakeNew(int)method. It provides methods to manipulate elements of the arrayset(Copiable, int)andget(int). It also implements acopy(int, int)method which allows to copy an element from a specified position in the array into a new specified position. Subclasses inherit thecopy()method- Since:
- OME2.2
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCopiableArray(int size)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcopy()Implements the method as specified byCopiable.voidcopy(int from, int to)Copiableget(int index)Return theCopiableat the specified position.intgetSize()Returns the number of elements in the array.protected abstract CopiableArraymakeNew(int size)Creates a new array of the speficied size.voidset(Copiable element, int index)Replaces the element at the specified position with the specifiedCopiable.
-
-
-
Method Detail
-
makeNew
protected abstract CopiableArray makeNew(int size)
Creates a new array of the speficied size.- Parameters:
size- The size of the array.- Returns:
- See above.
-
getSize
public int getSize()
Returns the number of elements in the array.- Returns:
- See above.
-
set
public void set(Copiable element, int index)
Replaces the element at the specified position with the specifiedCopiable.- Parameters:
element- Copiable to set.index- The position in the array.- Throws:
java.lang.IllegalArgumentException- If the index is not valid.
-
get
public Copiable get(int index)
Return theCopiableat the specified position.- Parameters:
index- The position in the array.- Returns:
- See above.
- Throws:
java.lang.IllegalArgumentException- If the index is not valid.
-
copy
public void copy(int from, int to)- Parameters:
from- The starting position.to- The ending position.- Throws:
java.lang.IllegalArgumentException- If the indexes are not valid.
-
copy
public java.lang.Object copy()
Implements the method as specified byCopiable.- Specified by:
copyin interfaceCopiable- Returns:
- The new object.
- See Also:
Copiable.copy()
-
-