blob: 896461ad9ec9131c0a6b39842b2ec3dec1f4af4c [file] [log] [blame]
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08001/**
2 * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org)
3 */
4
5package org.onosproject.xran.asn1lib.pdu;
6
7import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
9import org.onosproject.xran.asn1lib.api.*;
10import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
11import org.onosproject.xran.asn1lib.ber.BerLength;
12import org.onosproject.xran.asn1lib.ber.BerTag;
13import org.onosproject.xran.asn1lib.ber.types.BerBitString;
14import org.onosproject.xran.asn1lib.ber.types.BerBoolean;
15import org.onosproject.xran.asn1lib.ber.types.BerInteger;
16
17import java.io.IOException;
18import java.io.InputStream;
19import java.io.Serializable;
20import java.util.ArrayList;
21import java.util.Iterator;
22import java.util.List;
23
24public class CellConfigReport implements Serializable {
25
26 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
27 private static final long serialVersionUID = 1L;
28 @JsonIgnore
29 public byte[] code = null;
30 private ECGI ecgi = null;
31 private PhysCellId pci = null;
32 private CandScells candScells = null;
33 private ARFCNValue earfcnDl = null;
34 private ARFCNValue earfcnUl = null;
35 private BerInteger rbsPerTtiDl = null;
36 private BerInteger rbsPerTtiUl = null;
37 private BerInteger numTxAntenna = null;
38 private DuplexMode duplexMode = null;
39 private BerInteger tddConfig = null;
40 private BerInteger tddSplSfConfig = null;
41 private BerInteger maxNumConnectedUes = null;
42 private BerInteger maxNumConnectedBearers = null;
43 private BerInteger maxNumUesSchedPerTtiDl = null;
44 private BerInteger maxNumUesSchedPerTtiUl = null;
45 private BerBoolean dlfsSchedEnable = null;
46 private BerBitString featureSupportList = null;
47 public CellConfigReport() {
48 }
49
50 public CellConfigReport(byte[] code) {
51 this.code = code;
52 }
53
54 public ECGI getEcgi() {
55 return ecgi;
56 }
57
58 public void setEcgi(ECGI ecgi) {
59 this.ecgi = ecgi;
60 }
61
62 public PhysCellId getPci() {
63 return pci;
64 }
65
66 public void setPci(PhysCellId pci) {
67 this.pci = pci;
68 }
69
70 public CandScells getCandScells() {
71 return candScells;
72 }
73
74 public void setCandScells(CandScells candScells) {
75 this.candScells = candScells;
76 }
77
78 public ARFCNValue getEarfcnDl() {
79 return earfcnDl;
80 }
81
82 public void setEarfcnDl(ARFCNValue earfcnDl) {
83 this.earfcnDl = earfcnDl;
84 }
85
86 public ARFCNValue getEarfcnUl() {
87 return earfcnUl;
88 }
89
90 public void setEarfcnUl(ARFCNValue earfcnUl) {
91 this.earfcnUl = earfcnUl;
92 }
93
94 public BerInteger getRbsPerTtiDl() {
95 return rbsPerTtiDl;
96 }
97
98 public void setRbsPerTtiDl(BerInteger rbsPerTtiDl) {
99 this.rbsPerTtiDl = rbsPerTtiDl;
100 }
101
102 public BerInteger getRbsPerTtiUl() {
103 return rbsPerTtiUl;
104 }
105
106 public void setRbsPerTtiUl(BerInteger rbsPerTtiUl) {
107 this.rbsPerTtiUl = rbsPerTtiUl;
108 }
109
110 public BerInteger getNumTxAntenna() {
111 return numTxAntenna;
112 }
113
114 public void setNumTxAntenna(BerInteger numTxAntenna) {
115 this.numTxAntenna = numTxAntenna;
116 }
117
118 public DuplexMode getDuplexMode() {
119 return duplexMode;
120 }
121
122 public void setDuplexMode(DuplexMode duplexMode) {
123 this.duplexMode = duplexMode;
124 }
125
126 public BerInteger getTddConfig() {
127 return tddConfig;
128 }
129
130 public void setTddConfig(BerInteger tddConfig) {
131 this.tddConfig = tddConfig;
132 }
133
134 public BerInteger getTddSplSfConfig() {
135 return tddSplSfConfig;
136 }
137
138 public void setTddSplSfConfig(BerInteger tddSplSfConfig) {
139 this.tddSplSfConfig = tddSplSfConfig;
140 }
141
142 public BerInteger getMaxNumConnectedUes() {
143 return maxNumConnectedUes;
144 }
145
146 public void setMaxNumConnectedUes(BerInteger maxNumConnectedUes) {
147 this.maxNumConnectedUes = maxNumConnectedUes;
148 }
149
150 public BerInteger getMaxNumConnectedBearers() {
151 return maxNumConnectedBearers;
152 }
153
154 public void setMaxNumConnectedBearers(BerInteger maxNumConnectedBearers) {
155 this.maxNumConnectedBearers = maxNumConnectedBearers;
156 }
157
158 public BerInteger getMaxNumUesSchedPerTtiDl() {
159 return maxNumUesSchedPerTtiDl;
160 }
161
162 public void setMaxNumUesSchedPerTtiDl(BerInteger maxNumUesSchedPerTtiDl) {
163 this.maxNumUesSchedPerTtiDl = maxNumUesSchedPerTtiDl;
164 }
165
166 public BerInteger getMaxNumUesSchedPerTtiUl() {
167 return maxNumUesSchedPerTtiUl;
168 }
169
170 public void setMaxNumUesSchedPerTtiUl(BerInteger maxNumUesSchedPerTtiUl) {
171 this.maxNumUesSchedPerTtiUl = maxNumUesSchedPerTtiUl;
172 }
173
174 public BerBoolean getDlfsSchedEnable() {
175 return dlfsSchedEnable;
176 }
177
178 public void setDlfsSchedEnable(BerBoolean dlfsSchedEnable) {
179 this.dlfsSchedEnable = dlfsSchedEnable;
180 }
181
182 public BerBitString getFeatureSupportList() {
183 return featureSupportList;
184 }
185
186 public void setFeatureSupportList(BerBitString featureSupportList) {
187 this.featureSupportList = featureSupportList;
188 }
189
190 public int encode(BerByteArrayOutputStream os) throws IOException {
191 return encode(os, true);
192 }
193
194 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
195
196 if (code != null) {
197 for (int i = code.length - 1; i >= 0; i--) {
198 os.write(code[i]);
199 }
200 if (withTag) {
201 return tag.encode(os) + code.length;
202 }
203 return code.length;
204 }
205
206 int codeLength = 0;
207 if (featureSupportList != null) {
208 codeLength += featureSupportList.encode(os, false);
209 // write tag: CONTEXT_CLASS, PRIMITIVE, 16
210 os.write(0x90);
211 codeLength += 1;
212 }
213
214 codeLength += dlfsSchedEnable.encode(os, false);
215 // write tag: CONTEXT_CLASS, PRIMITIVE, 15
216 os.write(0x8F);
217 codeLength += 1;
218
219 codeLength += maxNumUesSchedPerTtiUl.encode(os, false);
220 // write tag: CONTEXT_CLASS, PRIMITIVE, 14
221 os.write(0x8E);
222 codeLength += 1;
223
224 codeLength += maxNumUesSchedPerTtiDl.encode(os, false);
225 // write tag: CONTEXT_CLASS, PRIMITIVE, 13
226 os.write(0x8D);
227 codeLength += 1;
228
229 codeLength += maxNumConnectedBearers.encode(os, false);
230 // write tag: CONTEXT_CLASS, PRIMITIVE, 12
231 os.write(0x8C);
232 codeLength += 1;
233
234 codeLength += maxNumConnectedUes.encode(os, false);
235 // write tag: CONTEXT_CLASS, PRIMITIVE, 11
236 os.write(0x8B);
237 codeLength += 1;
238
239 if (tddSplSfConfig != null) {
240 codeLength += tddSplSfConfig.encode(os, false);
241 // write tag: CONTEXT_CLASS, PRIMITIVE, 10
242 os.write(0x8A);
243 codeLength += 1;
244 }
245
246 if (tddConfig != null) {
247 codeLength += tddConfig.encode(os, false);
248 // write tag: CONTEXT_CLASS, PRIMITIVE, 9
249 os.write(0x89);
250 codeLength += 1;
251 }
252
253 codeLength += duplexMode.encode(os, false);
254 // write tag: CONTEXT_CLASS, PRIMITIVE, 8
255 os.write(0x88);
256 codeLength += 1;
257
258 codeLength += numTxAntenna.encode(os, false);
259 // write tag: CONTEXT_CLASS, PRIMITIVE, 7
260 os.write(0x87);
261 codeLength += 1;
262
263 codeLength += rbsPerTtiUl.encode(os, false);
264 // write tag: CONTEXT_CLASS, PRIMITIVE, 6
265 os.write(0x86);
266 codeLength += 1;
267
268 codeLength += rbsPerTtiDl.encode(os, false);
269 // write tag: CONTEXT_CLASS, PRIMITIVE, 5
270 os.write(0x85);
271 codeLength += 1;
272
273 codeLength += earfcnUl.encode(os, false);
274 // write tag: CONTEXT_CLASS, PRIMITIVE, 4
275 os.write(0x84);
276 codeLength += 1;
277
278 codeLength += earfcnDl.encode(os, false);
279 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
280 os.write(0x83);
281 codeLength += 1;
282
283 codeLength += candScells.encode(os, false);
284 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
285 os.write(0xA2);
286 codeLength += 1;
287
288 codeLength += pci.encode(os, false);
289 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
290 os.write(0x81);
291 codeLength += 1;
292
293 codeLength += ecgi.encode(os, false);
294 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
295 os.write(0xA0);
296 codeLength += 1;
297
298 codeLength += BerLength.encodeLength(os, codeLength);
299
300 if (withTag) {
301 codeLength += tag.encode(os);
302 }
303
304 return codeLength;
305
306 }
307
308 public int decode(InputStream is) throws IOException {
309 return decode(is, true);
310 }
311
312 public int decode(InputStream is, boolean withTag) throws IOException {
313 int codeLength = 0;
314 int subCodeLength = 0;
315 BerTag berTag = new BerTag();
316
317 if (withTag) {
318 codeLength += tag.decodeAndCheck(is);
319 }
320
321 BerLength length = new BerLength();
322 codeLength += length.decode(is);
323
324 int totalLength = length.val;
325 codeLength += totalLength;
326
327 subCodeLength += berTag.decode(is);
328 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
329 ecgi = new ECGI();
330 subCodeLength += ecgi.decode(is, false);
331 subCodeLength += berTag.decode(is);
332 } else {
333 throw new IOException("Tag does not match the mandatory sequence element tag.");
334 }
335
336 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
337 pci = new PhysCellId();
338 subCodeLength += pci.decode(is, false);
339 subCodeLength += berTag.decode(is);
340 } else {
341 throw new IOException("Tag does not match the mandatory sequence element tag.");
342 }
343
344 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
345 candScells = new CandScells();
346 subCodeLength += candScells.decode(is, false);
347 subCodeLength += berTag.decode(is);
348 } else {
349 throw new IOException("Tag does not match the mandatory sequence element tag.");
350 }
351
352 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
353 earfcnDl = new ARFCNValue();
354 subCodeLength += earfcnDl.decode(is, false);
355 subCodeLength += berTag.decode(is);
356 } else {
357 throw new IOException("Tag does not match the mandatory sequence element tag.");
358 }
359
360 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
361 earfcnUl = new ARFCNValue();
362 subCodeLength += earfcnUl.decode(is, false);
363 subCodeLength += berTag.decode(is);
364 } else {
365 throw new IOException("Tag does not match the mandatory sequence element tag.");
366 }
367
368 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
369 rbsPerTtiDl = new BerInteger();
370 subCodeLength += rbsPerTtiDl.decode(is, false);
371 subCodeLength += berTag.decode(is);
372 } else {
373 throw new IOException("Tag does not match the mandatory sequence element tag.");
374 }
375
376 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
377 rbsPerTtiUl = new BerInteger();
378 subCodeLength += rbsPerTtiUl.decode(is, false);
379 subCodeLength += berTag.decode(is);
380 } else {
381 throw new IOException("Tag does not match the mandatory sequence element tag.");
382 }
383
384 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
385 numTxAntenna = new BerInteger();
386 subCodeLength += numTxAntenna.decode(is, false);
387 subCodeLength += berTag.decode(is);
388 } else {
389 throw new IOException("Tag does not match the mandatory sequence element tag.");
390 }
391
392 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
393 duplexMode = new DuplexMode();
394 subCodeLength += duplexMode.decode(is, false);
395 subCodeLength += berTag.decode(is);
396 } else {
397 throw new IOException("Tag does not match the mandatory sequence element tag.");
398 }
399
400 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
401 tddConfig = new BerInteger();
402 subCodeLength += tddConfig.decode(is, false);
403 subCodeLength += berTag.decode(is);
404 }
405
406 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
407 tddSplSfConfig = new BerInteger();
408 subCodeLength += tddSplSfConfig.decode(is, false);
409 subCodeLength += berTag.decode(is);
410 }
411
412 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
413 maxNumConnectedUes = new BerInteger();
414 subCodeLength += maxNumConnectedUes.decode(is, false);
415 subCodeLength += berTag.decode(is);
416 } else {
417 throw new IOException("Tag does not match the mandatory sequence element tag.");
418 }
419
420 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) {
421 maxNumConnectedBearers = new BerInteger();
422 subCodeLength += maxNumConnectedBearers.decode(is, false);
423 subCodeLength += berTag.decode(is);
424 } else {
425 throw new IOException("Tag does not match the mandatory sequence element tag.");
426 }
427
428 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 13)) {
429 maxNumUesSchedPerTtiDl = new BerInteger();
430 subCodeLength += maxNumUesSchedPerTtiDl.decode(is, false);
431 subCodeLength += berTag.decode(is);
432 } else {
433 throw new IOException("Tag does not match the mandatory sequence element tag.");
434 }
435
436 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 14)) {
437 maxNumUesSchedPerTtiUl = new BerInteger();
438 subCodeLength += maxNumUesSchedPerTtiUl.decode(is, false);
439 subCodeLength += berTag.decode(is);
440 } else {
441 throw new IOException("Tag does not match the mandatory sequence element tag.");
442 }
443
444 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 15)) {
445 dlfsSchedEnable = new BerBoolean();
446 subCodeLength += dlfsSchedEnable.decode(is, false);
447 if (subCodeLength == totalLength) {
448 return codeLength;
449 }
450 subCodeLength += berTag.decode(is);
451 } else {
452 throw new IOException("Tag does not match the mandatory sequence element tag.");
453 }
454
455 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) {
456 featureSupportList = new BerBitString();
457 subCodeLength += featureSupportList.decode(is, false);
458 if (subCodeLength == totalLength) {
459 return codeLength;
460 }
461 }
462 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
463
464
465 }
466
467 public void encodeAndSave(int encodingSizeGuess) throws IOException {
468 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
469 encode(os, false);
470 code = os.getArray();
471 }
472
473 public String toString() {
474 StringBuilder sb = new StringBuilder();
475 appendAsString(sb, 0);
476 return sb.toString();
477 }
478
479 public void appendAsString(StringBuilder sb, int indentLevel) {
480
481 sb.append("{");
482 sb.append("\n");
483 for (int i = 0; i < indentLevel + 1; i++) {
484 sb.append("\t");
485 }
486 if (ecgi != null) {
487 sb.append("ecgi: ");
488 ecgi.appendAsString(sb, indentLevel + 1);
489 } else {
490 sb.append("ecgi: <empty-required-field>");
491 }
492
493 sb.append(",\n");
494 for (int i = 0; i < indentLevel + 1; i++) {
495 sb.append("\t");
496 }
497 if (pci != null) {
498 sb.append("pci: ").append(pci);
499 } else {
500 sb.append("pci: <empty-required-field>");
501 }
502
503 sb.append(",\n");
504 for (int i = 0; i < indentLevel + 1; i++) {
505 sb.append("\t");
506 }
507 if (candScells != null) {
508 sb.append("candScells: ");
509 candScells.appendAsString(sb, indentLevel + 1);
510 } else {
511 sb.append("candScells: <empty-required-field>");
512 }
513
514 sb.append(",\n");
515 for (int i = 0; i < indentLevel + 1; i++) {
516 sb.append("\t");
517 }
518 if (earfcnDl != null) {
519 sb.append("earfcnDl: ").append(earfcnDl);
520 } else {
521 sb.append("earfcnDl: <empty-required-field>");
522 }
523
524 sb.append(",\n");
525 for (int i = 0; i < indentLevel + 1; i++) {
526 sb.append("\t");
527 }
528 if (earfcnUl != null) {
529 sb.append("earfcnUl: ").append(earfcnUl);
530 } else {
531 sb.append("earfcnUl: <empty-required-field>");
532 }
533
534 sb.append(",\n");
535 for (int i = 0; i < indentLevel + 1; i++) {
536 sb.append("\t");
537 }
538 if (rbsPerTtiDl != null) {
539 sb.append("rbsPerTtiDl: ").append(rbsPerTtiDl);
540 } else {
541 sb.append("rbsPerTtiDl: <empty-required-field>");
542 }
543
544 sb.append(",\n");
545 for (int i = 0; i < indentLevel + 1; i++) {
546 sb.append("\t");
547 }
548 if (rbsPerTtiUl != null) {
549 sb.append("rbsPerTtiUl: ").append(rbsPerTtiUl);
550 } else {
551 sb.append("rbsPerTtiUl: <empty-required-field>");
552 }
553
554 sb.append(",\n");
555 for (int i = 0; i < indentLevel + 1; i++) {
556 sb.append("\t");
557 }
558 if (numTxAntenna != null) {
559 sb.append("numTxAntenna: ").append(numTxAntenna);
560 } else {
561 sb.append("numTxAntenna: <empty-required-field>");
562 }
563
564 sb.append(",\n");
565 for (int i = 0; i < indentLevel + 1; i++) {
566 sb.append("\t");
567 }
568 if (duplexMode != null) {
569 sb.append("duplexMode: ").append(duplexMode);
570 } else {
571 sb.append("duplexMode: <empty-required-field>");
572 }
573
574 if (tddConfig != null) {
575 sb.append(",\n");
576 for (int i = 0; i < indentLevel + 1; i++) {
577 sb.append("\t");
578 }
579 sb.append("tddConfig: ").append(tddConfig);
580 }
581
582 if (tddSplSfConfig != null) {
583 sb.append(",\n");
584 for (int i = 0; i < indentLevel + 1; i++) {
585 sb.append("\t");
586 }
587 sb.append("tddSplSfConfig: ").append(tddSplSfConfig);
588 }
589
590 sb.append(",\n");
591 for (int i = 0; i < indentLevel + 1; i++) {
592 sb.append("\t");
593 }
594 if (maxNumConnectedUes != null) {
595 sb.append("maxNumConnectedUes: ").append(maxNumConnectedUes);
596 } else {
597 sb.append("maxNumConnectedUes: <empty-required-field>");
598 }
599
600 sb.append(",\n");
601 for (int i = 0; i < indentLevel + 1; i++) {
602 sb.append("\t");
603 }
604 if (maxNumConnectedBearers != null) {
605 sb.append("maxNumConnectedBearers: ").append(maxNumConnectedBearers);
606 } else {
607 sb.append("maxNumConnectedBearers: <empty-required-field>");
608 }
609
610 sb.append(",\n");
611 for (int i = 0; i < indentLevel + 1; i++) {
612 sb.append("\t");
613 }
614 if (maxNumUesSchedPerTtiDl != null) {
615 sb.append("maxNumUesSchedPerTtiDl: ").append(maxNumUesSchedPerTtiDl);
616 } else {
617 sb.append("maxNumUesSchedPerTtiDl: <empty-required-field>");
618 }
619
620 sb.append(",\n");
621 for (int i = 0; i < indentLevel + 1; i++) {
622 sb.append("\t");
623 }
624 if (maxNumUesSchedPerTtiUl != null) {
625 sb.append("maxNumUesSchedPerTtiUl: ").append(maxNumUesSchedPerTtiUl);
626 } else {
627 sb.append("maxNumUesSchedPerTtiUl: <empty-required-field>");
628 }
629
630 sb.append(",\n");
631 for (int i = 0; i < indentLevel + 1; i++) {
632 sb.append("\t");
633 }
634 if (dlfsSchedEnable != null) {
635 sb.append("dlfsSchedEnable: ").append(dlfsSchedEnable);
636 } else {
637 sb.append("dlfsSchedEnable: <empty-required-field>");
638 }
639
640 if (featureSupportList != null) {
641 sb.append(",\n");
642 for (int i = 0; i < indentLevel + 1; i++) {
643 sb.append("\t");
644 }
645 sb.append("featureSupportList: ").append(featureSupportList);
646 }
647
648 sb.append("\n");
649 for (int i = 0; i < indentLevel; i++) {
650 sb.append("\t");
651 }
652 sb.append("}");
653 }
654
655 public static class CandScells implements Serializable {
656
657 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
658 private static final long serialVersionUID = 1L;
659 @JsonIgnore
660 public byte[] code = null;
661 private List<CandScell> seqOf = null;
662
663 public CandScells() {
664 seqOf = new ArrayList<CandScell>();
665 }
666
667 public CandScells(byte[] code) {
668 this.code = code;
669 }
670
671
672 @JsonValue
673 public List<CandScell> getCandScell() {
674 if (seqOf == null) {
675 seqOf = new ArrayList<CandScell>();
676 }
677 return seqOf;
678 }
679
680 public int encode(BerByteArrayOutputStream os) throws IOException {
681 return encode(os, true);
682 }
683
684 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
685
686 if (code != null) {
687 for (int i = code.length - 1; i >= 0; i--) {
688 os.write(code[i]);
689 }
690 if (withTag) {
691 return tag.encode(os) + code.length;
692 }
693 return code.length;
694 }
695
696 int codeLength = 0;
697 for (int i = (seqOf.size() - 1); i >= 0; i--) {
698 codeLength += seqOf.get(i).encode(os, true);
699 }
700
701 codeLength += BerLength.encodeLength(os, codeLength);
702
703 if (withTag) {
704 codeLength += tag.encode(os);
705 }
706
707 return codeLength;
708 }
709
710 public int decode(InputStream is) throws IOException {
711 return decode(is, true);
712 }
713
714 public int decode(InputStream is, boolean withTag) throws IOException {
715 int codeLength = 0;
716 int subCodeLength = 0;
717 if (withTag) {
718 codeLength += tag.decodeAndCheck(is);
719 }
720
721 BerLength length = new BerLength();
722 codeLength += length.decode(is);
723 int totalLength = length.val;
724
725 while (subCodeLength < totalLength) {
726 CandScell element = new CandScell();
727 subCodeLength += element.decode(is, true);
728 seqOf.add(element);
729 }
730 if (subCodeLength != totalLength) {
731 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
732
733 }
734 codeLength += subCodeLength;
735
736 return codeLength;
737 }
738
739 public void encodeAndSave(int encodingSizeGuess) throws IOException {
740 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
741 encode(os, false);
742 code = os.getArray();
743 }
744
745 public String toString() {
746 StringBuilder sb = new StringBuilder();
747 appendAsString(sb, 0);
748 return sb.toString();
749 }
750
751 public void appendAsString(StringBuilder sb, int indentLevel) {
752
753 sb.append("{\n");
754 for (int i = 0; i < indentLevel + 1; i++) {
755 sb.append("\t");
756 }
757 if (seqOf == null) {
758 sb.append("null");
759 } else {
760 Iterator<CandScell> it = seqOf.iterator();
761 if (it.hasNext()) {
762 it.next().appendAsString(sb, indentLevel + 1);
763 while (it.hasNext()) {
764 sb.append(",\n");
765 for (int i = 0; i < indentLevel + 1; i++) {
766 sb.append("\t");
767 }
768 it.next().appendAsString(sb, indentLevel + 1);
769 }
770 }
771 }
772
773 sb.append("\n");
774 for (int i = 0; i < indentLevel; i++) {
775 sb.append("\t");
776 }
777 sb.append("}");
778 }
779
780 }
781
782}
783