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.Asn1Tag;
     27 import android.location.cts.asn1.base.BitStream;
     28 import android.location.cts.asn1.base.BitStreamReader;
     29 import com.google.common.collect.ImmutableList;
     30 import java.util.Collection;
     31 import javax.annotation.Nullable;
     32 
     33 
     34 /**
     35  */
     36 public  class LAC extends Asn1Integer {
     37   //
     38 
     39   private static final Asn1Tag TAG_LAC
     40       = Asn1Tag.fromClassAndNumber(-1, -1);
     41 
     42   public LAC() {
     43     super();
     44     setValueRange("0", "65535");
     45 
     46   }
     47 
     48   @Override
     49   @Nullable
     50   protected Asn1Tag getTag() {
     51     return TAG_LAC;
     52   }
     53 
     54   @Override
     55   protected boolean isTagImplicit() {
     56     return true;
     57   }
     58 
     59   public static Collection<Asn1Tag> getPossibleFirstTags() {
     60     if (TAG_LAC != null) {
     61       return ImmutableList.of(TAG_LAC);
     62     } else {
     63       return Asn1Integer.getPossibleFirstTags();
     64     }
     65   }
     66 
     67   /**
     68    * Creates a new LAC from encoded stream.
     69    */
     70   public static LAC fromPerUnaligned(byte[] encodedBytes) {
     71     LAC result = new LAC();
     72     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     73     return result;
     74   }
     75 
     76   /**
     77    * Creates a new LAC from encoded stream.
     78    */
     79   public static LAC fromPerAligned(byte[] encodedBytes) {
     80     LAC result = new LAC();
     81     result.decodePerAligned(new BitStreamReader(encodedBytes));
     82     return result;
     83   }
     84 
     85   @Override public Iterable<BitStream> encodePerUnaligned() {
     86     return super.encodePerUnaligned();
     87   }
     88 
     89   @Override public Iterable<BitStream> encodePerAligned() {
     90     return super.encodePerAligned();
     91   }
     92 
     93   @Override public void decodePerUnaligned(BitStreamReader reader) {
     94     super.decodePerUnaligned(reader);
     95   }
     96 
     97   @Override public void decodePerAligned(BitStreamReader reader) {
     98     super.decodePerAligned(reader);
     99   }
    100 
    101   @Override public String toString() {
    102     return toIndentedString("");
    103   }
    104 
    105   public String toIndentedString(String indent) {
    106     return "LAC = " + getInteger() + ";\n";
    107   }
    108 }
    109