ome.util.mem
Class CopiableArray

java.lang.Object
  extended by ome.util.mem.CopiableArray
All Implemented Interfaces:
Copiable

public abstract class CopiableArray
extends Object
implements Copiable

This abstract class provides an implementation of the Copiable interface. It constructs an array of Copiables , 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

Since:
OME2.2
Version:
2.2 (Internal version: $Revision: 1167 $ $Date: 2005/06/09 15:01:57 $)
Author:
Jean-Marie Burel      j.burel@dundee.ac.uk,
Andrea Falconi      a.falconi@dundee.ac.uk

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

CopiableArray

protected CopiableArray(int size)
Creates a new instance.

Parameters:
size - The size of the array.
Throws:
IllegalArgumentException - If the size is not strictly positive,
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 specified Copiable.

Parameters:
element - Copiable to set.
index - The position in the array.
Throws:
IllegalArgumentException - If the index is not valid.

get

public Copiable get(int index)
Return the Copiable at the specified position.

Parameters:
index - The position in the array.
Returns:
See above.
Throws:
IllegalArgumentException - If the index is not valid.

copy

public void copy(int from,
                 int to)
Copies the Copiable from the specified position from into the specified position to.

Parameters:
from - The starting position.
to - The ending position.
Throws:
IllegalArgumentException - If the indexes are not valid.

copy

public Object copy()
Implements the method as specified by Copiable.

Specified by:
copy in interface Copiable
Returns:
The new object.
See Also:
Copiable.copy()


OmeroJava Api

Version: Beta-4.2.0-r7571-b29

Copyright © 2009 The University of Dundee. All Rights Reserved.