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.Asn1Enumerated;
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 MpathIndic extends Asn1Enumerated {
37   public enum Value implements Asn1Enumerated.Value {
38     notMeasured(0),
39     low(1),
40     medium(2),
41     high(3),
42     ;
43 
Value(int i)44     Value(int i) {
45       value = i;
46     }
47 
48     private int value;
getAssignedValue()49     public int getAssignedValue() {
50       return value;
51     }
52 
isExtensionValue()53     @Override public boolean isExtensionValue() {
54       return false;
55     }
56   }
57 
58   public enum ExtensionValue implements Asn1Enumerated.Value {
59     ;
60 
ExtensionValue(int i)61     ExtensionValue(int i) {
62       value = i;
63     }
64 
65     private int value;
getAssignedValue()66     @Override public int getAssignedValue() {
67       return value;
68     }
69 
isExtensionValue()70     @Override public boolean isExtensionValue() {
71       return true;
72     }
73   }
74 
75 
76 
77   private static final Asn1Tag TAG_MpathIndic
78       = Asn1Tag.fromClassAndNumber(-1, -1);
79 
MpathIndic()80   public MpathIndic() {
81     super();
82   }
83 
84   @Override
85   @Nullable
getTag()86   protected Asn1Tag getTag() {
87     return TAG_MpathIndic;
88   }
89 
90   @Override
isTagImplicit()91   protected boolean isTagImplicit() {
92     return true;
93   }
94 
getPossibleFirstTags()95   public static Collection<Asn1Tag> getPossibleFirstTags() {
96     if (TAG_MpathIndic != null) {
97       return ImmutableList.of(TAG_MpathIndic);
98     } else {
99       return Asn1Enumerated.getPossibleFirstTags();
100     }
101   }
102 
isExtensible()103   @Override protected boolean isExtensible() {
104     return false;
105   }
106 
lookupValue(int ordinal)107   @Override protected Asn1Enumerated.Value lookupValue(int ordinal) {
108     return Value.values()[ordinal];
109   }
110 
lookupExtensionValue(int ordinal)111   @Override protected Asn1Enumerated.Value lookupExtensionValue(int ordinal) {
112     return ExtensionValue.values()[ordinal];
113   }
114 
getValueCount()115   @Override protected int getValueCount() {
116     return Value.values().length;
117   }
118 
119   /**
120    * Creates a new MpathIndic from encoded stream.
121    */
fromPerUnaligned(byte[] encodedBytes)122   public static MpathIndic fromPerUnaligned(byte[] encodedBytes) {
123     MpathIndic result = new MpathIndic();
124     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
125     return result;
126   }
127 
128   /**
129    * Creates a new MpathIndic from encoded stream.
130    */
fromPerAligned(byte[] encodedBytes)131   public static MpathIndic fromPerAligned(byte[] encodedBytes) {
132     MpathIndic result = new MpathIndic();
133     result.decodePerAligned(new BitStreamReader(encodedBytes));
134     return result;
135   }
136 
encodePerUnaligned()137   @Override public Iterable<BitStream> encodePerUnaligned() {
138     return super.encodePerUnaligned();
139   }
140 
encodePerAligned()141   @Override public Iterable<BitStream> encodePerAligned() {
142     return super.encodePerAligned();
143   }
144 
decodePerUnaligned(BitStreamReader reader)145   @Override public void decodePerUnaligned(BitStreamReader reader) {
146     super.decodePerUnaligned(reader);
147   }
148 
decodePerAligned(BitStreamReader reader)149   @Override public void decodePerAligned(BitStreamReader reader) {
150     super.decodePerAligned(reader);
151   }
152 
toString()153   @Override public String toString() {
154     return toIndentedString("");
155   }
156 
toIndentedString(String indent)157   public String toIndentedString(String indent) {
158     return "MpathIndic = " + getValue() + ";\n";
159   }
160 }
161