|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.util.mem.CopiableArray
public abstract class CopiableArray
This abstract class provides an implementation of the 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()
method
Constructor Summary | |
---|---|
protected |
CopiableArray(int size)
Creates a new instance. |
Method Summary | |
---|---|
Object |
copy()
Implements the method as specified by Copiable . |
void |
copy(int from,
int to)
Copies the Copiable from the specified position from
into the specified position 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 . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CopiableArray(int size)
size
- The size of the array.
IllegalArgumentException
- If the size is not strictly positive,Method Detail |
---|
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)
Copiable
from the specified position from
into the specified position 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: Beta4.2.1-r8614-Beta4.2-b41
Copyright © 2009 The University of Dundee. All Rights Reserved.