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.longs.LongArrayList;
21
22
23
24
25 public final class OctaveLong
26 extends AbstractGenericMatrix<long[], LongArrayList> {
27
28
29
30
31
32
33
34 public OctaveLong(final int... size) {
35 super(size);
36 }
37
38
39
40
41
42
43
44
45 public OctaveLong(final long[] data, final int... size) {
46 super(data, size);
47 }
48
49
50
51
52
53
54
55 public OctaveLongctaveLong.html#OctaveLong">OctaveLong(final OctaveLong o) {
56 super(o);
57 }
58
59
60
61 protected final LongArrayList newL(final int size) {
62 LongArrayList list = new LongArrayList(size);
63 list.size(size);
64 return list;
65 }
66
67 protected final int initL(long[] data, final int size) {
68 this.dataL = new LongArrayList(data);
69 this.dataL.size(size);
70 return data.length;
71 }
72
73 protected long[] getDataA() {
74 return this.dataL.elements();
75 }
76
77
78
79
80
81
82
83
84 public final void set(final long value, final int... pos) {
85 resizeUp(pos);
86 setPlain(value, pos2ind(pos));
87 }
88
89
90
91
92
93
94
95
96 public final void setPlain(final long value, final int pos) {
97 this.dataL.set(pos, value);
98 }
99
100
101 public final void setPlain(final String value, final int pos) {
102 this.dataL.set(pos, Long.parseLong(value.trim()));
103 }
104
105
106
107
108
109
110
111 public final long get(final int... pos) {
112 return this.dataL.getLong(pos2ind(pos));
113 }
114
115
116 public final String getPlainString(int pos) {
117 return Long.toString(this.dataL.getLong(pos));
118 }
119
120
121
122 @Override
123 public OctaveLong shallowCopy() {
124 return new OctaveLong(this);
125 }
126
127 }