Home | History | Annotate | Download | only in rrlp_components
      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.rrlp_components;
     18 
     19 /*
     20  */
     21 
     22 
     23 //
     24 //
     25 import android.location.cts.asn1.base.Asn1Integer;
     26 import android.location.cts.asn1.base.Asn1Null;
     27 import android.location.cts.asn1.base.Asn1Object;
     28 import android.location.cts.asn1.base.Asn1Sequence;
     29 import android.location.cts.asn1.base.Asn1Tag;
     30 import android.location.cts.asn1.base.BitStream;
     31 import android.location.cts.asn1.base.BitStreamReader;
     32 import android.location.cts.asn1.base.SequenceComponent;
     33 import com.google.common.collect.ImmutableList;
     34 import java.util.Collection;
     35 import javax.annotation.Nullable;
     36 
     37 
     38 /**
     39 */
     40 public  class OTD_MsrElementFirst extends Asn1Sequence {
     41   //
     42 
     43   private static final Asn1Tag TAG_OTD_MsrElementFirst
     44       = Asn1Tag.fromClassAndNumber(-1, -1);
     45 
     46   public OTD_MsrElementFirst() {
     47     super();
     48   }
     49 
     50   @Override
     51   @Nullable
     52   protected Asn1Tag getTag() {
     53     return TAG_OTD_MsrElementFirst;
     54   }
     55 
     56   @Override
     57   protected boolean isTagImplicit() {
     58     return true;
     59   }
     60 
     61   public static Collection<Asn1Tag> getPossibleFirstTags() {
     62     if (TAG_OTD_MsrElementFirst != null) {
     63       return ImmutableList.of(TAG_OTD_MsrElementFirst);
     64     } else {
     65       return Asn1Sequence.getPossibleFirstTags();
     66     }
     67   }
     68 
     69   /**
     70    * Creates a new OTD_MsrElementFirst from encoded stream.
     71    */
     72   public static OTD_MsrElementFirst fromPerUnaligned(byte[] encodedBytes) {
     73     OTD_MsrElementFirst result = new OTD_MsrElementFirst();
     74     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     75     return result;
     76   }
     77 
     78   /**
     79    * Creates a new OTD_MsrElementFirst from encoded stream.
     80    */
     81   public static OTD_MsrElementFirst fromPerAligned(byte[] encodedBytes) {
     82     OTD_MsrElementFirst result = new OTD_MsrElementFirst();
     83     result.decodePerAligned(new BitStreamReader(encodedBytes));
     84     return result;
     85   }
     86 
     87 
     88 
     89   @Override protected boolean isExtensible() {
     90     return false;
     91   }
     92 
     93   @Override public boolean containsExtensionValues() {
     94     for (SequenceComponent extensionComponent : getExtensionComponents()) {
     95       if (extensionComponent.isExplicitlySet()) return true;
     96     }
     97     return false;
     98   }
     99 
    100 
    101   private OTD_MsrElementFirst.refFrameNumberType refFrameNumber_;
    102   public OTD_MsrElementFirst.refFrameNumberType getRefFrameNumber() {
    103     return refFrameNumber_;
    104   }
    105   /**
    106    * @throws ClassCastException if value is not a OTD_MsrElementFirst.refFrameNumberType
    107    */
    108   public void setRefFrameNumber(Asn1Object value) {
    109     this.refFrameNumber_ = (OTD_MsrElementFirst.refFrameNumberType) value;
    110   }
    111   public OTD_MsrElementFirst.refFrameNumberType setRefFrameNumberToNewInstance() {
    112     refFrameNumber_ = new OTD_MsrElementFirst.refFrameNumberType();
    113     return refFrameNumber_;
    114   }
    115 
    116   private ModuloTimeSlot referenceTimeSlot_;
    117   public ModuloTimeSlot getReferenceTimeSlot() {
    118     return referenceTimeSlot_;
    119   }
    120   /**
    121    * @throws ClassCastException if value is not a ModuloTimeSlot
    122    */
    123   public void setReferenceTimeSlot(Asn1Object value) {
    124     this.referenceTimeSlot_ = (ModuloTimeSlot) value;
    125   }
    126   public ModuloTimeSlot setReferenceTimeSlotToNewInstance() {
    127     referenceTimeSlot_ = new ModuloTimeSlot();
    128     return referenceTimeSlot_;
    129   }
    130 
    131   private TOA_MeasurementsOfRef toaMeasurementsOfRef_;
    132   public TOA_MeasurementsOfRef getToaMeasurementsOfRef() {
    133     return toaMeasurementsOfRef_;
    134   }
    135   /**
    136    * @throws ClassCastException if value is not a TOA_MeasurementsOfRef
    137    */
    138   public void setToaMeasurementsOfRef(Asn1Object value) {
    139     this.toaMeasurementsOfRef_ = (TOA_MeasurementsOfRef) value;
    140   }
    141   public TOA_MeasurementsOfRef setToaMeasurementsOfRefToNewInstance() {
    142     toaMeasurementsOfRef_ = new TOA_MeasurementsOfRef();
    143     return toaMeasurementsOfRef_;
    144   }
    145 
    146   private StdResolution stdResolution_;
    147   public StdResolution getStdResolution() {
    148     return stdResolution_;
    149   }
    150   /**
    151    * @throws ClassCastException if value is not a StdResolution
    152    */
    153   public void setStdResolution(Asn1Object value) {
    154     this.stdResolution_ = (StdResolution) value;
    155   }
    156   public StdResolution setStdResolutionToNewInstance() {
    157     stdResolution_ = new StdResolution();
    158     return stdResolution_;
    159   }
    160 
    161   private OTD_MsrElementFirst.taCorrectionType taCorrection_;
    162   public OTD_MsrElementFirst.taCorrectionType getTaCorrection() {
    163     return taCorrection_;
    164   }
    165   /**
    166    * @throws ClassCastException if value is not a OTD_MsrElementFirst.taCorrectionType
    167    */
    168   public void setTaCorrection(Asn1Object value) {
    169     this.taCorrection_ = (OTD_MsrElementFirst.taCorrectionType) value;
    170   }
    171   public OTD_MsrElementFirst.taCorrectionType setTaCorrectionToNewInstance() {
    172     taCorrection_ = new OTD_MsrElementFirst.taCorrectionType();
    173     return taCorrection_;
    174   }
    175 
    176   private SeqOfOTD_FirstSetMsrs otd_FirstSetMsrs_;
    177   public SeqOfOTD_FirstSetMsrs getOtd_FirstSetMsrs() {
    178     return otd_FirstSetMsrs_;
    179   }
    180   /**
    181    * @throws ClassCastException if value is not a SeqOfOTD_FirstSetMsrs
    182    */
    183   public void setOtd_FirstSetMsrs(Asn1Object value) {
    184     this.otd_FirstSetMsrs_ = (SeqOfOTD_FirstSetMsrs) value;
    185   }
    186   public SeqOfOTD_FirstSetMsrs setOtd_FirstSetMsrsToNewInstance() {
    187     otd_FirstSetMsrs_ = new SeqOfOTD_FirstSetMsrs();
    188     return otd_FirstSetMsrs_;
    189   }
    190 
    191 
    192 
    193 
    194 
    195 
    196   @Override public Iterable<? extends SequenceComponent> getComponents() {
    197     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    198 
    199     builder.add(new SequenceComponent() {
    200           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
    201 
    202           @Override public boolean isExplicitlySet() {
    203             return getRefFrameNumber() != null;
    204           }
    205 
    206           @Override public boolean hasDefaultValue() {
    207             return false;
    208           }
    209 
    210           @Override public boolean isOptional() {
    211             return false;
    212           }
    213 
    214           @Override public Asn1Object getComponentValue() {
    215             return getRefFrameNumber();
    216           }
    217 
    218           @Override public void setToNewInstance() {
    219             setRefFrameNumberToNewInstance();
    220           }
    221 
    222           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    223             return tag == null ? OTD_MsrElementFirst.refFrameNumberType.getPossibleFirstTags() : ImmutableList.of(tag);
    224           }
    225 
    226           @Override
    227           public Asn1Tag getTag() {
    228             return tag;
    229           }
    230 
    231           @Override
    232           public boolean isImplicitTagging() {
    233             return true;
    234           }
    235 
    236           @Override public String toIndentedString(String indent) {
    237                 return "refFrameNumber : "
    238                     + getRefFrameNumber().toIndentedString(indent);
    239               }
    240         });
    241 
    242     builder.add(new SequenceComponent() {
    243           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
    244 
    245           @Override public boolean isExplicitlySet() {
    246             return getReferenceTimeSlot() != null;
    247           }
    248 
    249           @Override public boolean hasDefaultValue() {
    250             return false;
    251           }
    252 
    253           @Override public boolean isOptional() {
    254             return false;
    255           }
    256 
    257           @Override public Asn1Object getComponentValue() {
    258             return getReferenceTimeSlot();
    259           }
    260 
    261           @Override public void setToNewInstance() {
    262             setReferenceTimeSlotToNewInstance();
    263           }
    264 
    265           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    266             return tag == null ? ModuloTimeSlot.getPossibleFirstTags() : ImmutableList.of(tag);
    267           }
    268 
    269           @Override
    270           public Asn1Tag getTag() {
    271             return tag;
    272           }
    273 
    274           @Override
    275           public boolean isImplicitTagging() {
    276             return true;
    277           }
    278 
    279           @Override public String toIndentedString(String indent) {
    280                 return "referenceTimeSlot : "
    281                     + getReferenceTimeSlot().toIndentedString(indent);
    282               }
    283         });
    284 
    285     builder.add(new SequenceComponent() {
    286           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);
    287 
    288           @Override public boolean isExplicitlySet() {
    289             return getToaMeasurementsOfRef() != null;
    290           }
    291 
    292           @Override public boolean hasDefaultValue() {
    293             return false;
    294           }
    295 
    296           @Override public boolean isOptional() {
    297             return true;
    298           }
    299 
    300           @Override public Asn1Object getComponentValue() {
    301             return getToaMeasurementsOfRef();
    302           }
    303 
    304           @Override public void setToNewInstance() {
    305             setToaMeasurementsOfRefToNewInstance();
    306           }
    307 
    308           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    309             return tag == null ? TOA_MeasurementsOfRef.getPossibleFirstTags() : ImmutableList.of(tag);
    310           }
    311 
    312           @Override
    313           public Asn1Tag getTag() {
    314             return tag;
    315           }
    316 
    317           @Override
    318           public boolean isImplicitTagging() {
    319             return true;
    320           }
    321 
    322           @Override public String toIndentedString(String indent) {
    323                 return "toaMeasurementsOfRef : "
    324                     + getToaMeasurementsOfRef().toIndentedString(indent);
    325               }
    326         });
    327 
    328     builder.add(new SequenceComponent() {
    329           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);
    330 
    331           @Override public boolean isExplicitlySet() {
    332             return getStdResolution() != null;
    333           }
    334 
    335           @Override public boolean hasDefaultValue() {
    336             return false;
    337           }
    338 
    339           @Override public boolean isOptional() {
    340             return false;
    341           }
    342 
    343           @Override public Asn1Object getComponentValue() {
    344             return getStdResolution();
    345           }
    346 
    347           @Override public void setToNewInstance() {
    348             setStdResolutionToNewInstance();
    349           }
    350 
    351           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    352             return tag == null ? StdResolution.getPossibleFirstTags() : ImmutableList.of(tag);
    353           }
    354 
    355           @Override
    356           public Asn1Tag getTag() {
    357             return tag;
    358           }
    359 
    360           @Override
    361           public boolean isImplicitTagging() {
    362             return true;
    363           }
    364 
    365           @Override public String toIndentedString(String indent) {
    366                 return "stdResolution : "
    367                     + getStdResolution().toIndentedString(indent);
    368               }
    369         });
    370 
    371     builder.add(new SequenceComponent() {
    372           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4);
    373 
    374           @Override public boolean isExplicitlySet() {
    375             return getTaCorrection() != null;
    376           }
    377 
    378           @Override public boolean hasDefaultValue() {
    379             return false;
    380           }
    381 
    382           @Override public boolean isOptional() {
    383             return true;
    384           }
    385 
    386           @Override public Asn1Object getComponentValue() {
    387             return getTaCorrection();
    388           }
    389 
    390           @Override public void setToNewInstance() {
    391             setTaCorrectionToNewInstance();
    392           }
    393 
    394           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    395             return tag == null ? OTD_MsrElementFirst.taCorrectionType.getPossibleFirstTags() : ImmutableList.of(tag);
    396           }
    397 
    398           @Override
    399           public Asn1Tag getTag() {
    400             return tag;
    401           }
    402 
    403           @Override
    404           public boolean isImplicitTagging() {
    405             return true;
    406           }
    407 
    408           @Override public String toIndentedString(String indent) {
    409                 return "taCorrection : "
    410                     + getTaCorrection().toIndentedString(indent);
    411               }
    412         });
    413 
    414     builder.add(new SequenceComponent() {
    415           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 5);
    416 
    417           @Override public boolean isExplicitlySet() {
    418             return getOtd_FirstSetMsrs() != null;
    419           }
    420 
    421           @Override public boolean hasDefaultValue() {
    422             return false;
    423           }
    424 
    425           @Override public boolean isOptional() {
    426             return true;
    427           }
    428 
    429           @Override public Asn1Object getComponentValue() {
    430             return getOtd_FirstSetMsrs();
    431           }
    432 
    433           @Override public void setToNewInstance() {
    434             setOtd_FirstSetMsrsToNewInstance();
    435           }
    436 
    437           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    438             return tag == null ? SeqOfOTD_FirstSetMsrs.getPossibleFirstTags() : ImmutableList.of(tag);
    439           }
    440 
    441           @Override
    442           public Asn1Tag getTag() {
    443             return tag;
    444           }
    445 
    446           @Override
    447           public boolean isImplicitTagging() {
    448             return true;
    449           }
    450 
    451           @Override public String toIndentedString(String indent) {
    452                 return "otd_FirstSetMsrs : "
    453                     + getOtd_FirstSetMsrs().toIndentedString(indent);
    454               }
    455         });
    456 
    457     return builder.build();
    458   }
    459 
    460   @Override public Iterable<? extends SequenceComponent>
    461                                                     getExtensionComponents() {
    462     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    463 
    464       return builder.build();
    465     }
    466 
    467 
    468 /*
    469  */
    470 
    471 
    472 //
    473 
    474 /**
    475  */
    476 public static class refFrameNumberType extends Asn1Integer {
    477   //
    478 
    479   private static final Asn1Tag TAG_refFrameNumberType
    480       = Asn1Tag.fromClassAndNumber(-1, -1);
    481 
    482   public refFrameNumberType() {
    483     super();
    484     setValueRange("0", "42431");
    485 
    486   }
    487 
    488   @Override
    489   @Nullable
    490   protected Asn1Tag getTag() {
    491     return TAG_refFrameNumberType;
    492   }
    493 
    494   @Override
    495   protected boolean isTagImplicit() {
    496     return true;
    497   }
    498 
    499   public static Collection<Asn1Tag> getPossibleFirstTags() {
    500     if (TAG_refFrameNumberType != null) {
    501       return ImmutableList.of(TAG_refFrameNumberType);
    502     } else {
    503       return Asn1Integer.getPossibleFirstTags();
    504     }
    505   }
    506 
    507   /**
    508    * Creates a new refFrameNumberType from encoded stream.
    509    */
    510   public static refFrameNumberType fromPerUnaligned(byte[] encodedBytes) {
    511     refFrameNumberType result = new refFrameNumberType();
    512     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    513     return result;
    514   }
    515 
    516   /**
    517    * Creates a new refFrameNumberType from encoded stream.
    518    */
    519   public static refFrameNumberType fromPerAligned(byte[] encodedBytes) {
    520     refFrameNumberType result = new refFrameNumberType();
    521     result.decodePerAligned(new BitStreamReader(encodedBytes));
    522     return result;
    523   }
    524 
    525   @Override public Iterable<BitStream> encodePerUnaligned() {
    526     return super.encodePerUnaligned();
    527   }
    528 
    529   @Override public Iterable<BitStream> encodePerAligned() {
    530     return super.encodePerAligned();
    531   }
    532 
    533   @Override public void decodePerUnaligned(BitStreamReader reader) {
    534     super.decodePerUnaligned(reader);
    535   }
    536 
    537   @Override public void decodePerAligned(BitStreamReader reader) {
    538     super.decodePerAligned(reader);
    539   }
    540 
    541   @Override public String toString() {
    542     return toIndentedString("");
    543   }
    544 
    545   public String toIndentedString(String indent) {
    546     return "refFrameNumberType = " + getInteger() + ";\n";
    547   }
    548 }
    549 
    550 
    551 
    552 
    553 
    554 
    555 
    556 
    557 /*
    558  */
    559 
    560 
    561 //
    562 
    563 /**
    564  */
    565 public static class taCorrectionType extends Asn1Integer {
    566   //
    567 
    568   private static final Asn1Tag TAG_taCorrectionType
    569       = Asn1Tag.fromClassAndNumber(-1, -1);
    570 
    571   public taCorrectionType() {
    572     super();
    573     setValueRange("0", "960");
    574 
    575   }
    576 
    577   @Override
    578   @Nullable
    579   protected Asn1Tag getTag() {
    580     return TAG_taCorrectionType;
    581   }
    582 
    583   @Override
    584   protected boolean isTagImplicit() {
    585     return true;
    586   }
    587 
    588   public static Collection<Asn1Tag> getPossibleFirstTags() {
    589     if (TAG_taCorrectionType != null) {
    590       return ImmutableList.of(TAG_taCorrectionType);
    591     } else {
    592       return Asn1Integer.getPossibleFirstTags();
    593     }
    594   }
    595 
    596   /**
    597    * Creates a new taCorrectionType from encoded stream.
    598    */
    599   public static taCorrectionType fromPerUnaligned(byte[] encodedBytes) {
    600     taCorrectionType result = new taCorrectionType();
    601     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    602     return result;
    603   }
    604 
    605   /**
    606    * Creates a new taCorrectionType from encoded stream.
    607    */
    608   public static taCorrectionType fromPerAligned(byte[] encodedBytes) {
    609     taCorrectionType result = new taCorrectionType();
    610     result.decodePerAligned(new BitStreamReader(encodedBytes));
    611     return result;
    612   }
    613 
    614   @Override public Iterable<BitStream> encodePerUnaligned() {
    615     return super.encodePerUnaligned();
    616   }
    617 
    618   @Override public Iterable<BitStream> encodePerAligned() {
    619     return super.encodePerAligned();
    620   }
    621 
    622   @Override public void decodePerUnaligned(BitStreamReader reader) {
    623     super.decodePerUnaligned(reader);
    624   }
    625 
    626   @Override public void decodePerAligned(BitStreamReader reader) {
    627     super.decodePerAligned(reader);
    628   }
    629 
    630   @Override public String toString() {
    631     return toIndentedString("");
    632   }
    633 
    634   public String toIndentedString(String indent) {
    635     return "taCorrectionType = " + getInteger() + ";\n";
    636   }
    637 }
    638 
    639 
    640 
    641 
    642 
    643 
    644 
    645   @Override public Iterable<BitStream> encodePerUnaligned() {
    646     return super.encodePerUnaligned();
    647   }
    648 
    649   @Override public Iterable<BitStream> encodePerAligned() {
    650     return super.encodePerAligned();
    651   }
    652 
    653   @Override public void decodePerUnaligned(BitStreamReader reader) {
    654     super.decodePerUnaligned(reader);
    655   }
    656 
    657   @Override public void decodePerAligned(BitStreamReader reader) {
    658     super.decodePerAligned(reader);
    659   }
    660 
    661   @Override public String toString() {
    662     return toIndentedString("");
    663   }
    664 
    665   public String toIndentedString(String indent) {
    666     StringBuilder builder = new StringBuilder();
    667     builder.append("OTD_MsrElementFirst = {\n");
    668     final String internalIndent = indent + "  ";
    669     for (SequenceComponent component : getComponents()) {
    670       if (component.isExplicitlySet()) {
    671         builder.append(internalIndent)
    672             .append(component.toIndentedString(internalIndent));
    673       }
    674     }
    675     if (isExtensible()) {
    676       builder.append(internalIndent).append("...\n");
    677       for (SequenceComponent component : getExtensionComponents()) {
    678         if (component.isExplicitlySet()) {
    679           builder.append(internalIndent)
    680               .append(component.toIndentedString(internalIndent));
    681         }
    682       }
    683     }
    684     builder.append(indent).append("};\n");
    685     return builder.toString();
    686   }
    687 }
    688