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.ulp;
18 
19 /*
20  */
21 
22 
23 //
24 //
25 import android.location.cts.asn1.base.Asn1Choice;
26 import android.location.cts.asn1.base.Asn1Null;
27 import android.location.cts.asn1.base.Asn1Object;
28 import android.location.cts.asn1.base.Asn1Tag;
29 import android.location.cts.asn1.base.BitStream;
30 import android.location.cts.asn1.base.BitStreamReader;
31 import android.location.cts.asn1.base.ChoiceComponent;
32 import android.location.cts.asn1.supl2.supl_auth_req.SUPLAUTHREQ;
33 import android.location.cts.asn1.supl2.supl_auth_resp.SUPLAUTHRESP;
34 import android.location.cts.asn1.supl2.supl_end.SUPLEND;
35 import android.location.cts.asn1.supl2.supl_init.SUPLINIT;
36 import android.location.cts.asn1.supl2.supl_notify.Ver2_SUPLNOTIFY;
37 import android.location.cts.asn1.supl2.supl_notify_response.Ver2_SUPLNOTIFYRESPONSE;
38 import android.location.cts.asn1.supl2.supl_pos.SUPLPOS;
39 import android.location.cts.asn1.supl2.supl_pos_init.SUPLPOSINIT;
40 import android.location.cts.asn1.supl2.supl_report.Ver2_SUPLREPORT;
41 import android.location.cts.asn1.supl2.supl_response.SUPLRESPONSE;
42 import android.location.cts.asn1.supl2.supl_set_init.Ver2_SUPLSETINIT;
43 import android.location.cts.asn1.supl2.supl_start.SUPLSTART;
44 import android.location.cts.asn1.supl2.supl_triggered_response.Ver2_SUPLTRIGGEREDRESPONSE;
45 import android.location.cts.asn1.supl2.supl_triggered_start.Ver2_SUPLTRIGGEREDSTART;
46 import android.location.cts.asn1.supl2.supl_triggered_stop.Ver2_SUPLTRIGGEREDSTOP;
47 import com.google.common.collect.ImmutableList;
48 import java.nio.ByteBuffer;
49 import java.util.Collection;
50 import java.util.HashMap;
51 import java.util.Map;
52 import javax.annotation.Nullable;
53 
54 
55 /**
56  */
57 public  class UlpMessage extends Asn1Choice {
58   //
59 
60   private static final Asn1Tag TAG_UlpMessage
61       = Asn1Tag.fromClassAndNumber(-1, -1);
62 
63   private static final Map<Asn1Tag, Select> tagToSelection = new HashMap<>();
64 
65   private boolean extension;
66   private ChoiceComponent selection;
67   private Asn1Object element;
68 
69   static {
70     for (Select select : Select.values()) {
71       for (Asn1Tag tag : select.getPossibleFirstTags()) {
72         Select select0;
73         if ((select0 = tagToSelection.put(tag, select)) != null) {
74           throw new IllegalStateException(
75             "UlpMessage: " + tag + " maps to both " + select0 + " and " + select);
76         }
77       }
78     }
79   }
80 
UlpMessage()81   public UlpMessage() {
82     super();
83   }
84 
85   @Override
86   @Nullable
getTag()87   protected Asn1Tag getTag() {
88     return TAG_UlpMessage;
89   }
90 
91   @Override
isTagImplicit()92   protected boolean isTagImplicit() {
93     return true;
94   }
95 
getPossibleFirstTags()96   public static Collection<Asn1Tag> getPossibleFirstTags() {
97     if (TAG_UlpMessage != null) {
98       return ImmutableList.of(TAG_UlpMessage);
99     } else {
100       return tagToSelection.keySet();
101     }
102   }
103 
104   /**
105    * Creates a new UlpMessage from encoded stream.
106    */
fromPerUnaligned(byte[] encodedBytes)107   public static UlpMessage fromPerUnaligned(byte[] encodedBytes) {
108     UlpMessage result = new UlpMessage();
109     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
110     return result;
111   }
112 
113   /**
114    * Creates a new UlpMessage from encoded stream.
115    */
fromPerAligned(byte[] encodedBytes)116   public static UlpMessage fromPerAligned(byte[] encodedBytes) {
117     UlpMessage result = new UlpMessage();
118     result.decodePerAligned(new BitStreamReader(encodedBytes));
119     return result;
120   }
121 
122 
123 
hasExtensionValue()124   @Override protected boolean hasExtensionValue() {
125     return extension;
126   }
127 
getSelectionOrdinal()128   @Override protected Integer getSelectionOrdinal() {
129     return selection.ordinal();
130   }
131 
132   @Nullable
133   @Override
getSelectedComponent()134   protected ChoiceComponent getSelectedComponent() {
135     return selection;
136   }
137 
getOptionCount()138   @Override protected int getOptionCount() {
139     if (hasExtensionValue()) {
140       return Extend.values().length;
141     }
142     return Select.values().length;
143   }
144 
createAndSetValue(boolean isExtensionValue, int ordinal)145   protected Asn1Object createAndSetValue(boolean isExtensionValue,
146                                          int ordinal) {
147     extension = isExtensionValue;
148     if (isExtensionValue) {
149       selection = Extend.values()[ordinal];
150     } else {
151       selection = Select.values()[ordinal];
152     }
153     element = selection.createElement();
154     return element;
155   }
156 
createAndSetValue(Asn1Tag tag)157   @Override protected ChoiceComponent createAndSetValue(Asn1Tag tag) {
158     Select select = tagToSelection.get(tag);
159     if (select == null) {
160       throw new IllegalArgumentException("Unknown selection tag: " + tag);
161     }
162     element = select.createElement();
163     selection = select;
164     extension = false;
165     return select;
166   }
167 
isExtensible()168   @Override protected boolean isExtensible() {
169     return true;
170   }
171 
getValue()172   @Override protected Asn1Object getValue() {
173     return element;
174   }
175 
176 
177   private static enum Select implements ChoiceComponent {
178 
179     $MsSUPLINIT(Asn1Tag.fromClassAndNumber(2, 0),
180         true) {
181       @Override
createElement()182       public Asn1Object createElement() {
183         return new SUPLINIT();
184       }
185 
186       @Override
getPossibleFirstTags()187       Collection<Asn1Tag> getPossibleFirstTags() {
188         return tag == null ? SUPLINIT.getPossibleFirstTags() : ImmutableList.of(tag);
189       }
190 
191       @Override
elementIndentedString(Asn1Object element, String indent)192       String elementIndentedString(Asn1Object element, String indent) {
193         return toString() + " : " + element.toIndentedString(indent);
194       }
195     },
196 
197     $MsSUPLSTART(Asn1Tag.fromClassAndNumber(2, 1),
198         true) {
199       @Override
createElement()200       public Asn1Object createElement() {
201         return new SUPLSTART();
202       }
203 
204       @Override
getPossibleFirstTags()205       Collection<Asn1Tag> getPossibleFirstTags() {
206         return tag == null ? SUPLSTART.getPossibleFirstTags() : ImmutableList.of(tag);
207       }
208 
209       @Override
elementIndentedString(Asn1Object element, String indent)210       String elementIndentedString(Asn1Object element, String indent) {
211         return toString() + " : " + element.toIndentedString(indent);
212       }
213     },
214 
215     $MsSUPLRESPONSE(Asn1Tag.fromClassAndNumber(2, 2),
216         true) {
217       @Override
createElement()218       public Asn1Object createElement() {
219         return new SUPLRESPONSE();
220       }
221 
222       @Override
getPossibleFirstTags()223       Collection<Asn1Tag> getPossibleFirstTags() {
224         return tag == null ? SUPLRESPONSE.getPossibleFirstTags() : ImmutableList.of(tag);
225       }
226 
227       @Override
elementIndentedString(Asn1Object element, String indent)228       String elementIndentedString(Asn1Object element, String indent) {
229         return toString() + " : " + element.toIndentedString(indent);
230       }
231     },
232 
233     $MsSUPLPOSINIT(Asn1Tag.fromClassAndNumber(2, 3),
234         true) {
235       @Override
createElement()236       public Asn1Object createElement() {
237         return new SUPLPOSINIT();
238       }
239 
240       @Override
getPossibleFirstTags()241       Collection<Asn1Tag> getPossibleFirstTags() {
242         return tag == null ? SUPLPOSINIT.getPossibleFirstTags() : ImmutableList.of(tag);
243       }
244 
245       @Override
elementIndentedString(Asn1Object element, String indent)246       String elementIndentedString(Asn1Object element, String indent) {
247         return toString() + " : " + element.toIndentedString(indent);
248       }
249     },
250 
251     $MsSUPLPOS(Asn1Tag.fromClassAndNumber(2, 4),
252         true) {
253       @Override
createElement()254       public Asn1Object createElement() {
255         return new SUPLPOS();
256       }
257 
258       @Override
getPossibleFirstTags()259       Collection<Asn1Tag> getPossibleFirstTags() {
260         return tag == null ? SUPLPOS.getPossibleFirstTags() : ImmutableList.of(tag);
261       }
262 
263       @Override
elementIndentedString(Asn1Object element, String indent)264       String elementIndentedString(Asn1Object element, String indent) {
265         return toString() + " : " + element.toIndentedString(indent);
266       }
267     },
268 
269     $MsSUPLEND(Asn1Tag.fromClassAndNumber(2, 5),
270         true) {
271       @Override
createElement()272       public Asn1Object createElement() {
273         return new SUPLEND();
274       }
275 
276       @Override
getPossibleFirstTags()277       Collection<Asn1Tag> getPossibleFirstTags() {
278         return tag == null ? SUPLEND.getPossibleFirstTags() : ImmutableList.of(tag);
279       }
280 
281       @Override
elementIndentedString(Asn1Object element, String indent)282       String elementIndentedString(Asn1Object element, String indent) {
283         return toString() + " : " + element.toIndentedString(indent);
284       }
285     },
286 
287     $MsSUPLAUTHREQ(Asn1Tag.fromClassAndNumber(2, 6),
288         true) {
289       @Override
createElement()290       public Asn1Object createElement() {
291         return new SUPLAUTHREQ();
292       }
293 
294       @Override
getPossibleFirstTags()295       Collection<Asn1Tag> getPossibleFirstTags() {
296         return tag == null ? SUPLAUTHREQ.getPossibleFirstTags() : ImmutableList.of(tag);
297       }
298 
299       @Override
elementIndentedString(Asn1Object element, String indent)300       String elementIndentedString(Asn1Object element, String indent) {
301         return toString() + " : " + element.toIndentedString(indent);
302       }
303     },
304 
305     $MsSUPLAUTHRESP(Asn1Tag.fromClassAndNumber(2, 7),
306         true) {
307       @Override
createElement()308       public Asn1Object createElement() {
309         return new SUPLAUTHRESP();
310       }
311 
312       @Override
getPossibleFirstTags()313       Collection<Asn1Tag> getPossibleFirstTags() {
314         return tag == null ? SUPLAUTHRESP.getPossibleFirstTags() : ImmutableList.of(tag);
315       }
316 
317       @Override
elementIndentedString(Asn1Object element, String indent)318       String elementIndentedString(Asn1Object element, String indent) {
319         return toString() + " : " + element.toIndentedString(indent);
320       }
321     },
322 
323     ;
324 
325     @Nullable final Asn1Tag tag;
326     final boolean isImplicitTagging;
327 
Select(@ullable Asn1Tag tag, boolean isImplicitTagging)328     Select(@Nullable Asn1Tag tag, boolean isImplicitTagging) {
329       this.tag = tag;
330       this.isImplicitTagging = isImplicitTagging;
331     }
332 
333     @Override
createElement()334     public Asn1Object createElement() {
335       throw new IllegalStateException("Select template error");
336     }
337 
338     @Override
339     @Nullable
getTag()340     public Asn1Tag getTag() {
341       return tag;
342     }
343 
344     @Override
isImplicitTagging()345     public boolean isImplicitTagging() {
346       return isImplicitTagging;
347     }
348 
getPossibleFirstTags()349     abstract Collection<Asn1Tag> getPossibleFirstTags();
350 
elementIndentedString(Asn1Object element, String indent)351     abstract String elementIndentedString(Asn1Object element, String indent);
352   }
353 
354 
355 
isMsSUPLINIT()356   public boolean isMsSUPLINIT() {
357     return !hasExtensionValue() && Select.$MsSUPLINIT == selection;
358   }
359 
360   /**
361    * @throws {@code IllegalStateException} if {@code !isMsSUPLINIT}.
362    */
363   @SuppressWarnings("unchecked")
getMsSUPLINIT()364   public SUPLINIT getMsSUPLINIT() {
365     if (!isMsSUPLINIT()) {
366       throw new IllegalStateException("UlpMessage value not a MsSUPLINIT");
367     }
368     return (SUPLINIT) element;
369   }
370 
setMsSUPLINIT(SUPLINIT selected)371   public void setMsSUPLINIT(SUPLINIT selected) {
372     selection = Select.$MsSUPLINIT;
373     extension = false;
374     element = selected;
375   }
376 
setMsSUPLINITToNewInstance()377   public SUPLINIT setMsSUPLINITToNewInstance() {
378       SUPLINIT element = new SUPLINIT();
379       setMsSUPLINIT(element);
380       return element;
381   }
382 
383 
384 
isMsSUPLSTART()385   public boolean isMsSUPLSTART() {
386     return !hasExtensionValue() && Select.$MsSUPLSTART == selection;
387   }
388 
389   /**
390    * @throws {@code IllegalStateException} if {@code !isMsSUPLSTART}.
391    */
392   @SuppressWarnings("unchecked")
getMsSUPLSTART()393   public SUPLSTART getMsSUPLSTART() {
394     if (!isMsSUPLSTART()) {
395       throw new IllegalStateException("UlpMessage value not a MsSUPLSTART");
396     }
397     return (SUPLSTART) element;
398   }
399 
setMsSUPLSTART(SUPLSTART selected)400   public void setMsSUPLSTART(SUPLSTART selected) {
401     selection = Select.$MsSUPLSTART;
402     extension = false;
403     element = selected;
404   }
405 
setMsSUPLSTARTToNewInstance()406   public SUPLSTART setMsSUPLSTARTToNewInstance() {
407       SUPLSTART element = new SUPLSTART();
408       setMsSUPLSTART(element);
409       return element;
410   }
411 
412 
413 
isMsSUPLRESPONSE()414   public boolean isMsSUPLRESPONSE() {
415     return !hasExtensionValue() && Select.$MsSUPLRESPONSE == selection;
416   }
417 
418   /**
419    * @throws {@code IllegalStateException} if {@code !isMsSUPLRESPONSE}.
420    */
421   @SuppressWarnings("unchecked")
getMsSUPLRESPONSE()422   public SUPLRESPONSE getMsSUPLRESPONSE() {
423     if (!isMsSUPLRESPONSE()) {
424       throw new IllegalStateException("UlpMessage value not a MsSUPLRESPONSE");
425     }
426     return (SUPLRESPONSE) element;
427   }
428 
setMsSUPLRESPONSE(SUPLRESPONSE selected)429   public void setMsSUPLRESPONSE(SUPLRESPONSE selected) {
430     selection = Select.$MsSUPLRESPONSE;
431     extension = false;
432     element = selected;
433   }
434 
setMsSUPLRESPONSEToNewInstance()435   public SUPLRESPONSE setMsSUPLRESPONSEToNewInstance() {
436       SUPLRESPONSE element = new SUPLRESPONSE();
437       setMsSUPLRESPONSE(element);
438       return element;
439   }
440 
441 
442 
isMsSUPLPOSINIT()443   public boolean isMsSUPLPOSINIT() {
444     return !hasExtensionValue() && Select.$MsSUPLPOSINIT == selection;
445   }
446 
447   /**
448    * @throws {@code IllegalStateException} if {@code !isMsSUPLPOSINIT}.
449    */
450   @SuppressWarnings("unchecked")
getMsSUPLPOSINIT()451   public SUPLPOSINIT getMsSUPLPOSINIT() {
452     if (!isMsSUPLPOSINIT()) {
453       throw new IllegalStateException("UlpMessage value not a MsSUPLPOSINIT");
454     }
455     return (SUPLPOSINIT) element;
456   }
457 
setMsSUPLPOSINIT(SUPLPOSINIT selected)458   public void setMsSUPLPOSINIT(SUPLPOSINIT selected) {
459     selection = Select.$MsSUPLPOSINIT;
460     extension = false;
461     element = selected;
462   }
463 
setMsSUPLPOSINITToNewInstance()464   public SUPLPOSINIT setMsSUPLPOSINITToNewInstance() {
465       SUPLPOSINIT element = new SUPLPOSINIT();
466       setMsSUPLPOSINIT(element);
467       return element;
468   }
469 
470 
471 
isMsSUPLPOS()472   public boolean isMsSUPLPOS() {
473     return !hasExtensionValue() && Select.$MsSUPLPOS == selection;
474   }
475 
476   /**
477    * @throws {@code IllegalStateException} if {@code !isMsSUPLPOS}.
478    */
479   @SuppressWarnings("unchecked")
getMsSUPLPOS()480   public SUPLPOS getMsSUPLPOS() {
481     if (!isMsSUPLPOS()) {
482       throw new IllegalStateException("UlpMessage value not a MsSUPLPOS");
483     }
484     return (SUPLPOS) element;
485   }
486 
setMsSUPLPOS(SUPLPOS selected)487   public void setMsSUPLPOS(SUPLPOS selected) {
488     selection = Select.$MsSUPLPOS;
489     extension = false;
490     element = selected;
491   }
492 
setMsSUPLPOSToNewInstance()493   public SUPLPOS setMsSUPLPOSToNewInstance() {
494       SUPLPOS element = new SUPLPOS();
495       setMsSUPLPOS(element);
496       return element;
497   }
498 
499 
500 
isMsSUPLEND()501   public boolean isMsSUPLEND() {
502     return !hasExtensionValue() && Select.$MsSUPLEND == selection;
503   }
504 
505   /**
506    * @throws {@code IllegalStateException} if {@code !isMsSUPLEND}.
507    */
508   @SuppressWarnings("unchecked")
getMsSUPLEND()509   public SUPLEND getMsSUPLEND() {
510     if (!isMsSUPLEND()) {
511       throw new IllegalStateException("UlpMessage value not a MsSUPLEND");
512     }
513     return (SUPLEND) element;
514   }
515 
setMsSUPLEND(SUPLEND selected)516   public void setMsSUPLEND(SUPLEND selected) {
517     selection = Select.$MsSUPLEND;
518     extension = false;
519     element = selected;
520   }
521 
setMsSUPLENDToNewInstance()522   public SUPLEND setMsSUPLENDToNewInstance() {
523       SUPLEND element = new SUPLEND();
524       setMsSUPLEND(element);
525       return element;
526   }
527 
528 
529 
isMsSUPLAUTHREQ()530   public boolean isMsSUPLAUTHREQ() {
531     return !hasExtensionValue() && Select.$MsSUPLAUTHREQ == selection;
532   }
533 
534   /**
535    * @throws {@code IllegalStateException} if {@code !isMsSUPLAUTHREQ}.
536    */
537   @SuppressWarnings("unchecked")
getMsSUPLAUTHREQ()538   public SUPLAUTHREQ getMsSUPLAUTHREQ() {
539     if (!isMsSUPLAUTHREQ()) {
540       throw new IllegalStateException("UlpMessage value not a MsSUPLAUTHREQ");
541     }
542     return (SUPLAUTHREQ) element;
543   }
544 
setMsSUPLAUTHREQ(SUPLAUTHREQ selected)545   public void setMsSUPLAUTHREQ(SUPLAUTHREQ selected) {
546     selection = Select.$MsSUPLAUTHREQ;
547     extension = false;
548     element = selected;
549   }
550 
setMsSUPLAUTHREQToNewInstance()551   public SUPLAUTHREQ setMsSUPLAUTHREQToNewInstance() {
552       SUPLAUTHREQ element = new SUPLAUTHREQ();
553       setMsSUPLAUTHREQ(element);
554       return element;
555   }
556 
557 
558 
isMsSUPLAUTHRESP()559   public boolean isMsSUPLAUTHRESP() {
560     return !hasExtensionValue() && Select.$MsSUPLAUTHRESP == selection;
561   }
562 
563   /**
564    * @throws {@code IllegalStateException} if {@code !isMsSUPLAUTHRESP}.
565    */
566   @SuppressWarnings("unchecked")
getMsSUPLAUTHRESP()567   public SUPLAUTHRESP getMsSUPLAUTHRESP() {
568     if (!isMsSUPLAUTHRESP()) {
569       throw new IllegalStateException("UlpMessage value not a MsSUPLAUTHRESP");
570     }
571     return (SUPLAUTHRESP) element;
572   }
573 
setMsSUPLAUTHRESP(SUPLAUTHRESP selected)574   public void setMsSUPLAUTHRESP(SUPLAUTHRESP selected) {
575     selection = Select.$MsSUPLAUTHRESP;
576     extension = false;
577     element = selected;
578   }
579 
setMsSUPLAUTHRESPToNewInstance()580   public SUPLAUTHRESP setMsSUPLAUTHRESPToNewInstance() {
581       SUPLAUTHRESP element = new SUPLAUTHRESP();
582       setMsSUPLAUTHRESP(element);
583       return element;
584   }
585 
586 
587   private static enum Extend implements ChoiceComponent {
588 
589     $MsSUPLTRIGGEREDSTART(Asn1Tag.fromClassAndNumber(2, 8),
590         true) {
591       @Override
createElement()592       public Asn1Object createElement() {
593         return new Ver2_SUPLTRIGGEREDSTART();
594       }
595 
596       @Override
597       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)598       String elementIndentedString(Asn1Object element, String indent) {
599         return toString() + " : " + ((Ver2_SUPLTRIGGEREDSTART) element).toIndentedString(indent);
600       }
601     },
602 
603     $MsSUPLTRIGGEREDRESPONSE(Asn1Tag.fromClassAndNumber(2, 9),
604         true) {
605       @Override
createElement()606       public Asn1Object createElement() {
607         return new Ver2_SUPLTRIGGEREDRESPONSE();
608       }
609 
610       @Override
611       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)612       String elementIndentedString(Asn1Object element, String indent) {
613         return toString() + " : " + ((Ver2_SUPLTRIGGEREDRESPONSE) element).toIndentedString(indent);
614       }
615     },
616 
617     $MsSUPLTRIGGEREDSTOP(Asn1Tag.fromClassAndNumber(2, 10),
618         true) {
619       @Override
createElement()620       public Asn1Object createElement() {
621         return new Ver2_SUPLTRIGGEREDSTOP();
622       }
623 
624       @Override
625       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)626       String elementIndentedString(Asn1Object element, String indent) {
627         return toString() + " : " + ((Ver2_SUPLTRIGGEREDSTOP) element).toIndentedString(indent);
628       }
629     },
630 
631     $MsSUPLNOTIFY(Asn1Tag.fromClassAndNumber(2, 11),
632         true) {
633       @Override
createElement()634       public Asn1Object createElement() {
635         return new Ver2_SUPLNOTIFY();
636       }
637 
638       @Override
639       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)640       String elementIndentedString(Asn1Object element, String indent) {
641         return toString() + " : " + ((Ver2_SUPLNOTIFY) element).toIndentedString(indent);
642       }
643     },
644 
645     $MsSUPLNOTIFYRESPONSE(Asn1Tag.fromClassAndNumber(2, 12),
646         true) {
647       @Override
createElement()648       public Asn1Object createElement() {
649         return new Ver2_SUPLNOTIFYRESPONSE();
650       }
651 
652       @Override
653       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)654       String elementIndentedString(Asn1Object element, String indent) {
655         return toString() + " : " + ((Ver2_SUPLNOTIFYRESPONSE) element).toIndentedString(indent);
656       }
657     },
658 
659     $MsSUPLSETINIT(Asn1Tag.fromClassAndNumber(2, 13),
660         true) {
661       @Override
createElement()662       public Asn1Object createElement() {
663         return new Ver2_SUPLSETINIT();
664       }
665 
666       @Override
667       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)668       String elementIndentedString(Asn1Object element, String indent) {
669         return toString() + " : " + ((Ver2_SUPLSETINIT) element).toIndentedString(indent);
670       }
671     },
672 
673     $MsSUPLREPORT(Asn1Tag.fromClassAndNumber(2, 14),
674         true) {
675       @Override
createElement()676       public Asn1Object createElement() {
677         return new Ver2_SUPLREPORT();
678       }
679 
680       @Override
681       @SuppressWarnings("unchecked")
elementIndentedString(Asn1Object element, String indent)682       String elementIndentedString(Asn1Object element, String indent) {
683         return toString() + " : " + ((Ver2_SUPLREPORT) element).toIndentedString(indent);
684       }
685     },
686 
687     ;
688     @Nullable private final Asn1Tag tag;
689     private final boolean isImplicitTagging;
690 
Extend(@ullable Asn1Tag tag, boolean isImplicitTagging)691     Extend(@Nullable Asn1Tag tag, boolean isImplicitTagging) {
692       this.tag = tag;
693       this.isImplicitTagging = isImplicitTagging;
694     }
695 
createElement()696     public Asn1Object createElement() {
697       throw new IllegalStateException("Extend template error");
698     }
699 
700     @Override
701     @Nullable
getTag()702     public Asn1Tag getTag() {
703       return tag;
704     }
705 
706     @Override
isImplicitTagging()707     public boolean isImplicitTagging() {
708       return isImplicitTagging;
709     }
710 
elementIndentedString(Asn1Object element, String indent)711     String elementIndentedString(Asn1Object element, String indent) {
712       throw new IllegalStateException("Extend template error");
713     }
714   }
715 
716 
717 
isExtensionMsSUPLTRIGGEREDSTART()718   public boolean isExtensionMsSUPLTRIGGEREDSTART() {
719     return hasExtensionValue() && Extend.$MsSUPLTRIGGEREDSTART == selection;
720   }
721 
722   /**
723    * @throws {@code IllegalStateException} if {@code !isMsSUPLTRIGGEREDSTART}.
724    */
725   @SuppressWarnings("unchecked")
getExtensionMsSUPLTRIGGEREDSTART()726   public Ver2_SUPLTRIGGEREDSTART getExtensionMsSUPLTRIGGEREDSTART() {
727     if (!isExtensionMsSUPLTRIGGEREDSTART()) {
728       throw new IllegalStateException("UlpMessage value not a MsSUPLTRIGGEREDSTART");
729     }
730     return (Ver2_SUPLTRIGGEREDSTART) element;
731   }
732 
setExtensionMsSUPLTRIGGEREDSTART(Ver2_SUPLTRIGGEREDSTART selected)733   public void setExtensionMsSUPLTRIGGEREDSTART(Ver2_SUPLTRIGGEREDSTART selected) {
734     selection = Extend.$MsSUPLTRIGGEREDSTART;
735     extension = true;
736     element = selected;
737   }
738 
setExtensionMsSUPLTRIGGEREDSTARTToNewInstance()739   public void setExtensionMsSUPLTRIGGEREDSTARTToNewInstance() {
740       Ver2_SUPLTRIGGEREDSTART element = new Ver2_SUPLTRIGGEREDSTART();
741       setExtensionMsSUPLTRIGGEREDSTART(element);
742   }
743 
744 
745 
isExtensionMsSUPLTRIGGEREDRESPONSE()746   public boolean isExtensionMsSUPLTRIGGEREDRESPONSE() {
747     return hasExtensionValue() && Extend.$MsSUPLTRIGGEREDRESPONSE == selection;
748   }
749 
750   /**
751    * @throws {@code IllegalStateException} if {@code !isMsSUPLTRIGGEREDRESPONSE}.
752    */
753   @SuppressWarnings("unchecked")
getExtensionMsSUPLTRIGGEREDRESPONSE()754   public Ver2_SUPLTRIGGEREDRESPONSE getExtensionMsSUPLTRIGGEREDRESPONSE() {
755     if (!isExtensionMsSUPLTRIGGEREDRESPONSE()) {
756       throw new IllegalStateException("UlpMessage value not a MsSUPLTRIGGEREDRESPONSE");
757     }
758     return (Ver2_SUPLTRIGGEREDRESPONSE) element;
759   }
760 
setExtensionMsSUPLTRIGGEREDRESPONSE(Ver2_SUPLTRIGGEREDRESPONSE selected)761   public void setExtensionMsSUPLTRIGGEREDRESPONSE(Ver2_SUPLTRIGGEREDRESPONSE selected) {
762     selection = Extend.$MsSUPLTRIGGEREDRESPONSE;
763     extension = true;
764     element = selected;
765   }
766 
setExtensionMsSUPLTRIGGEREDRESPONSEToNewInstance()767   public void setExtensionMsSUPLTRIGGEREDRESPONSEToNewInstance() {
768       Ver2_SUPLTRIGGEREDRESPONSE element = new Ver2_SUPLTRIGGEREDRESPONSE();
769       setExtensionMsSUPLTRIGGEREDRESPONSE(element);
770   }
771 
772 
773 
isExtensionMsSUPLTRIGGEREDSTOP()774   public boolean isExtensionMsSUPLTRIGGEREDSTOP() {
775     return hasExtensionValue() && Extend.$MsSUPLTRIGGEREDSTOP == selection;
776   }
777 
778   /**
779    * @throws {@code IllegalStateException} if {@code !isMsSUPLTRIGGEREDSTOP}.
780    */
781   @SuppressWarnings("unchecked")
getExtensionMsSUPLTRIGGEREDSTOP()782   public Ver2_SUPLTRIGGEREDSTOP getExtensionMsSUPLTRIGGEREDSTOP() {
783     if (!isExtensionMsSUPLTRIGGEREDSTOP()) {
784       throw new IllegalStateException("UlpMessage value not a MsSUPLTRIGGEREDSTOP");
785     }
786     return (Ver2_SUPLTRIGGEREDSTOP) element;
787   }
788 
setExtensionMsSUPLTRIGGEREDSTOP(Ver2_SUPLTRIGGEREDSTOP selected)789   public void setExtensionMsSUPLTRIGGEREDSTOP(Ver2_SUPLTRIGGEREDSTOP selected) {
790     selection = Extend.$MsSUPLTRIGGEREDSTOP;
791     extension = true;
792     element = selected;
793   }
794 
setExtensionMsSUPLTRIGGEREDSTOPToNewInstance()795   public void setExtensionMsSUPLTRIGGEREDSTOPToNewInstance() {
796       Ver2_SUPLTRIGGEREDSTOP element = new Ver2_SUPLTRIGGEREDSTOP();
797       setExtensionMsSUPLTRIGGEREDSTOP(element);
798   }
799 
800 
801 
isExtensionMsSUPLNOTIFY()802   public boolean isExtensionMsSUPLNOTIFY() {
803     return hasExtensionValue() && Extend.$MsSUPLNOTIFY == selection;
804   }
805 
806   /**
807    * @throws {@code IllegalStateException} if {@code !isMsSUPLNOTIFY}.
808    */
809   @SuppressWarnings("unchecked")
getExtensionMsSUPLNOTIFY()810   public Ver2_SUPLNOTIFY getExtensionMsSUPLNOTIFY() {
811     if (!isExtensionMsSUPLNOTIFY()) {
812       throw new IllegalStateException("UlpMessage value not a MsSUPLNOTIFY");
813     }
814     return (Ver2_SUPLNOTIFY) element;
815   }
816 
setExtensionMsSUPLNOTIFY(Ver2_SUPLNOTIFY selected)817   public void setExtensionMsSUPLNOTIFY(Ver2_SUPLNOTIFY selected) {
818     selection = Extend.$MsSUPLNOTIFY;
819     extension = true;
820     element = selected;
821   }
822 
setExtensionMsSUPLNOTIFYToNewInstance()823   public void setExtensionMsSUPLNOTIFYToNewInstance() {
824       Ver2_SUPLNOTIFY element = new Ver2_SUPLNOTIFY();
825       setExtensionMsSUPLNOTIFY(element);
826   }
827 
828 
829 
isExtensionMsSUPLNOTIFYRESPONSE()830   public boolean isExtensionMsSUPLNOTIFYRESPONSE() {
831     return hasExtensionValue() && Extend.$MsSUPLNOTIFYRESPONSE == selection;
832   }
833 
834   /**
835    * @throws {@code IllegalStateException} if {@code !isMsSUPLNOTIFYRESPONSE}.
836    */
837   @SuppressWarnings("unchecked")
getExtensionMsSUPLNOTIFYRESPONSE()838   public Ver2_SUPLNOTIFYRESPONSE getExtensionMsSUPLNOTIFYRESPONSE() {
839     if (!isExtensionMsSUPLNOTIFYRESPONSE()) {
840       throw new IllegalStateException("UlpMessage value not a MsSUPLNOTIFYRESPONSE");
841     }
842     return (Ver2_SUPLNOTIFYRESPONSE) element;
843   }
844 
setExtensionMsSUPLNOTIFYRESPONSE(Ver2_SUPLNOTIFYRESPONSE selected)845   public void setExtensionMsSUPLNOTIFYRESPONSE(Ver2_SUPLNOTIFYRESPONSE selected) {
846     selection = Extend.$MsSUPLNOTIFYRESPONSE;
847     extension = true;
848     element = selected;
849   }
850 
setExtensionMsSUPLNOTIFYRESPONSEToNewInstance()851   public void setExtensionMsSUPLNOTIFYRESPONSEToNewInstance() {
852       Ver2_SUPLNOTIFYRESPONSE element = new Ver2_SUPLNOTIFYRESPONSE();
853       setExtensionMsSUPLNOTIFYRESPONSE(element);
854   }
855 
856 
857 
isExtensionMsSUPLSETINIT()858   public boolean isExtensionMsSUPLSETINIT() {
859     return hasExtensionValue() && Extend.$MsSUPLSETINIT == selection;
860   }
861 
862   /**
863    * @throws {@code IllegalStateException} if {@code !isMsSUPLSETINIT}.
864    */
865   @SuppressWarnings("unchecked")
getExtensionMsSUPLSETINIT()866   public Ver2_SUPLSETINIT getExtensionMsSUPLSETINIT() {
867     if (!isExtensionMsSUPLSETINIT()) {
868       throw new IllegalStateException("UlpMessage value not a MsSUPLSETINIT");
869     }
870     return (Ver2_SUPLSETINIT) element;
871   }
872 
setExtensionMsSUPLSETINIT(Ver2_SUPLSETINIT selected)873   public void setExtensionMsSUPLSETINIT(Ver2_SUPLSETINIT selected) {
874     selection = Extend.$MsSUPLSETINIT;
875     extension = true;
876     element = selected;
877   }
878 
setExtensionMsSUPLSETINITToNewInstance()879   public void setExtensionMsSUPLSETINITToNewInstance() {
880       Ver2_SUPLSETINIT element = new Ver2_SUPLSETINIT();
881       setExtensionMsSUPLSETINIT(element);
882   }
883 
884 
885 
isExtensionMsSUPLREPORT()886   public boolean isExtensionMsSUPLREPORT() {
887     return hasExtensionValue() && Extend.$MsSUPLREPORT == selection;
888   }
889 
890   /**
891    * @throws {@code IllegalStateException} if {@code !isMsSUPLREPORT}.
892    */
893   @SuppressWarnings("unchecked")
getExtensionMsSUPLREPORT()894   public Ver2_SUPLREPORT getExtensionMsSUPLREPORT() {
895     if (!isExtensionMsSUPLREPORT()) {
896       throw new IllegalStateException("UlpMessage value not a MsSUPLREPORT");
897     }
898     return (Ver2_SUPLREPORT) element;
899   }
900 
setExtensionMsSUPLREPORT(Ver2_SUPLREPORT selected)901   public void setExtensionMsSUPLREPORT(Ver2_SUPLREPORT selected) {
902     selection = Extend.$MsSUPLREPORT;
903     extension = true;
904     element = selected;
905   }
906 
setExtensionMsSUPLREPORTToNewInstance()907   public void setExtensionMsSUPLREPORTToNewInstance() {
908       Ver2_SUPLREPORT element = new Ver2_SUPLREPORT();
909       setExtensionMsSUPLREPORT(element);
910   }
911 
912 
encodePerUnaligned()913   @Override public Iterable<BitStream> encodePerUnaligned() {
914     return super.encodePerUnaligned();
915   }
916 
encodePerAligned()917   @Override public Iterable<BitStream> encodePerAligned() {
918     return super.encodePerAligned();
919   }
920 
decodePerUnaligned(BitStreamReader reader)921   @Override public void decodePerUnaligned(BitStreamReader reader) {
922     super.decodePerUnaligned(reader);
923   }
924 
decodePerAligned(BitStreamReader reader)925   @Override public void decodePerAligned(BitStreamReader reader) {
926     super.decodePerAligned(reader);
927   }
928 
toString()929   @Override public String toString() {
930     return toIndentedString("");
931   }
932 
elementIndentedString(String indent)933   private String elementIndentedString(String indent) {
934     if (element == null) {
935       return "null;\n";
936     }
937     if (extension) {
938       return Extend.values()[selection.ordinal()]
939           .elementIndentedString(element, indent + "  ");
940     } else {
941       return Select.values()[selection.ordinal()]
942           .elementIndentedString(element, indent + "  ");
943     }
944   }
945 
toIndentedString(String indent)946   public String toIndentedString(String indent) {
947     return "UlpMessage = " + elementIndentedString(indent) + indent + ";\n";
948   }
949 }
950