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