1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package eu.simuline.octave.type;
17
18 import eu.simuline.octave.type.matrix.AbstractGenericMatrix;
19
20 import it.unimi.dsi.fastutil.ints.IntArrayList;
21
22
23
24
25 public final class OctaveInt
26 extends AbstractGenericMatrix<int[], IntArrayList> {
27
28
29
30
31
32
33
34 public OctaveInt(final int... size) {
35 super(size);
36 }
37
38
39
40
41
42
43
44
45 public OctaveInt(final int[] data, final int... size) {
46 super(data, size);
47 }
48
49
50
51
52
53
54 protected OctaveIntOctaveInt.html#OctaveInt">OctaveInt(final OctaveInt o) {
55 super(o);
56 }
57
58 protected final IntArrayList newL(final int size) {
59 IntArrayList list = new IntArrayList(size);
60 list.size(size);
61 return list;
62 }
63
64 protected final int initL(int[] data, final int size) {
65 this.dataL = new IntArrayList(data);
66 this.dataL.size(size);
67 return data.length;
68 }
69
70 protected int[] getDataA() {
71 return this.dataL.elements();
72 }
73
74
75
76
77
78
79
80
81 public final void set(final int value, final int... pos) {
82 resizeUp(pos);
83 setPlain(value, pos2ind(pos));
84 }
85
86
87
88
89
90
91
92
93 public final void setPlain(final int value, final int pos) {
94 this.dataL.set(pos, value);
95 }
96
97
98 public final void setPlain(final String value, final int pos) {
99 this.dataL.set(pos, Integer.parseInt(value.trim()));
100 }
101
102
103
104
105
106
107
108 public final int get(final int... pos) {
109 return this.dataL.getInt(pos2ind(pos));
110 }
111
112 public final String getPlainString(int pos) {
113 return Integer.toString(this.dataL.getInt(pos));
114 }
115
116
117 @Override
118 public OctaveInt shallowCopy() {
119 return new OctaveInt(this);
120 }
121
122 }