1 package de.bwaldvogel.liblinear;
2
3
4 final class DoubleArrayPointer {
5
6 private final double[] _array;
7 private int _offset;
8
9
10 public void setOffset(int offset) {
11 if (offset < 0 || offset >= _array.length) throw new IllegalArgumentException("offset must be between 0 and the length of the array");
12 _offset = offset;
13 }
14
15 public DoubleArrayPointer( final double[] array, final int offset ) {
16 _array = array;
17 setOffset(offset);
18 }
19
20 public double get(final int index) {
21 return _array[_offset + index];
22 }
23
24 public void set(final int index, final double value) {
25 _array[_offset + index] = value;
26 }
27 }