• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AddionalAngleFields extends Asn1Sequence {
41   //
42 
43   private static final Asn1Tag TAG_AddionalAngleFields
44       = Asn1Tag.fromClassAndNumber(-1, -1);
45 
AddionalAngleFields()46   public AddionalAngleFields() {
47     super();
48   }
49 
50   @Override
51   @Nullable
getTag()52   protected Asn1Tag getTag() {
53     return TAG_AddionalAngleFields;
54   }
55 
56   @Override
isTagImplicit()57   protected boolean isTagImplicit() {
58     return true;
59   }
60 
getPossibleFirstTags()61   public static Collection<Asn1Tag> getPossibleFirstTags() {
62     if (TAG_AddionalAngleFields != null) {
63       return ImmutableList.of(TAG_AddionalAngleFields);
64     } else {
65       return Asn1Sequence.getPossibleFirstTags();
66     }
67   }
68 
69   /**
70    * Creates a new AddionalAngleFields from encoded stream.
71    */
fromPerUnaligned(byte[] encodedBytes)72   public static AddionalAngleFields fromPerUnaligned(byte[] encodedBytes) {
73     AddionalAngleFields result = new AddionalAngleFields();
74     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
75     return result;
76   }
77 
78   /**
79    * Creates a new AddionalAngleFields from encoded stream.
80    */
fromPerAligned(byte[] encodedBytes)81   public static AddionalAngleFields fromPerAligned(byte[] encodedBytes) {
82     AddionalAngleFields result = new AddionalAngleFields();
83     result.decodePerAligned(new BitStreamReader(encodedBytes));
84     return result;
85   }
86 
87 
88 
isExtensible()89   @Override protected boolean isExtensible() {
90     return false;
91   }
92 
containsExtensionValues()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 AddionalAngleFields.azimuthType azimuth_;
getAzimuth()102   public AddionalAngleFields.azimuthType getAzimuth() {
103     return azimuth_;
104   }
105   /**
106    * @throws ClassCastException if value is not a AddionalAngleFields.azimuthType
107    */
setAzimuth(Asn1Object value)108   public void setAzimuth(Asn1Object value) {
109     this.azimuth_ = (AddionalAngleFields.azimuthType) value;
110   }
setAzimuthToNewInstance()111   public AddionalAngleFields.azimuthType setAzimuthToNewInstance() {
112     azimuth_ = new AddionalAngleFields.azimuthType();
113     return azimuth_;
114   }
115 
116   private AddionalAngleFields.elevationType elevation_;
getElevation()117   public AddionalAngleFields.elevationType getElevation() {
118     return elevation_;
119   }
120   /**
121    * @throws ClassCastException if value is not a AddionalAngleFields.elevationType
122    */
setElevation(Asn1Object value)123   public void setElevation(Asn1Object value) {
124     this.elevation_ = (AddionalAngleFields.elevationType) value;
125   }
setElevationToNewInstance()126   public AddionalAngleFields.elevationType setElevationToNewInstance() {
127     elevation_ = new AddionalAngleFields.elevationType();
128     return elevation_;
129   }
130 
131 
132 
133 
134 
135 
getComponents()136   @Override public Iterable<? extends SequenceComponent> getComponents() {
137     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
138 
139     builder.add(new SequenceComponent() {
140           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
141 
142           @Override public boolean isExplicitlySet() {
143             return getAzimuth() != null;
144           }
145 
146           @Override public boolean hasDefaultValue() {
147             return false;
148           }
149 
150           @Override public boolean isOptional() {
151             return false;
152           }
153 
154           @Override public Asn1Object getComponentValue() {
155             return getAzimuth();
156           }
157 
158           @Override public void setToNewInstance() {
159             setAzimuthToNewInstance();
160           }
161 
162           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
163             return tag == null ? AddionalAngleFields.azimuthType.getPossibleFirstTags() : ImmutableList.of(tag);
164           }
165 
166           @Override
167           public Asn1Tag getTag() {
168             return tag;
169           }
170 
171           @Override
172           public boolean isImplicitTagging() {
173             return true;
174           }
175 
176           @Override public String toIndentedString(String indent) {
177                 return "azimuth : "
178                     + getAzimuth().toIndentedString(indent);
179               }
180         });
181 
182     builder.add(new SequenceComponent() {
183           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
184 
185           @Override public boolean isExplicitlySet() {
186             return getElevation() != null;
187           }
188 
189           @Override public boolean hasDefaultValue() {
190             return false;
191           }
192 
193           @Override public boolean isOptional() {
194             return false;
195           }
196 
197           @Override public Asn1Object getComponentValue() {
198             return getElevation();
199           }
200 
201           @Override public void setToNewInstance() {
202             setElevationToNewInstance();
203           }
204 
205           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
206             return tag == null ? AddionalAngleFields.elevationType.getPossibleFirstTags() : ImmutableList.of(tag);
207           }
208 
209           @Override
210           public Asn1Tag getTag() {
211             return tag;
212           }
213 
214           @Override
215           public boolean isImplicitTagging() {
216             return true;
217           }
218 
219           @Override public String toIndentedString(String indent) {
220                 return "elevation : "
221                     + getElevation().toIndentedString(indent);
222               }
223         });
224 
225     return builder.build();
226   }
227 
228   @Override public Iterable<? extends SequenceComponent>
getExtensionComponents()229                                                     getExtensionComponents() {
230     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
231 
232       return builder.build();
233     }
234 
235 
236 /*
237  */
238 
239 
240 //
241 
242 /**
243  */
244 public static class azimuthType extends Asn1Integer {
245   //
246 
247   private static final Asn1Tag TAG_azimuthType
248       = Asn1Tag.fromClassAndNumber(-1, -1);
249 
azimuthType()250   public azimuthType() {
251     super();
252     setValueRange("0", "31");
253 
254   }
255 
256   @Override
257   @Nullable
getTag()258   protected Asn1Tag getTag() {
259     return TAG_azimuthType;
260   }
261 
262   @Override
isTagImplicit()263   protected boolean isTagImplicit() {
264     return true;
265   }
266 
getPossibleFirstTags()267   public static Collection<Asn1Tag> getPossibleFirstTags() {
268     if (TAG_azimuthType != null) {
269       return ImmutableList.of(TAG_azimuthType);
270     } else {
271       return Asn1Integer.getPossibleFirstTags();
272     }
273   }
274 
275   /**
276    * Creates a new azimuthType from encoded stream.
277    */
fromPerUnaligned(byte[] encodedBytes)278   public static azimuthType fromPerUnaligned(byte[] encodedBytes) {
279     azimuthType result = new azimuthType();
280     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
281     return result;
282   }
283 
284   /**
285    * Creates a new azimuthType from encoded stream.
286    */
fromPerAligned(byte[] encodedBytes)287   public static azimuthType fromPerAligned(byte[] encodedBytes) {
288     azimuthType result = new azimuthType();
289     result.decodePerAligned(new BitStreamReader(encodedBytes));
290     return result;
291   }
292 
encodePerUnaligned()293   @Override public Iterable<BitStream> encodePerUnaligned() {
294     return super.encodePerUnaligned();
295   }
296 
encodePerAligned()297   @Override public Iterable<BitStream> encodePerAligned() {
298     return super.encodePerAligned();
299   }
300 
decodePerUnaligned(BitStreamReader reader)301   @Override public void decodePerUnaligned(BitStreamReader reader) {
302     super.decodePerUnaligned(reader);
303   }
304 
decodePerAligned(BitStreamReader reader)305   @Override public void decodePerAligned(BitStreamReader reader) {
306     super.decodePerAligned(reader);
307   }
308 
toString()309   @Override public String toString() {
310     return toIndentedString("");
311   }
312 
toIndentedString(String indent)313   public String toIndentedString(String indent) {
314     return "azimuthType = " + getInteger() + ";\n";
315   }
316 }
317 
318 
319 /*
320  */
321 
322 
323 //
324 
325 /**
326  */
327 public static class elevationType extends Asn1Integer {
328   //
329 
330   private static final Asn1Tag TAG_elevationType
331       = Asn1Tag.fromClassAndNumber(-1, -1);
332 
elevationType()333   public elevationType() {
334     super();
335     setValueRange("0", "7");
336 
337   }
338 
339   @Override
340   @Nullable
getTag()341   protected Asn1Tag getTag() {
342     return TAG_elevationType;
343   }
344 
345   @Override
isTagImplicit()346   protected boolean isTagImplicit() {
347     return true;
348   }
349 
getPossibleFirstTags()350   public static Collection<Asn1Tag> getPossibleFirstTags() {
351     if (TAG_elevationType != null) {
352       return ImmutableList.of(TAG_elevationType);
353     } else {
354       return Asn1Integer.getPossibleFirstTags();
355     }
356   }
357 
358   /**
359    * Creates a new elevationType from encoded stream.
360    */
fromPerUnaligned(byte[] encodedBytes)361   public static elevationType fromPerUnaligned(byte[] encodedBytes) {
362     elevationType result = new elevationType();
363     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
364     return result;
365   }
366 
367   /**
368    * Creates a new elevationType from encoded stream.
369    */
fromPerAligned(byte[] encodedBytes)370   public static elevationType fromPerAligned(byte[] encodedBytes) {
371     elevationType result = new elevationType();
372     result.decodePerAligned(new BitStreamReader(encodedBytes));
373     return result;
374   }
375 
encodePerUnaligned()376   @Override public Iterable<BitStream> encodePerUnaligned() {
377     return super.encodePerUnaligned();
378   }
379 
encodePerAligned()380   @Override public Iterable<BitStream> encodePerAligned() {
381     return super.encodePerAligned();
382   }
383 
decodePerUnaligned(BitStreamReader reader)384   @Override public void decodePerUnaligned(BitStreamReader reader) {
385     super.decodePerUnaligned(reader);
386   }
387 
decodePerAligned(BitStreamReader reader)388   @Override public void decodePerAligned(BitStreamReader reader) {
389     super.decodePerAligned(reader);
390   }
391 
toString()392   @Override public String toString() {
393     return toIndentedString("");
394   }
395 
toIndentedString(String indent)396   public String toIndentedString(String indent) {
397     return "elevationType = " + getInteger() + ";\n";
398   }
399 }
400 
401 
402 
403 
404 
encodePerUnaligned()405   @Override public Iterable<BitStream> encodePerUnaligned() {
406     return super.encodePerUnaligned();
407   }
408 
encodePerAligned()409   @Override public Iterable<BitStream> encodePerAligned() {
410     return super.encodePerAligned();
411   }
412 
decodePerUnaligned(BitStreamReader reader)413   @Override public void decodePerUnaligned(BitStreamReader reader) {
414     super.decodePerUnaligned(reader);
415   }
416 
decodePerAligned(BitStreamReader reader)417   @Override public void decodePerAligned(BitStreamReader reader) {
418     super.decodePerAligned(reader);
419   }
420 
toString()421   @Override public String toString() {
422     return toIndentedString("");
423   }
424 
toIndentedString(String indent)425   public String toIndentedString(String indent) {
426     StringBuilder builder = new StringBuilder();
427     builder.append("AddionalAngleFields = {\n");
428     final String internalIndent = indent + "  ";
429     for (SequenceComponent component : getComponents()) {
430       if (component.isExplicitlySet()) {
431         builder.append(internalIndent)
432             .append(component.toIndentedString(internalIndent));
433       }
434     }
435     if (isExtensible()) {
436       builder.append(internalIndent).append("...\n");
437       for (SequenceComponent component : getExtensionComponents()) {
438         if (component.isExplicitlySet()) {
439           builder.append(internalIndent)
440               .append(component.toIndentedString(internalIndent));
441         }
442       }
443     }
444     builder.append(indent).append("};\n");
445     return builder.toString();
446   }
447 }
448