public abstract class CopiableArray extends Object implements Copiable
Copiable
interface. It constructs an array of Copiable
s , note that all
subclasses must implement the makeNew(int)
method. It provides
methods to manipulate elements of the array set(Copiable, int)
and
get(int)
. It also implements a copy(int, int)
method which
allows to copy an element from a specified position in the array into a new
specified position. Subclasses inherit the copy()
methodModifier | Constructor and Description |
---|---|
protected |
CopiableArray(int size)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
copy()
Implements the method as specified by
Copiable . |
void |
copy(int from,
int to)
|
Copiable |
get(int index)
Return the
Copiable at the specified position. |
int |
getSize()
Returns the number of elements in the array.
|
protected abstract CopiableArray |
makeNew(int size)
Creates a new array of the speficied size.
|
void |
set(Copiable element,
int index)
Replaces the element at the specified position with the specified
Copiable . |
protected CopiableArray(int size)
size
- The size of the array.IllegalArgumentException
- If the size is not strictly positive,protected abstract CopiableArray makeNew(int size)
size
- The size of the array.public int getSize()
public void set(Copiable element, int index)
Copiable
.element
- Copiable to set.index
- The position in the array.IllegalArgumentException
- If the index is not valid.public Copiable get(int index)
Copiable
at the specified position.index
- The position in the array.IllegalArgumentException
- If the index is not valid.public void copy(int from, int to)
from
- The starting position.to
- The ending position.IllegalArgumentException
- If the indexes are not valid.public Object copy()
Copiable
.copy
in interface Copiable
Copiable.copy()
Version: 5.2.0-ice35-b12
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.