blob: ac138c60b11cb97e47fce61aeff5afdc9be2e4e4 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
2 * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org)
3 */
4
5package org.onosproject.xran.codecs.pdu;
6
7import org.onosproject.xran.codecs.api.ECGI;
8import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
9import org.openmuc.jasn1.ber.BerLength;
10import org.openmuc.jasn1.ber.BerTag;
11import org.openmuc.jasn1.ber.types.BerInteger;
12
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.Serializable;
16import java.util.ArrayList;
17import java.util.Iterator;
18import java.util.List;
19
20
21public class RadioMeasReportPerCell implements Serializable {
22
23 private static final long serialVersionUID = 1L;
24
25 public static class PuschIntfPowerHist implements Serializable {
26
27 private static final long serialVersionUID = 1L;
28
29 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
30 public byte[] code = null;
31 private List<BerInteger> seqOf = null;
32
33 public PuschIntfPowerHist() {
34 seqOf = new ArrayList<BerInteger>();
35 }
36
37 public PuschIntfPowerHist(byte[] code) {
38 this.code = code;
39 }
40
41 public List<BerInteger> getBerInteger() {
42 if (seqOf == null) {
43 seqOf = new ArrayList<BerInteger>();
44 }
45 return seqOf;
46 }
47
48 public void setBerInteger(BerInteger berInteger) {
49 seqOf.add(berInteger);
50 }
51
52 public int encode(BerByteArrayOutputStream os) throws IOException {
53 return encode(os, true);
54 }
55
56 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
57
58 if (code != null) {
59 for (int i = code.length - 1; i >= 0; i--) {
60 os.write(code[i]);
61 }
62 if (withTag) {
63 return tag.encode(os) + code.length;
64 }
65 return code.length;
66 }
67
68 int codeLength = 0;
69 for (int i = (seqOf.size() - 1); i >= 0; i--) {
70 codeLength += seqOf.get(i).encode(os, true);
71 }
72
73 codeLength += BerLength.encodeLength(os, codeLength);
74
75 if (withTag) {
76 codeLength += tag.encode(os);
77 }
78
79 return codeLength;
80 }
81
82 public int decode(InputStream is) throws IOException {
83 return decode(is, true);
84 }
85
86 public int decode(InputStream is, boolean withTag) throws IOException {
87 int codeLength = 0;
88 int subCodeLength = 0;
89 if (withTag) {
90 codeLength += tag.decodeAndCheck(is);
91 }
92
93 BerLength length = new BerLength();
94 codeLength += length.decode(is);
95 int totalLength = length.val;
96
97 while (subCodeLength < totalLength) {
98 BerInteger element = new BerInteger();
99 subCodeLength += element.decode(is, true);
100 seqOf.add(element);
101 }
102 if (subCodeLength != totalLength) {
103 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
104
105 }
106 codeLength += subCodeLength;
107
108 return codeLength;
109 }
110
111 public void encodeAndSave(int encodingSizeGuess) throws IOException {
112 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
113 encode(os, false);
114 code = os.getArray();
115 }
116
117 public String toString() {
118 StringBuilder sb = new StringBuilder();
119 appendAsString(sb, 0);
120 return sb.toString();
121 }
122
123 public void appendAsString(StringBuilder sb, int indentLevel) {
124
125 sb.append("[\n");
126 for (int i = 0; i < indentLevel + 1; i++) {
127 sb.append("\t");
128 }
129 if (seqOf == null) {
130// sb.append("null");
131 }
132 else {
133 Iterator<BerInteger> it = seqOf.iterator();
134 if (it.hasNext()) {
135 sb.append(it.next());
136 while (it.hasNext()) {
137 sb.append(",\n");
138 for (int i = 0; i < indentLevel + 1; i++) {
139 sb.append("\t");
140 }
141 sb.append(it.next());
142 }
143 }
144 }
145
146 sb.append("\n");
147 for (int i = 0; i < indentLevel; i++) {
148 sb.append("\t");
149 }
150 sb.append("]");
151 }
152
153 }
154
155 public static class PucchIntfPowerHist implements Serializable {
156
157 private static final long serialVersionUID = 1L;
158
159 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
160 public byte[] code = null;
161 private List<BerInteger> seqOf = null;
162
163 public PucchIntfPowerHist() {
164 seqOf = new ArrayList<BerInteger>();
165 }
166
167 public PucchIntfPowerHist(byte[] code) {
168 this.code = code;
169 }
170
171 public List<BerInteger> getBerInteger() {
172 if (seqOf == null) {
173 seqOf = new ArrayList<BerInteger>();
174 }
175 return seqOf;
176 }
177
178 public int encode(BerByteArrayOutputStream os) throws IOException {
179 return encode(os, true);
180 }
181
182 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
183
184 if (code != null) {
185 for (int i = code.length - 1; i >= 0; i--) {
186 os.write(code[i]);
187 }
188 if (withTag) {
189 return tag.encode(os) + code.length;
190 }
191 return code.length;
192 }
193
194 int codeLength = 0;
195 for (int i = (seqOf.size() - 1); i >= 0; i--) {
196 codeLength += seqOf.get(i).encode(os, true);
197 }
198
199 codeLength += BerLength.encodeLength(os, codeLength);
200
201 if (withTag) {
202 codeLength += tag.encode(os);
203 }
204
205 return codeLength;
206 }
207
208 public int decode(InputStream is) throws IOException {
209 return decode(is, true);
210 }
211
212 public int decode(InputStream is, boolean withTag) throws IOException {
213 int codeLength = 0;
214 int subCodeLength = 0;
215 if (withTag) {
216 codeLength += tag.decodeAndCheck(is);
217 }
218
219 BerLength length = new BerLength();
220 codeLength += length.decode(is);
221 int totalLength = length.val;
222
223 while (subCodeLength < totalLength) {
224 BerInteger element = new BerInteger();
225 subCodeLength += element.decode(is, true);
226 seqOf.add(element);
227 }
228 if (subCodeLength != totalLength) {
229 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
230
231 }
232 codeLength += subCodeLength;
233
234 return codeLength;
235 }
236
237 public void encodeAndSave(int encodingSizeGuess) throws IOException {
238 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
239 encode(os, false);
240 code = os.getArray();
241 }
242
243 public String toString() {
244 StringBuilder sb = new StringBuilder();
245 appendAsString(sb, 0);
246 return sb.toString();
247 }
248
249 public void appendAsString(StringBuilder sb, int indentLevel) {
250
251 sb.append("[\n");
252 for (int i = 0; i < indentLevel + 1; i++) {
253 sb.append("\t");
254 }
255 if (seqOf == null) {
256// sb.append("null");
257 }
258 else {
259 Iterator<BerInteger> it = seqOf.iterator();
260 if (it.hasNext()) {
261 sb.append(it.next());
262 while (it.hasNext()) {
263 sb.append(",\n");
264 for (int i = 0; i < indentLevel + 1; i++) {
265 sb.append("\t");
266 }
267 sb.append(it.next());
268 }
269 }
270 }
271
272 sb.append("\n");
273 for (int i = 0; i < indentLevel; i++) {
274 sb.append("\t");
275 }
276 sb.append("]");
277 }
278
279 public void setBerInteger(BerInteger berInteger) {
280 seqOf.add(berInteger);
281 }
282 }
283
284 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
285
286 public byte[] code = null;
287 private ECGI ecgi = null;
288 private PuschIntfPowerHist puschIntfPowerHist = null;
289 private PucchIntfPowerHist pucchIntfPowerHist = null;
290
291 public RadioMeasReportPerCell() {
292 }
293
294 public RadioMeasReportPerCell(byte[] code) {
295 this.code = code;
296 }
297
298 public void setEcgi(ECGI ecgi) {
299 this.ecgi = ecgi;
300 }
301
302 public ECGI getEcgi() {
303 return ecgi;
304 }
305
306 public void setPuschIntfPowerHist(PuschIntfPowerHist puschIntfPowerHist) {
307 this.puschIntfPowerHist = puschIntfPowerHist;
308 }
309
310 public PuschIntfPowerHist getPuschIntfPowerHist() {
311 return puschIntfPowerHist;
312 }
313
314 public void setPucchIntfPowerHist(PucchIntfPowerHist pucchIntfPowerHist) {
315 this.pucchIntfPowerHist = pucchIntfPowerHist;
316 }
317
318 public PucchIntfPowerHist getPucchIntfPowerHist() {
319 return pucchIntfPowerHist;
320 }
321
322 public int encode(BerByteArrayOutputStream os) throws IOException {
323 return encode(os, true);
324 }
325
326 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
327
328 if (code != null) {
329 for (int i = code.length - 1; i >= 0; i--) {
330 os.write(code[i]);
331 }
332 if (withTag) {
333 return tag.encode(os) + code.length;
334 }
335 return code.length;
336 }
337
338 int codeLength = 0;
339 codeLength += pucchIntfPowerHist.encode(os, false);
340 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
341 os.write(0xA2);
342 codeLength += 1;
343
344 codeLength += puschIntfPowerHist.encode(os, false);
345 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
346 os.write(0xA1);
347 codeLength += 1;
348
349 codeLength += ecgi.encode(os, false);
350 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
351 os.write(0xA0);
352 codeLength += 1;
353
354 codeLength += BerLength.encodeLength(os, codeLength);
355
356 if (withTag) {
357 codeLength += tag.encode(os);
358 }
359
360 return codeLength;
361
362 }
363
364 public int decode(InputStream is) throws IOException {
365 return decode(is, true);
366 }
367
368 public int decode(InputStream is, boolean withTag) throws IOException {
369 int codeLength = 0;
370 int subCodeLength = 0;
371 BerTag berTag = new BerTag();
372
373 if (withTag) {
374 codeLength += tag.decodeAndCheck(is);
375 }
376
377 BerLength length = new BerLength();
378 codeLength += length.decode(is);
379
380 int totalLength = length.val;
381 codeLength += totalLength;
382
383 subCodeLength += berTag.decode(is);
384 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
385 ecgi = new ECGI();
386 subCodeLength += ecgi.decode(is, false);
387 subCodeLength += berTag.decode(is);
388 }
389 else {
390 throw new IOException("Tag does not match the mandatory sequence element tag.");
391 }
392
393 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
394 puschIntfPowerHist = new PuschIntfPowerHist();
395 subCodeLength += puschIntfPowerHist.decode(is, false);
396 subCodeLength += berTag.decode(is);
397 }
398 else {
399 throw new IOException("Tag does not match the mandatory sequence element tag.");
400 }
401
402 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
403 pucchIntfPowerHist = new PucchIntfPowerHist();
404 subCodeLength += pucchIntfPowerHist.decode(is, false);
405 if (subCodeLength == totalLength) {
406 return codeLength;
407 }
408 }
409 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
410
411
412 }
413
414 public void encodeAndSave(int encodingSizeGuess) throws IOException {
415 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
416 encode(os, false);
417 code = os.getArray();
418 }
419
420 public String toString() {
421 StringBuilder sb = new StringBuilder();
422 appendAsString(sb, 0);
423 return sb.toString();
424 }
425
426 public void appendAsString(StringBuilder sb, int indentLevel) {
427
428 sb.append("{");
429 sb.append("\n");
430 for (int i = 0; i < indentLevel + 1; i++) {
431 sb.append("\t");
432 }
433 if (ecgi != null) {
434 sb.append("\"ecgi\": ");
435 ecgi.appendAsString(sb, indentLevel + 1);
436 }
437
438 sb.append(",\n");
439 for (int i = 0; i < indentLevel + 1; i++) {
440 sb.append("\t");
441 }
442 if (puschIntfPowerHist != null) {
443 sb.append("\"puschIntfPowerHist\": ");
444 puschIntfPowerHist.appendAsString(sb, indentLevel + 1);
445 }
446
447 sb.append(",\n");
448 for (int i = 0; i < indentLevel + 1; i++) {
449 sb.append("\t");
450 }
451 if (pucchIntfPowerHist != null) {
452 sb.append("\"pucchIntfPowerHist\": ");
453 pucchIntfPowerHist.appendAsString(sb, indentLevel + 1);
454 }
455
456 sb.append("\n");
457 for (int i = 0; i < indentLevel; i++) {
458 sb.append("\t");
459 }
460 sb.append("}");
461 }
462
463}
464