Home | History | Annotate | Download | only in ver2_ulp_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.ver2_ulp_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 ReportingCap extends Asn1Sequence {
     41   //
     42 
     43   private static final Asn1Tag TAG_ReportingCap
     44       = Asn1Tag.fromClassAndNumber(-1, -1);
     45 
     46   public ReportingCap() {
     47     super();
     48   }
     49 
     50   @Override
     51   @Nullable
     52   protected Asn1Tag getTag() {
     53     return TAG_ReportingCap;
     54   }
     55 
     56   @Override
     57   protected boolean isTagImplicit() {
     58     return true;
     59   }
     60 
     61   public static Collection<Asn1Tag> getPossibleFirstTags() {
     62     if (TAG_ReportingCap != null) {
     63       return ImmutableList.of(TAG_ReportingCap);
     64     } else {
     65       return Asn1Sequence.getPossibleFirstTags();
     66     }
     67   }
     68 
     69   /**
     70    * Creates a new ReportingCap from encoded stream.
     71    */
     72   public static ReportingCap fromPerUnaligned(byte[] encodedBytes) {
     73     ReportingCap result = new ReportingCap();
     74     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     75     return result;
     76   }
     77 
     78   /**
     79    * Creates a new ReportingCap from encoded stream.
     80    */
     81   public static ReportingCap fromPerAligned(byte[] encodedBytes) {
     82     ReportingCap result = new ReportingCap();
     83     result.decodePerAligned(new BitStreamReader(encodedBytes));
     84     return result;
     85   }
     86 
     87 
     88 
     89   @Override protected boolean isExtensible() {
     90     return true;
     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 ReportingCap.minIntType minInt_;
    102   public ReportingCap.minIntType getMinInt() {
    103     return minInt_;
    104   }
    105   /**
    106    * @throws ClassCastException if value is not a ReportingCap.minIntType
    107    */
    108   public void setMinInt(Asn1Object value) {
    109     this.minInt_ = (ReportingCap.minIntType) value;
    110   }
    111   public ReportingCap.minIntType setMinIntToNewInstance() {
    112     minInt_ = new ReportingCap.minIntType();
    113     return minInt_;
    114   }
    115 
    116   private ReportingCap.maxIntType maxInt_;
    117   public ReportingCap.maxIntType getMaxInt() {
    118     return maxInt_;
    119   }
    120   /**
    121    * @throws ClassCastException if value is not a ReportingCap.maxIntType
    122    */
    123   public void setMaxInt(Asn1Object value) {
    124     this.maxInt_ = (ReportingCap.maxIntType) value;
    125   }
    126   public ReportingCap.maxIntType setMaxIntToNewInstance() {
    127     maxInt_ = new ReportingCap.maxIntType();
    128     return maxInt_;
    129   }
    130 
    131   private RepMode_cap repMode_;
    132   public RepMode_cap getRepMode() {
    133     return repMode_;
    134   }
    135   /**
    136    * @throws ClassCastException if value is not a RepMode_cap
    137    */
    138   public void setRepMode(Asn1Object value) {
    139     this.repMode_ = (RepMode_cap) value;
    140   }
    141   public RepMode_cap setRepModeToNewInstance() {
    142     repMode_ = new RepMode_cap();
    143     return repMode_;
    144   }
    145 
    146   private BatchRepCap batchRepCap_;
    147   public BatchRepCap getBatchRepCap() {
    148     return batchRepCap_;
    149   }
    150   /**
    151    * @throws ClassCastException if value is not a BatchRepCap
    152    */
    153   public void setBatchRepCap(Asn1Object value) {
    154     this.batchRepCap_ = (BatchRepCap) value;
    155   }
    156   public BatchRepCap setBatchRepCapToNewInstance() {
    157     batchRepCap_ = new BatchRepCap();
    158     return batchRepCap_;
    159   }
    160 
    161 
    162 
    163 
    164 
    165 
    166   @Override public Iterable<? extends SequenceComponent> getComponents() {
    167     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    168 
    169     builder.add(new SequenceComponent() {
    170           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
    171 
    172           @Override public boolean isExplicitlySet() {
    173             return getMinInt() != null;
    174           }
    175 
    176           @Override public boolean hasDefaultValue() {
    177             return false;
    178           }
    179 
    180           @Override public boolean isOptional() {
    181             return false;
    182           }
    183 
    184           @Override public Asn1Object getComponentValue() {
    185             return getMinInt();
    186           }
    187 
    188           @Override public void setToNewInstance() {
    189             setMinIntToNewInstance();
    190           }
    191 
    192           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    193             return tag == null ? ReportingCap.minIntType.getPossibleFirstTags() : ImmutableList.of(tag);
    194           }
    195 
    196           @Override
    197           public Asn1Tag getTag() {
    198             return tag;
    199           }
    200 
    201           @Override
    202           public boolean isImplicitTagging() {
    203             return true;
    204           }
    205 
    206           @Override public String toIndentedString(String indent) {
    207                 return "minInt : "
    208                     + getMinInt().toIndentedString(indent);
    209               }
    210         });
    211 
    212     builder.add(new SequenceComponent() {
    213           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
    214 
    215           @Override public boolean isExplicitlySet() {
    216             return getMaxInt() != null;
    217           }
    218 
    219           @Override public boolean hasDefaultValue() {
    220             return false;
    221           }
    222 
    223           @Override public boolean isOptional() {
    224             return true;
    225           }
    226 
    227           @Override public Asn1Object getComponentValue() {
    228             return getMaxInt();
    229           }
    230 
    231           @Override public void setToNewInstance() {
    232             setMaxIntToNewInstance();
    233           }
    234 
    235           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    236             return tag == null ? ReportingCap.maxIntType.getPossibleFirstTags() : ImmutableList.of(tag);
    237           }
    238 
    239           @Override
    240           public Asn1Tag getTag() {
    241             return tag;
    242           }
    243 
    244           @Override
    245           public boolean isImplicitTagging() {
    246             return true;
    247           }
    248 
    249           @Override public String toIndentedString(String indent) {
    250                 return "maxInt : "
    251                     + getMaxInt().toIndentedString(indent);
    252               }
    253         });
    254 
    255     builder.add(new SequenceComponent() {
    256           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);
    257 
    258           @Override public boolean isExplicitlySet() {
    259             return getRepMode() != null;
    260           }
    261 
    262           @Override public boolean hasDefaultValue() {
    263             return false;
    264           }
    265 
    266           @Override public boolean isOptional() {
    267             return false;
    268           }
    269 
    270           @Override public Asn1Object getComponentValue() {
    271             return getRepMode();
    272           }
    273 
    274           @Override public void setToNewInstance() {
    275             setRepModeToNewInstance();
    276           }
    277 
    278           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    279             return tag == null ? RepMode_cap.getPossibleFirstTags() : ImmutableList.of(tag);
    280           }
    281 
    282           @Override
    283           public Asn1Tag getTag() {
    284             return tag;
    285           }
    286 
    287           @Override
    288           public boolean isImplicitTagging() {
    289             return true;
    290           }
    291 
    292           @Override public String toIndentedString(String indent) {
    293                 return "repMode : "
    294                     + getRepMode().toIndentedString(indent);
    295               }
    296         });
    297 
    298     builder.add(new SequenceComponent() {
    299           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);
    300 
    301           @Override public boolean isExplicitlySet() {
    302             return getBatchRepCap() != null;
    303           }
    304 
    305           @Override public boolean hasDefaultValue() {
    306             return false;
    307           }
    308 
    309           @Override public boolean isOptional() {
    310             return true;
    311           }
    312 
    313           @Override public Asn1Object getComponentValue() {
    314             return getBatchRepCap();
    315           }
    316 
    317           @Override public void setToNewInstance() {
    318             setBatchRepCapToNewInstance();
    319           }
    320 
    321           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    322             return tag == null ? BatchRepCap.getPossibleFirstTags() : ImmutableList.of(tag);
    323           }
    324 
    325           @Override
    326           public Asn1Tag getTag() {
    327             return tag;
    328           }
    329 
    330           @Override
    331           public boolean isImplicitTagging() {
    332             return true;
    333           }
    334 
    335           @Override public String toIndentedString(String indent) {
    336                 return "batchRepCap : "
    337                     + getBatchRepCap().toIndentedString(indent);
    338               }
    339         });
    340 
    341     return builder.build();
    342   }
    343 
    344   @Override public Iterable<? extends SequenceComponent>
    345                                                     getExtensionComponents() {
    346     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    347 
    348       return builder.build();
    349     }
    350 
    351 
    352 /*
    353  */
    354 
    355 
    356 //
    357 
    358 /**
    359  */
    360 public static class minIntType extends Asn1Integer {
    361   //
    362 
    363   private static final Asn1Tag TAG_minIntType
    364       = Asn1Tag.fromClassAndNumber(-1, -1);
    365 
    366   public minIntType() {
    367     super();
    368     setValueRange("1", "3600");
    369 
    370   }
    371 
    372   @Override
    373   @Nullable
    374   protected Asn1Tag getTag() {
    375     return TAG_minIntType;
    376   }
    377 
    378   @Override
    379   protected boolean isTagImplicit() {
    380     return true;
    381   }
    382 
    383   public static Collection<Asn1Tag> getPossibleFirstTags() {
    384     if (TAG_minIntType != null) {
    385       return ImmutableList.of(TAG_minIntType);
    386     } else {
    387       return Asn1Integer.getPossibleFirstTags();
    388     }
    389   }
    390 
    391   /**
    392    * Creates a new minIntType from encoded stream.
    393    */
    394   public static minIntType fromPerUnaligned(byte[] encodedBytes) {
    395     minIntType result = new minIntType();
    396     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    397     return result;
    398   }
    399 
    400   /**
    401    * Creates a new minIntType from encoded stream.
    402    */
    403   public static minIntType fromPerAligned(byte[] encodedBytes) {
    404     minIntType result = new minIntType();
    405     result.decodePerAligned(new BitStreamReader(encodedBytes));
    406     return result;
    407   }
    408 
    409   @Override public Iterable<BitStream> encodePerUnaligned() {
    410     return super.encodePerUnaligned();
    411   }
    412 
    413   @Override public Iterable<BitStream> encodePerAligned() {
    414     return super.encodePerAligned();
    415   }
    416 
    417   @Override public void decodePerUnaligned(BitStreamReader reader) {
    418     super.decodePerUnaligned(reader);
    419   }
    420 
    421   @Override public void decodePerAligned(BitStreamReader reader) {
    422     super.decodePerAligned(reader);
    423   }
    424 
    425   @Override public String toString() {
    426     return toIndentedString("");
    427   }
    428 
    429   public String toIndentedString(String indent) {
    430     return "minIntType = " + getInteger() + ";\n";
    431   }
    432 }
    433 
    434 
    435 /*
    436  */
    437 
    438 
    439 //
    440 
    441 /**
    442  */
    443 public static class maxIntType extends Asn1Integer {
    444   //
    445 
    446   private static final Asn1Tag TAG_maxIntType
    447       = Asn1Tag.fromClassAndNumber(-1, -1);
    448 
    449   public maxIntType() {
    450     super();
    451     setValueRange("1", "1440");
    452 
    453   }
    454 
    455   @Override
    456   @Nullable
    457   protected Asn1Tag getTag() {
    458     return TAG_maxIntType;
    459   }
    460 
    461   @Override
    462   protected boolean isTagImplicit() {
    463     return true;
    464   }
    465 
    466   public static Collection<Asn1Tag> getPossibleFirstTags() {
    467     if (TAG_maxIntType != null) {
    468       return ImmutableList.of(TAG_maxIntType);
    469     } else {
    470       return Asn1Integer.getPossibleFirstTags();
    471     }
    472   }
    473 
    474   /**
    475    * Creates a new maxIntType from encoded stream.
    476    */
    477   public static maxIntType fromPerUnaligned(byte[] encodedBytes) {
    478     maxIntType result = new maxIntType();
    479     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    480     return result;
    481   }
    482 
    483   /**
    484    * Creates a new maxIntType from encoded stream.
    485    */
    486   public static maxIntType fromPerAligned(byte[] encodedBytes) {
    487     maxIntType result = new maxIntType();
    488     result.decodePerAligned(new BitStreamReader(encodedBytes));
    489     return result;
    490   }
    491 
    492   @Override public Iterable<BitStream> encodePerUnaligned() {
    493     return super.encodePerUnaligned();
    494   }
    495 
    496   @Override public Iterable<BitStream> encodePerAligned() {
    497     return super.encodePerAligned();
    498   }
    499 
    500   @Override public void decodePerUnaligned(BitStreamReader reader) {
    501     super.decodePerUnaligned(reader);
    502   }
    503 
    504   @Override public void decodePerAligned(BitStreamReader reader) {
    505     super.decodePerAligned(reader);
    506   }
    507 
    508   @Override public String toString() {
    509     return toIndentedString("");
    510   }
    511 
    512   public String toIndentedString(String indent) {
    513     return "maxIntType = " + getInteger() + ";\n";
    514   }
    515 }
    516 
    517 
    518 
    519 
    520 
    521 
    522 
    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     StringBuilder builder = new StringBuilder();
    547     builder.append("ReportingCap = {\n");
    548     final String internalIndent = indent + "  ";
    549     for (SequenceComponent component : getComponents()) {
    550       if (component.isExplicitlySet()) {
    551         builder.append(internalIndent)
    552             .append(component.toIndentedString(internalIndent));
    553       }
    554     }
    555     if (isExtensible()) {
    556       builder.append(internalIndent).append("...\n");
    557       for (SequenceComponent component : getExtensionComponents()) {
    558         if (component.isExplicitlySet()) {
    559           builder.append(internalIndent)
    560               .append(component.toIndentedString(internalIndent));
    561         }
    562       }
    563     }
    564     builder.append(indent).append("};\n");
    565     return builder.toString();
    566   }
    567 }
    568