01: /****************************************************************************
02: * N I C E *
03: * A high-level object-oriented research language *
04: * (c) Daniel Bonniot 2004 *
05: * *
06: * This package is free software; you can redistribute it and/or modify *
07: * it under the terms of the GNU General Public License as published by *
08: * Free Software Foundation; either version 2 of the License, or (at your *
09: * option) any later version. *
10: * *
11: * As a special exception, the copyright holders of this library give you *
12: * permission to link this library with independent modules to produce an *
13: * executable, regardless of the license terms of these independent *
14: * modules, and to copy and distribute the resulting executable under *
15: * terms of your choice. *
16: ****************************************************************************/package nice.lang;
17:
18: /**
19: Class used to wrap native double arrays when considered as part of the
20: collection hierarchy.
21: */
22: public final class rawDoubleArray extends rawArray {
23: rawDoubleArray(double[] arr) {
24: super (arr);
25: this .arr = arr;
26: }
27:
28: private final double[] arr;
29:
30: /****************************************************************
31: * Implementation of java.util.List
32: ****************************************************************/
33:
34: public final int size() {
35: return arr.length;
36: }
37:
38: public final Object get(int index) {
39: return new Double(arr[index]);
40: }
41:
42: public final Object set(int index, Object element) {
43: double old = arr[index];
44: arr[index] = ((Number) element).doubleValue();
45: return new Double(old);
46: }
47:
48: }
|