View Javadoc

1   package liblinear;
2   
3   
4   final class IntArrayPointer {
5   
6       private final int[] _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 IntArrayPointer( final int[] array, final int offset ) {
16          _array = array;
17          setOffset(offset);
18      }
19  
20      public int get(final int index) {
21          return _array[_offset + index];
22      }
23  
24      public void set(final int index, final int value) {
25          _array[_offset + index] = value;
26      }
27  }