KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > element > ArrayStore


1 package jfun.yan.element;
2
3 /**
4  * This class stores component instances into an Object[] array.
5  * <p>
6  * @author Ben Yu
7  * Nov 12, 2005 2:19:48 PM
8  */

9 public class ArrayStore<T> extends AnyArrayStore<T> {
10   private T[] arr;
11   /**
12    * Get the array object to store the component instances.
13    */

14   public T[] getArray() {
15     return arr;
16   }
17   /**
18    * To create an ArrayStore object.
19    * @param arr the array object
20    * @param begin the begin index of the array.
21    * Elements are stored from this index.
22    * @param end the non-inclusive end index.
23    * Elements cannot be stored at or after this index.
24    */

25   public ArrayStore(T[] arr, int begin, int end) {
26     super(arr, begin, end);
27     this.arr = arr;
28   }
29   /**
30    * To create an ArrayStore object.
31    * @param arr the array object
32    * @param begin the begin index of the array.
33    * Elements are stored from this index.
34    */

35   public ArrayStore(T[] arr, int begin){
36     super(arr, begin);
37     this.arr = arr;
38   }
39   /**
40    * To create an ArrayStore object.
41    * @param arr the array object.
42    */

43   public ArrayStore(T[] arr){
44     super(arr);
45     this.arr = arr;
46   }
47   public void storeElement(int ind, T obj) {
48     arr[getIndex(ind)] = obj;
49   }
50 }
51
Popular Tags