1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.location.cts.asn1.supl2.ver2_ulp_components; 18 19 /* 20 */ 21 22 23 // 24 // 25 import android.location.cts.asn1.base.Asn1BitString; 26 import android.location.cts.asn1.base.Asn1Choice; 27 import android.location.cts.asn1.base.Asn1IA5String; 28 import android.location.cts.asn1.base.Asn1Null; 29 import android.location.cts.asn1.base.Asn1Object; 30 import android.location.cts.asn1.base.Asn1OctetString; 31 import android.location.cts.asn1.base.Asn1Tag; 32 import android.location.cts.asn1.base.Asn1VisibleString; 33 import android.location.cts.asn1.base.BitStream; 34 import android.location.cts.asn1.base.BitStreamReader; 35 import android.location.cts.asn1.base.ChoiceComponent; 36 import com.google.common.collect.ImmutableList; 37 import java.nio.ByteBuffer; 38 import java.util.Collection; 39 import java.util.HashMap; 40 import java.util.Map; 41 import javax.annotation.Nullable; 42 43 44 /** 45 */ 46 public class ThirdPartyID extends Asn1Choice { 47 // 48 49 private static final Asn1Tag TAG_ThirdPartyID 50 = Asn1Tag.fromClassAndNumber(-1, -1); 51 52 private static final Map<Asn1Tag, Select> tagToSelection = new HashMap<>(); 53 54 private boolean extension; 55 private ChoiceComponent selection; 56 private Asn1Object element; 57 58 static { 59 for (Select select : Select.values()) { 60 for (Asn1Tag tag : select.getPossibleFirstTags()) { 61 Select select0; 62 if ((select0 = tagToSelection.put(tag, select)) != null) { 63 throw new IllegalStateException( 64 "ThirdPartyID: " + tag + " maps to both " + select0 + " and " + select); 65 } 66 } 67 } 68 } 69 70 public ThirdPartyID() { 71 super(); 72 } 73 74 @Override 75 @Nullable 76 protected Asn1Tag getTag() { 77 return TAG_ThirdPartyID; 78 } 79 80 @Override 81 protected boolean isTagImplicit() { 82 return true; 83 } 84 85 public static Collection<Asn1Tag> getPossibleFirstTags() { 86 if (TAG_ThirdPartyID != null) { 87 return ImmutableList.of(TAG_ThirdPartyID); 88 } else { 89 return tagToSelection.keySet(); 90 } 91 } 92 93 /** 94 * Creates a new ThirdPartyID from encoded stream. 95 */ 96 public static ThirdPartyID fromPerUnaligned(byte[] encodedBytes) { 97 ThirdPartyID result = new ThirdPartyID(); 98 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 99 return result; 100 } 101 102 /** 103 * Creates a new ThirdPartyID from encoded stream. 104 */ 105 public static ThirdPartyID fromPerAligned(byte[] encodedBytes) { 106 ThirdPartyID result = new ThirdPartyID(); 107 result.decodePerAligned(new BitStreamReader(encodedBytes)); 108 return result; 109 } 110 111 112 113 @Override protected boolean hasExtensionValue() { 114 return extension; 115 } 116 117 @Override protected Integer getSelectionOrdinal() { 118 return selection.ordinal(); 119 } 120 121 @Nullable 122 @Override 123 protected ChoiceComponent getSelectedComponent() { 124 return selection; 125 } 126 127 @Override protected int getOptionCount() { 128 if (hasExtensionValue()) { 129 return Extend.values().length; 130 } 131 return Select.values().length; 132 } 133 134 protected Asn1Object createAndSetValue(boolean isExtensionValue, 135 int ordinal) { 136 extension = isExtensionValue; 137 if (isExtensionValue) { 138 selection = Extend.values()[ordinal]; 139 } else { 140 selection = Select.values()[ordinal]; 141 } 142 element = selection.createElement(); 143 return element; 144 } 145 146 @Override protected ChoiceComponent createAndSetValue(Asn1Tag tag) { 147 Select select = tagToSelection.get(tag); 148 if (select == null) { 149 throw new IllegalArgumentException("Unknown selection tag: " + tag); 150 } 151 element = select.createElement(); 152 selection = select; 153 extension = false; 154 return select; 155 } 156 157 @Override protected boolean isExtensible() { 158 return true; 159 } 160 161 @Override protected Asn1Object getValue() { 162 return element; 163 } 164 165 166 private static enum Select implements ChoiceComponent { 167 168 $LogicalName(Asn1Tag.fromClassAndNumber(2, 0), 169 true) { 170 @Override 171 public Asn1Object createElement() { 172 return new ThirdPartyID.logicalNameType(); 173 } 174 175 @Override 176 Collection<Asn1Tag> getPossibleFirstTags() { 177 return tag == null ? ThirdPartyID.logicalNameType.getPossibleFirstTags() : ImmutableList.of(tag); 178 } 179 180 @Override 181 String elementIndentedString(Asn1Object element, String indent) { 182 return toString() + " : " + element.toIndentedString(indent); 183 } 184 }, 185 186 $Msisdn(Asn1Tag.fromClassAndNumber(2, 1), 187 true) { 188 @Override 189 public Asn1Object createElement() { 190 return new ThirdPartyID.msisdnType(); 191 } 192 193 @Override 194 Collection<Asn1Tag> getPossibleFirstTags() { 195 return tag == null ? ThirdPartyID.msisdnType.getPossibleFirstTags() : ImmutableList.of(tag); 196 } 197 198 @Override 199 String elementIndentedString(Asn1Object element, String indent) { 200 return toString() + " : " + element.toIndentedString(indent); 201 } 202 }, 203 204 $Emailaddr(Asn1Tag.fromClassAndNumber(2, 2), 205 true) { 206 @Override 207 public Asn1Object createElement() { 208 return new ThirdPartyID.emailaddrType(); 209 } 210 211 @Override 212 Collection<Asn1Tag> getPossibleFirstTags() { 213 return tag == null ? ThirdPartyID.emailaddrType.getPossibleFirstTags() : ImmutableList.of(tag); 214 } 215 216 @Override 217 String elementIndentedString(Asn1Object element, String indent) { 218 return toString() + " : " + element.toIndentedString(indent); 219 } 220 }, 221 222 $Sip_uri(Asn1Tag.fromClassAndNumber(2, 3), 223 true) { 224 @Override 225 public Asn1Object createElement() { 226 return new ThirdPartyID.sip_uriType(); 227 } 228 229 @Override 230 Collection<Asn1Tag> getPossibleFirstTags() { 231 return tag == null ? ThirdPartyID.sip_uriType.getPossibleFirstTags() : ImmutableList.of(tag); 232 } 233 234 @Override 235 String elementIndentedString(Asn1Object element, String indent) { 236 return toString() + " : " + element.toIndentedString(indent); 237 } 238 }, 239 240 $Ims_public_identity(Asn1Tag.fromClassAndNumber(2, 4), 241 true) { 242 @Override 243 public Asn1Object createElement() { 244 return new ThirdPartyID.ims_public_identityType(); 245 } 246 247 @Override 248 Collection<Asn1Tag> getPossibleFirstTags() { 249 return tag == null ? ThirdPartyID.ims_public_identityType.getPossibleFirstTags() : ImmutableList.of(tag); 250 } 251 252 @Override 253 String elementIndentedString(Asn1Object element, String indent) { 254 return toString() + " : " + element.toIndentedString(indent); 255 } 256 }, 257 258 $Min(Asn1Tag.fromClassAndNumber(2, 5), 259 true) { 260 @Override 261 public Asn1Object createElement() { 262 return new ThirdPartyID.minType(); 263 } 264 265 @Override 266 Collection<Asn1Tag> getPossibleFirstTags() { 267 return tag == null ? ThirdPartyID.minType.getPossibleFirstTags() : ImmutableList.of(tag); 268 } 269 270 @Override 271 String elementIndentedString(Asn1Object element, String indent) { 272 return toString() + " : " + element.toIndentedString(indent); 273 } 274 }, 275 276 $Mdn(Asn1Tag.fromClassAndNumber(2, 6), 277 true) { 278 @Override 279 public Asn1Object createElement() { 280 return new ThirdPartyID.mdnType(); 281 } 282 283 @Override 284 Collection<Asn1Tag> getPossibleFirstTags() { 285 return tag == null ? ThirdPartyID.mdnType.getPossibleFirstTags() : ImmutableList.of(tag); 286 } 287 288 @Override 289 String elementIndentedString(Asn1Object element, String indent) { 290 return toString() + " : " + element.toIndentedString(indent); 291 } 292 }, 293 294 $Uri(Asn1Tag.fromClassAndNumber(2, 7), 295 true) { 296 @Override 297 public Asn1Object createElement() { 298 return new ThirdPartyID.uriType(); 299 } 300 301 @Override 302 Collection<Asn1Tag> getPossibleFirstTags() { 303 return tag == null ? ThirdPartyID.uriType.getPossibleFirstTags() : ImmutableList.of(tag); 304 } 305 306 @Override 307 String elementIndentedString(Asn1Object element, String indent) { 308 return toString() + " : " + element.toIndentedString(indent); 309 } 310 }, 311 312 ; 313 314 @Nullable final Asn1Tag tag; 315 final boolean isImplicitTagging; 316 317 Select(@Nullable Asn1Tag tag, boolean isImplicitTagging) { 318 this.tag = tag; 319 this.isImplicitTagging = isImplicitTagging; 320 } 321 322 @Override 323 public Asn1Object createElement() { 324 throw new IllegalStateException("Select template error"); 325 } 326 327 @Override 328 @Nullable 329 public Asn1Tag getTag() { 330 return tag; 331 } 332 333 @Override 334 public boolean isImplicitTagging() { 335 return isImplicitTagging; 336 } 337 338 abstract Collection<Asn1Tag> getPossibleFirstTags(); 339 340 abstract String elementIndentedString(Asn1Object element, String indent); 341 } 342 343 /* 344 */ 345 346 347 // 348 349 /** 350 */ 351 public static class logicalNameType extends Asn1IA5String { 352 // 353 354 private static final Asn1Tag TAG_logicalNameType 355 = Asn1Tag.fromClassAndNumber(-1, -1); 356 357 public logicalNameType() { 358 super(); 359 setMinSize(1); 360 setMaxSize(1000); 361 362 363 } 364 365 @Override 366 @Nullable 367 protected Asn1Tag getTag() { 368 return TAG_logicalNameType; 369 } 370 371 @Override 372 protected boolean isTagImplicit() { 373 return true; 374 } 375 376 public static Collection<Asn1Tag> getPossibleFirstTags() { 377 if (TAG_logicalNameType != null) { 378 return ImmutableList.of(TAG_logicalNameType); 379 } else { 380 return Asn1IA5String.getPossibleFirstTags(); 381 } 382 } 383 384 /** 385 * Creates a new logicalNameType from encoded stream. 386 */ 387 public static logicalNameType fromPerUnaligned(byte[] encodedBytes) { 388 logicalNameType result = new logicalNameType(); 389 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 390 return result; 391 } 392 393 /** 394 * Creates a new logicalNameType from encoded stream. 395 */ 396 public static logicalNameType fromPerAligned(byte[] encodedBytes) { 397 logicalNameType result = new logicalNameType(); 398 result.decodePerAligned(new BitStreamReader(encodedBytes)); 399 return result; 400 } 401 402 @Override public Iterable<BitStream> encodePerUnaligned() { 403 return super.encodePerUnaligned(); 404 } 405 406 @Override public Iterable<BitStream> encodePerAligned() { 407 return super.encodePerAligned(); 408 } 409 410 @Override public void decodePerUnaligned(BitStreamReader reader) { 411 super.decodePerUnaligned(reader); 412 } 413 414 @Override public void decodePerAligned(BitStreamReader reader) { 415 super.decodePerAligned(reader); 416 } 417 418 @Override public String toString() { 419 return toIndentedString(""); 420 } 421 422 public String toIndentedString(String indent) { 423 return "logicalNameType = " + getValue() + ";\n"; 424 } 425 } 426 427 428 public boolean isLogicalName() { 429 return !hasExtensionValue() && Select.$LogicalName == selection; 430 } 431 432 /** 433 * @throws {@code IllegalStateException} if {@code !isLogicalName}. 434 */ 435 @SuppressWarnings("unchecked") 436 public ThirdPartyID.logicalNameType getLogicalName() { 437 if (!isLogicalName()) { 438 throw new IllegalStateException("ThirdPartyID value not a LogicalName"); 439 } 440 return (ThirdPartyID.logicalNameType) element; 441 } 442 443 public void setLogicalName(ThirdPartyID.logicalNameType selected) { 444 selection = Select.$LogicalName; 445 extension = false; 446 element = selected; 447 } 448 449 public ThirdPartyID.logicalNameType setLogicalNameToNewInstance() { 450 ThirdPartyID.logicalNameType element = new ThirdPartyID.logicalNameType(); 451 setLogicalName(element); 452 return element; 453 } 454 455 /* 456 */ 457 458 459 // 460 461 /** 462 */ 463 public static class msisdnType extends Asn1OctetString { 464 // 465 466 private static final Asn1Tag TAG_msisdnType 467 = Asn1Tag.fromClassAndNumber(-1, -1); 468 469 public msisdnType() { 470 super(); 471 setMinSize(8); 472 setMaxSize(8); 473 474 } 475 476 @Override 477 @Nullable 478 protected Asn1Tag getTag() { 479 return TAG_msisdnType; 480 } 481 482 @Override 483 protected boolean isTagImplicit() { 484 return true; 485 } 486 487 public static Collection<Asn1Tag> getPossibleFirstTags() { 488 if (TAG_msisdnType != null) { 489 return ImmutableList.of(TAG_msisdnType); 490 } else { 491 return Asn1OctetString.getPossibleFirstTags(); 492 } 493 } 494 495 /** 496 * Creates a new msisdnType from encoded stream. 497 */ 498 public static msisdnType fromPerUnaligned(byte[] encodedBytes) { 499 msisdnType result = new msisdnType(); 500 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 501 return result; 502 } 503 504 /** 505 * Creates a new msisdnType from encoded stream. 506 */ 507 public static msisdnType fromPerAligned(byte[] encodedBytes) { 508 msisdnType result = new msisdnType(); 509 result.decodePerAligned(new BitStreamReader(encodedBytes)); 510 return result; 511 } 512 513 @Override public Iterable<BitStream> encodePerUnaligned() { 514 return super.encodePerUnaligned(); 515 } 516 517 @Override public Iterable<BitStream> encodePerAligned() { 518 return super.encodePerAligned(); 519 } 520 521 @Override public void decodePerUnaligned(BitStreamReader reader) { 522 super.decodePerUnaligned(reader); 523 } 524 525 @Override public void decodePerAligned(BitStreamReader reader) { 526 super.decodePerAligned(reader); 527 } 528 529 @Override protected String getTypeName() { 530 return "msisdnType"; 531 } 532 } 533 534 535 public boolean isMsisdn() { 536 return !hasExtensionValue() && Select.$Msisdn == selection; 537 } 538 539 /** 540 * @throws {@code IllegalStateException} if {@code !isMsisdn}. 541 */ 542 @SuppressWarnings("unchecked") 543 public ThirdPartyID.msisdnType getMsisdn() { 544 if (!isMsisdn()) { 545 throw new IllegalStateException("ThirdPartyID value not a Msisdn"); 546 } 547 return (ThirdPartyID.msisdnType) element; 548 } 549 550 public void setMsisdn(ThirdPartyID.msisdnType selected) { 551 selection = Select.$Msisdn; 552 extension = false; 553 element = selected; 554 } 555 556 public ThirdPartyID.msisdnType setMsisdnToNewInstance() { 557 ThirdPartyID.msisdnType element = new ThirdPartyID.msisdnType(); 558 setMsisdn(element); 559 return element; 560 } 561 562 /* 563 */ 564 565 566 // 567 568 /** 569 */ 570 public static class emailaddrType extends Asn1IA5String { 571 // 572 573 private static final Asn1Tag TAG_emailaddrType 574 = Asn1Tag.fromClassAndNumber(-1, -1); 575 576 public emailaddrType() { 577 super(); 578 setMinSize(1); 579 setMaxSize(1000); 580 581 582 } 583 584 @Override 585 @Nullable 586 protected Asn1Tag getTag() { 587 return TAG_emailaddrType; 588 } 589 590 @Override 591 protected boolean isTagImplicit() { 592 return true; 593 } 594 595 public static Collection<Asn1Tag> getPossibleFirstTags() { 596 if (TAG_emailaddrType != null) { 597 return ImmutableList.of(TAG_emailaddrType); 598 } else { 599 return Asn1IA5String.getPossibleFirstTags(); 600 } 601 } 602 603 /** 604 * Creates a new emailaddrType from encoded stream. 605 */ 606 public static emailaddrType fromPerUnaligned(byte[] encodedBytes) { 607 emailaddrType result = new emailaddrType(); 608 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 609 return result; 610 } 611 612 /** 613 * Creates a new emailaddrType from encoded stream. 614 */ 615 public static emailaddrType fromPerAligned(byte[] encodedBytes) { 616 emailaddrType result = new emailaddrType(); 617 result.decodePerAligned(new BitStreamReader(encodedBytes)); 618 return result; 619 } 620 621 @Override public Iterable<BitStream> encodePerUnaligned() { 622 return super.encodePerUnaligned(); 623 } 624 625 @Override public Iterable<BitStream> encodePerAligned() { 626 return super.encodePerAligned(); 627 } 628 629 @Override public void decodePerUnaligned(BitStreamReader reader) { 630 super.decodePerUnaligned(reader); 631 } 632 633 @Override public void decodePerAligned(BitStreamReader reader) { 634 super.decodePerAligned(reader); 635 } 636 637 @Override public String toString() { 638 return toIndentedString(""); 639 } 640 641 public String toIndentedString(String indent) { 642 return "emailaddrType = " + getValue() + ";\n"; 643 } 644 } 645 646 647 public boolean isEmailaddr() { 648 return !hasExtensionValue() && Select.$Emailaddr == selection; 649 } 650 651 /** 652 * @throws {@code IllegalStateException} if {@code !isEmailaddr}. 653 */ 654 @SuppressWarnings("unchecked") 655 public ThirdPartyID.emailaddrType getEmailaddr() { 656 if (!isEmailaddr()) { 657 throw new IllegalStateException("ThirdPartyID value not a Emailaddr"); 658 } 659 return (ThirdPartyID.emailaddrType) element; 660 } 661 662 public void setEmailaddr(ThirdPartyID.emailaddrType selected) { 663 selection = Select.$Emailaddr; 664 extension = false; 665 element = selected; 666 } 667 668 public ThirdPartyID.emailaddrType setEmailaddrToNewInstance() { 669 ThirdPartyID.emailaddrType element = new ThirdPartyID.emailaddrType(); 670 setEmailaddr(element); 671 return element; 672 } 673 674 /* 675 */ 676 677 678 // 679 680 /** 681 */ 682 public static class sip_uriType extends Asn1VisibleString { 683 // 684 685 private static final Asn1Tag TAG_sip_uriType 686 = Asn1Tag.fromClassAndNumber(-1, -1); 687 688 public sip_uriType() { 689 super(); 690 setMinSize(1); 691 setMaxSize(255); 692 693 setAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:./-_~#@?"); 694 695 } 696 697 @Override 698 @Nullable 699 protected Asn1Tag getTag() { 700 return TAG_sip_uriType; 701 } 702 703 @Override 704 protected boolean isTagImplicit() { 705 return true; 706 } 707 708 public static Collection<Asn1Tag> getPossibleFirstTags() { 709 if (TAG_sip_uriType != null) { 710 return ImmutableList.of(TAG_sip_uriType); 711 } else { 712 return Asn1VisibleString.getPossibleFirstTags(); 713 } 714 } 715 716 /** 717 * Creates a new sip_uriType from encoded stream. 718 */ 719 public static sip_uriType fromPerUnaligned(byte[] encodedBytes) { 720 sip_uriType result = new sip_uriType(); 721 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 722 return result; 723 } 724 725 /** 726 * Creates a new sip_uriType from encoded stream. 727 */ 728 public static sip_uriType fromPerAligned(byte[] encodedBytes) { 729 sip_uriType result = new sip_uriType(); 730 result.decodePerAligned(new BitStreamReader(encodedBytes)); 731 return result; 732 } 733 734 @Override public Iterable<BitStream> encodePerUnaligned() { 735 return super.encodePerUnaligned(); 736 } 737 738 @Override public Iterable<BitStream> encodePerAligned() { 739 return super.encodePerAligned(); 740 } 741 742 @Override public void decodePerUnaligned(BitStreamReader reader) { 743 super.decodePerUnaligned(reader); 744 } 745 746 @Override public void decodePerAligned(BitStreamReader reader) { 747 super.decodePerAligned(reader); 748 } 749 750 @Override public String toString() { 751 return toIndentedString(""); 752 } 753 754 public String toIndentedString(String indent) { 755 return "sip_uriType = " + getValue() + ";\n"; 756 } 757 } 758 759 760 public boolean isSip_uri() { 761 return !hasExtensionValue() && Select.$Sip_uri == selection; 762 } 763 764 /** 765 * @throws {@code IllegalStateException} if {@code !isSip_uri}. 766 */ 767 @SuppressWarnings("unchecked") 768 public ThirdPartyID.sip_uriType getSip_uri() { 769 if (!isSip_uri()) { 770 throw new IllegalStateException("ThirdPartyID value not a Sip_uri"); 771 } 772 return (ThirdPartyID.sip_uriType) element; 773 } 774 775 public void setSip_uri(ThirdPartyID.sip_uriType selected) { 776 selection = Select.$Sip_uri; 777 extension = false; 778 element = selected; 779 } 780 781 public ThirdPartyID.sip_uriType setSip_uriToNewInstance() { 782 ThirdPartyID.sip_uriType element = new ThirdPartyID.sip_uriType(); 783 setSip_uri(element); 784 return element; 785 } 786 787 /* 788 */ 789 790 791 // 792 793 /** 794 */ 795 public static class ims_public_identityType extends Asn1VisibleString { 796 // 797 798 private static final Asn1Tag TAG_ims_public_identityType 799 = Asn1Tag.fromClassAndNumber(-1, -1); 800 801 public ims_public_identityType() { 802 super(); 803 setMinSize(1); 804 setMaxSize(255); 805 806 setAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:./-_~#@?"); 807 808 } 809 810 @Override 811 @Nullable 812 protected Asn1Tag getTag() { 813 return TAG_ims_public_identityType; 814 } 815 816 @Override 817 protected boolean isTagImplicit() { 818 return true; 819 } 820 821 public static Collection<Asn1Tag> getPossibleFirstTags() { 822 if (TAG_ims_public_identityType != null) { 823 return ImmutableList.of(TAG_ims_public_identityType); 824 } else { 825 return Asn1VisibleString.getPossibleFirstTags(); 826 } 827 } 828 829 /** 830 * Creates a new ims_public_identityType from encoded stream. 831 */ 832 public static ims_public_identityType fromPerUnaligned(byte[] encodedBytes) { 833 ims_public_identityType result = new ims_public_identityType(); 834 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 835 return result; 836 } 837 838 /** 839 * Creates a new ims_public_identityType from encoded stream. 840 */ 841 public static ims_public_identityType fromPerAligned(byte[] encodedBytes) { 842 ims_public_identityType result = new ims_public_identityType(); 843 result.decodePerAligned(new BitStreamReader(encodedBytes)); 844 return result; 845 } 846 847 @Override public Iterable<BitStream> encodePerUnaligned() { 848 return super.encodePerUnaligned(); 849 } 850 851 @Override public Iterable<BitStream> encodePerAligned() { 852 return super.encodePerAligned(); 853 } 854 855 @Override public void decodePerUnaligned(BitStreamReader reader) { 856 super.decodePerUnaligned(reader); 857 } 858 859 @Override public void decodePerAligned(BitStreamReader reader) { 860 super.decodePerAligned(reader); 861 } 862 863 @Override public String toString() { 864 return toIndentedString(""); 865 } 866 867 public String toIndentedString(String indent) { 868 return "ims_public_identityType = " + getValue() + ";\n"; 869 } 870 } 871 872 873 public boolean isIms_public_identity() { 874 return !hasExtensionValue() && Select.$Ims_public_identity == selection; 875 } 876 877 /** 878 * @throws {@code IllegalStateException} if {@code !isIms_public_identity}. 879 */ 880 @SuppressWarnings("unchecked") 881 public ThirdPartyID.ims_public_identityType getIms_public_identity() { 882 if (!isIms_public_identity()) { 883 throw new IllegalStateException("ThirdPartyID value not a Ims_public_identity"); 884 } 885 return (ThirdPartyID.ims_public_identityType) element; 886 } 887 888 public void setIms_public_identity(ThirdPartyID.ims_public_identityType selected) { 889 selection = Select.$Ims_public_identity; 890 extension = false; 891 element = selected; 892 } 893 894 public ThirdPartyID.ims_public_identityType setIms_public_identityToNewInstance() { 895 ThirdPartyID.ims_public_identityType element = new ThirdPartyID.ims_public_identityType(); 896 setIms_public_identity(element); 897 return element; 898 } 899 900 /* 901 */ 902 903 904 // 905 906 /** 907 */ 908 public static class minType extends Asn1BitString { 909 // 910 911 private static final Asn1Tag TAG_minType 912 = Asn1Tag.fromClassAndNumber(-1, -1); 913 914 public minType() { 915 super(); 916 setMinSize(34); 917 setMaxSize(34); 918 919 } 920 921 @Override 922 @Nullable 923 protected Asn1Tag getTag() { 924 return TAG_minType; 925 } 926 927 @Override 928 protected boolean isTagImplicit() { 929 return true; 930 } 931 932 public static Collection<Asn1Tag> getPossibleFirstTags() { 933 if (TAG_minType != null) { 934 return ImmutableList.of(TAG_minType); 935 } else { 936 return Asn1BitString.getPossibleFirstTags(); 937 } 938 } 939 940 /** 941 * Creates a new minType from encoded stream. 942 */ 943 public static minType fromPerUnaligned(byte[] encodedBytes) { 944 minType result = new minType(); 945 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 946 return result; 947 } 948 949 /** 950 * Creates a new minType from encoded stream. 951 */ 952 public static minType fromPerAligned(byte[] encodedBytes) { 953 minType result = new minType(); 954 result.decodePerAligned(new BitStreamReader(encodedBytes)); 955 return result; 956 } 957 958 @Override public Iterable<BitStream> encodePerUnaligned() { 959 return super.encodePerUnaligned(); 960 } 961 962 @Override public Iterable<BitStream> encodePerAligned() { 963 return super.encodePerAligned(); 964 } 965 966 @Override public void decodePerUnaligned(BitStreamReader reader) { 967 super.decodePerUnaligned(reader); 968 } 969 970 @Override public void decodePerAligned(BitStreamReader reader) { 971 super.decodePerAligned(reader); 972 } 973 974 @Override public String toString() { 975 return toIndentedString(""); 976 } 977 978 public String toIndentedString(String indent) { 979 return "minType = " + getValue() + ";\n"; 980 } 981 } 982 983 984 public boolean isMin() { 985 return !hasExtensionValue() && Select.$Min == selection; 986 } 987 988 /** 989 * @throws {@code IllegalStateException} if {@code !isMin}. 990 */ 991 @SuppressWarnings("unchecked") 992 public ThirdPartyID.minType getMin() { 993 if (!isMin()) { 994 throw new IllegalStateException("ThirdPartyID value not a Min"); 995 } 996 return (ThirdPartyID.minType) element; 997 } 998 999 public void setMin(ThirdPartyID.minType selected) { 1000 selection = Select.$Min; 1001 extension = false; 1002 element = selected; 1003 } 1004 1005 public ThirdPartyID.minType setMinToNewInstance() { 1006 ThirdPartyID.minType element = new ThirdPartyID.minType(); 1007 setMin(element); 1008 return element; 1009 } 1010 1011 /* 1012 */ 1013 1014 1015 // 1016 1017 /** 1018 */ 1019 public static class mdnType extends Asn1OctetString { 1020 // 1021 1022 private static final Asn1Tag TAG_mdnType 1023 = Asn1Tag.fromClassAndNumber(-1, -1); 1024 1025 public mdnType() { 1026 super(); 1027 setMinSize(8); 1028 setMaxSize(8); 1029 1030 } 1031 1032 @Override 1033 @Nullable 1034 protected Asn1Tag getTag() { 1035 return TAG_mdnType; 1036 } 1037 1038 @Override 1039 protected boolean isTagImplicit() { 1040 return true; 1041 } 1042 1043 public static Collection<Asn1Tag> getPossibleFirstTags() { 1044 if (TAG_mdnType != null) { 1045 return ImmutableList.of(TAG_mdnType); 1046 } else { 1047 return Asn1OctetString.getPossibleFirstTags(); 1048 } 1049 } 1050 1051 /** 1052 * Creates a new mdnType from encoded stream. 1053 */ 1054 public static mdnType fromPerUnaligned(byte[] encodedBytes) { 1055 mdnType result = new mdnType(); 1056 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 1057 return result; 1058 } 1059 1060 /** 1061 * Creates a new mdnType from encoded stream. 1062 */ 1063 public static mdnType fromPerAligned(byte[] encodedBytes) { 1064 mdnType result = new mdnType(); 1065 result.decodePerAligned(new BitStreamReader(encodedBytes)); 1066 return result; 1067 } 1068 1069 @Override public Iterable<BitStream> encodePerUnaligned() { 1070 return super.encodePerUnaligned(); 1071 } 1072 1073 @Override public Iterable<BitStream> encodePerAligned() { 1074 return super.encodePerAligned(); 1075 } 1076 1077 @Override public void decodePerUnaligned(BitStreamReader reader) { 1078 super.decodePerUnaligned(reader); 1079 } 1080 1081 @Override public void decodePerAligned(BitStreamReader reader) { 1082 super.decodePerAligned(reader); 1083 } 1084 1085 @Override protected String getTypeName() { 1086 return "mdnType"; 1087 } 1088 } 1089 1090 1091 public boolean isMdn() { 1092 return !hasExtensionValue() && Select.$Mdn == selection; 1093 } 1094 1095 /** 1096 * @throws {@code IllegalStateException} if {@code !isMdn}. 1097 */ 1098 @SuppressWarnings("unchecked") 1099 public ThirdPartyID.mdnType getMdn() { 1100 if (!isMdn()) { 1101 throw new IllegalStateException("ThirdPartyID value not a Mdn"); 1102 } 1103 return (ThirdPartyID.mdnType) element; 1104 } 1105 1106 public void setMdn(ThirdPartyID.mdnType selected) { 1107 selection = Select.$Mdn; 1108 extension = false; 1109 element = selected; 1110 } 1111 1112 public ThirdPartyID.mdnType setMdnToNewInstance() { 1113 ThirdPartyID.mdnType element = new ThirdPartyID.mdnType(); 1114 setMdn(element); 1115 return element; 1116 } 1117 1118 /* 1119 */ 1120 1121 1122 // 1123 1124 /** 1125 */ 1126 public static class uriType extends Asn1VisibleString { 1127 // 1128 1129 private static final Asn1Tag TAG_uriType 1130 = Asn1Tag.fromClassAndNumber(-1, -1); 1131 1132 public uriType() { 1133 super(); 1134 setMinSize(1); 1135 setMaxSize(255); 1136 1137 setAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_~#"); 1138 1139 } 1140 1141 @Override 1142 @Nullable 1143 protected Asn1Tag getTag() { 1144 return TAG_uriType; 1145 } 1146 1147 @Override 1148 protected boolean isTagImplicit() { 1149 return true; 1150 } 1151 1152 public static Collection<Asn1Tag> getPossibleFirstTags() { 1153 if (TAG_uriType != null) { 1154 return ImmutableList.of(TAG_uriType); 1155 } else { 1156 return Asn1VisibleString.getPossibleFirstTags(); 1157 } 1158 } 1159 1160 /** 1161 * Creates a new uriType from encoded stream. 1162 */ 1163 public static uriType fromPerUnaligned(byte[] encodedBytes) { 1164 uriType result = new uriType(); 1165 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 1166 return result; 1167 } 1168 1169 /** 1170 * Creates a new uriType from encoded stream. 1171 */ 1172 public static uriType fromPerAligned(byte[] encodedBytes) { 1173 uriType result = new uriType(); 1174 result.decodePerAligned(new BitStreamReader(encodedBytes)); 1175 return result; 1176 } 1177 1178 @Override public Iterable<BitStream> encodePerUnaligned() { 1179 return super.encodePerUnaligned(); 1180 } 1181 1182 @Override public Iterable<BitStream> encodePerAligned() { 1183 return super.encodePerAligned(); 1184 } 1185 1186 @Override public void decodePerUnaligned(BitStreamReader reader) { 1187 super.decodePerUnaligned(reader); 1188 } 1189 1190 @Override public void decodePerAligned(BitStreamReader reader) { 1191 super.decodePerAligned(reader); 1192 } 1193 1194 @Override public String toString() { 1195 return toIndentedString(""); 1196 } 1197 1198 public String toIndentedString(String indent) { 1199 return "uriType = " + getValue() + ";\n"; 1200 } 1201 } 1202 1203 1204 public boolean isUri() { 1205 return !hasExtensionValue() && Select.$Uri == selection; 1206 } 1207 1208 /** 1209 * @throws {@code IllegalStateException} if {@code !isUri}. 1210 */ 1211 @SuppressWarnings("unchecked") 1212 public ThirdPartyID.uriType getUri() { 1213 if (!isUri()) { 1214 throw new IllegalStateException("ThirdPartyID value not a Uri"); 1215 } 1216 return (ThirdPartyID.uriType) element; 1217 } 1218 1219 public void setUri(ThirdPartyID.uriType selected) { 1220 selection = Select.$Uri; 1221 extension = false; 1222 element = selected; 1223 } 1224 1225 public ThirdPartyID.uriType setUriToNewInstance() { 1226 ThirdPartyID.uriType element = new ThirdPartyID.uriType(); 1227 setUri(element); 1228 return element; 1229 } 1230 1231 1232 private static enum Extend implements ChoiceComponent { 1233 1234 ; 1235 @Nullable private final Asn1Tag tag; 1236 private final boolean isImplicitTagging; 1237 1238 Extend(@Nullable Asn1Tag tag, boolean isImplicitTagging) { 1239 this.tag = tag; 1240 this.isImplicitTagging = isImplicitTagging; 1241 } 1242 1243 public Asn1Object createElement() { 1244 throw new IllegalStateException("Extend template error"); 1245 } 1246 1247 @Override 1248 @Nullable 1249 public Asn1Tag getTag() { 1250 return tag; 1251 } 1252 1253 @Override 1254 public boolean isImplicitTagging() { 1255 return isImplicitTagging; 1256 } 1257 1258 String elementIndentedString(Asn1Object element, String indent) { 1259 throw new IllegalStateException("Extend template error"); 1260 } 1261 } 1262 1263 1264 @Override public Iterable<BitStream> encodePerUnaligned() { 1265 return super.encodePerUnaligned(); 1266 } 1267 1268 @Override public Iterable<BitStream> encodePerAligned() { 1269 return super.encodePerAligned(); 1270 } 1271 1272 @Override public void decodePerUnaligned(BitStreamReader reader) { 1273 super.decodePerUnaligned(reader); 1274 } 1275 1276 @Override public void decodePerAligned(BitStreamReader reader) { 1277 super.decodePerAligned(reader); 1278 } 1279 1280 @Override public String toString() { 1281 return toIndentedString(""); 1282 } 1283 1284 private String elementIndentedString(String indent) { 1285 if (element == null) { 1286 return "null;\n"; 1287 } 1288 if (extension) { 1289 return Extend.values()[selection.ordinal()] 1290 .elementIndentedString(element, indent + " "); 1291 } else { 1292 return Select.values()[selection.ordinal()] 1293 .elementIndentedString(element, indent + " "); 1294 } 1295 } 1296 1297 public String toIndentedString(String indent) { 1298 return "ThirdPartyID = " + elementIndentedString(indent) + indent + ";\n"; 1299 } 1300 } 1301