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