| /* |
| * Copyright (C) 2017 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package android.location.cts.asn1.supl2.rrlp_components; |
| |
| /* |
| */ |
| |
| |
| // |
| // |
| import android.location.cts.asn1.base.Asn1Integer; |
| import android.location.cts.asn1.base.Asn1Null; |
| import android.location.cts.asn1.base.Asn1Object; |
| import android.location.cts.asn1.base.Asn1Sequence; |
| import android.location.cts.asn1.base.Asn1Tag; |
| import android.location.cts.asn1.base.BitStream; |
| import android.location.cts.asn1.base.BitStreamReader; |
| import android.location.cts.asn1.base.SequenceComponent; |
| import com.google.common.collect.ImmutableList; |
| import java.util.Collection; |
| import javax.annotation.Nullable; |
| |
| |
| /** |
| */ |
| public class GPSClockModel extends Asn1Sequence { |
| // |
| |
| private static final Asn1Tag TAG_GPSClockModel |
| = Asn1Tag.fromClassAndNumber(-1, -1); |
| |
| public GPSClockModel() { |
| super(); |
| } |
| |
| @Override |
| @Nullable |
| protected Asn1Tag getTag() { |
| return TAG_GPSClockModel; |
| } |
| |
| @Override |
| protected boolean isTagImplicit() { |
| return true; |
| } |
| |
| public static Collection<Asn1Tag> getPossibleFirstTags() { |
| if (TAG_GPSClockModel != null) { |
| return ImmutableList.of(TAG_GPSClockModel); |
| } else { |
| return Asn1Sequence.getPossibleFirstTags(); |
| } |
| } |
| |
| /** |
| * Creates a new GPSClockModel from encoded stream. |
| */ |
| public static GPSClockModel fromPerUnaligned(byte[] encodedBytes) { |
| GPSClockModel result = new GPSClockModel(); |
| result.decodePerUnaligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| /** |
| * Creates a new GPSClockModel from encoded stream. |
| */ |
| public static GPSClockModel fromPerAligned(byte[] encodedBytes) { |
| GPSClockModel result = new GPSClockModel(); |
| result.decodePerAligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| |
| |
| @Override protected boolean isExtensible() { |
| return false; |
| } |
| |
| @Override public boolean containsExtensionValues() { |
| for (SequenceComponent extensionComponent : getExtensionComponents()) { |
| if (extensionComponent.isExplicitlySet()) return true; |
| } |
| return false; |
| } |
| |
| |
| private GPSClockModel.af2Type af2_; |
| public GPSClockModel.af2Type getAf2() { |
| return af2_; |
| } |
| /** |
| * @throws ClassCastException if value is not a GPSClockModel.af2Type |
| */ |
| public void setAf2(Asn1Object value) { |
| this.af2_ = (GPSClockModel.af2Type) value; |
| } |
| public GPSClockModel.af2Type setAf2ToNewInstance() { |
| af2_ = new GPSClockModel.af2Type(); |
| return af2_; |
| } |
| |
| private GPSClockModel.af1Type af1_; |
| public GPSClockModel.af1Type getAf1() { |
| return af1_; |
| } |
| /** |
| * @throws ClassCastException if value is not a GPSClockModel.af1Type |
| */ |
| public void setAf1(Asn1Object value) { |
| this.af1_ = (GPSClockModel.af1Type) value; |
| } |
| public GPSClockModel.af1Type setAf1ToNewInstance() { |
| af1_ = new GPSClockModel.af1Type(); |
| return af1_; |
| } |
| |
| private GPSClockModel.af0Type af0_; |
| public GPSClockModel.af0Type getAf0() { |
| return af0_; |
| } |
| /** |
| * @throws ClassCastException if value is not a GPSClockModel.af0Type |
| */ |
| public void setAf0(Asn1Object value) { |
| this.af0_ = (GPSClockModel.af0Type) value; |
| } |
| public GPSClockModel.af0Type setAf0ToNewInstance() { |
| af0_ = new GPSClockModel.af0Type(); |
| return af0_; |
| } |
| |
| private GPSClockModel.tgdType tgd_; |
| public GPSClockModel.tgdType getTgd() { |
| return tgd_; |
| } |
| /** |
| * @throws ClassCastException if value is not a GPSClockModel.tgdType |
| */ |
| public void setTgd(Asn1Object value) { |
| this.tgd_ = (GPSClockModel.tgdType) value; |
| } |
| public GPSClockModel.tgdType setTgdToNewInstance() { |
| tgd_ = new GPSClockModel.tgdType(); |
| return tgd_; |
| } |
| |
| |
| |
| |
| |
| |
| @Override public Iterable<? extends SequenceComponent> getComponents() { |
| ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder(); |
| |
| builder.add(new SequenceComponent() { |
| Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0); |
| |
| @Override public boolean isExplicitlySet() { |
| return getAf2() != null; |
| } |
| |
| @Override public boolean hasDefaultValue() { |
| return false; |
| } |
| |
| @Override public boolean isOptional() { |
| return false; |
| } |
| |
| @Override public Asn1Object getComponentValue() { |
| return getAf2(); |
| } |
| |
| @Override public void setToNewInstance() { |
| setAf2ToNewInstance(); |
| } |
| |
| @Override public Collection<Asn1Tag> getPossibleFirstTags() { |
| return tag == null ? GPSClockModel.af2Type.getPossibleFirstTags() : ImmutableList.of(tag); |
| } |
| |
| @Override |
| public Asn1Tag getTag() { |
| return tag; |
| } |
| |
| @Override |
| public boolean isImplicitTagging() { |
| return true; |
| } |
| |
| @Override public String toIndentedString(String indent) { |
| return "af2 : " |
| + getAf2().toIndentedString(indent); |
| } |
| }); |
| |
| builder.add(new SequenceComponent() { |
| Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1); |
| |
| @Override public boolean isExplicitlySet() { |
| return getAf1() != null; |
| } |
| |
| @Override public boolean hasDefaultValue() { |
| return false; |
| } |
| |
| @Override public boolean isOptional() { |
| return false; |
| } |
| |
| @Override public Asn1Object getComponentValue() { |
| return getAf1(); |
| } |
| |
| @Override public void setToNewInstance() { |
| setAf1ToNewInstance(); |
| } |
| |
| @Override public Collection<Asn1Tag> getPossibleFirstTags() { |
| return tag == null ? GPSClockModel.af1Type.getPossibleFirstTags() : ImmutableList.of(tag); |
| } |
| |
| @Override |
| public Asn1Tag getTag() { |
| return tag; |
| } |
| |
| @Override |
| public boolean isImplicitTagging() { |
| return true; |
| } |
| |
| @Override public String toIndentedString(String indent) { |
| return "af1 : " |
| + getAf1().toIndentedString(indent); |
| } |
| }); |
| |
| builder.add(new SequenceComponent() { |
| Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2); |
| |
| @Override public boolean isExplicitlySet() { |
| return getAf0() != null; |
| } |
| |
| @Override public boolean hasDefaultValue() { |
| return false; |
| } |
| |
| @Override public boolean isOptional() { |
| return false; |
| } |
| |
| @Override public Asn1Object getComponentValue() { |
| return getAf0(); |
| } |
| |
| @Override public void setToNewInstance() { |
| setAf0ToNewInstance(); |
| } |
| |
| @Override public Collection<Asn1Tag> getPossibleFirstTags() { |
| return tag == null ? GPSClockModel.af0Type.getPossibleFirstTags() : ImmutableList.of(tag); |
| } |
| |
| @Override |
| public Asn1Tag getTag() { |
| return tag; |
| } |
| |
| @Override |
| public boolean isImplicitTagging() { |
| return true; |
| } |
| |
| @Override public String toIndentedString(String indent) { |
| return "af0 : " |
| + getAf0().toIndentedString(indent); |
| } |
| }); |
| |
| builder.add(new SequenceComponent() { |
| Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3); |
| |
| @Override public boolean isExplicitlySet() { |
| return getTgd() != null; |
| } |
| |
| @Override public boolean hasDefaultValue() { |
| return false; |
| } |
| |
| @Override public boolean isOptional() { |
| return false; |
| } |
| |
| @Override public Asn1Object getComponentValue() { |
| return getTgd(); |
| } |
| |
| @Override public void setToNewInstance() { |
| setTgdToNewInstance(); |
| } |
| |
| @Override public Collection<Asn1Tag> getPossibleFirstTags() { |
| return tag == null ? GPSClockModel.tgdType.getPossibleFirstTags() : ImmutableList.of(tag); |
| } |
| |
| @Override |
| public Asn1Tag getTag() { |
| return tag; |
| } |
| |
| @Override |
| public boolean isImplicitTagging() { |
| return true; |
| } |
| |
| @Override public String toIndentedString(String indent) { |
| return "tgd : " |
| + getTgd().toIndentedString(indent); |
| } |
| }); |
| |
| return builder.build(); |
| } |
| |
| @Override public Iterable<? extends SequenceComponent> |
| getExtensionComponents() { |
| ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder(); |
| |
| return builder.build(); |
| } |
| |
| |
| /* |
| */ |
| |
| |
| // |
| |
| /** |
| */ |
| public static class af2Type extends Asn1Integer { |
| // |
| |
| private static final Asn1Tag TAG_af2Type |
| = Asn1Tag.fromClassAndNumber(-1, -1); |
| |
| public af2Type() { |
| super(); |
| setValueRange("-128", "127"); |
| |
| } |
| |
| @Override |
| @Nullable |
| protected Asn1Tag getTag() { |
| return TAG_af2Type; |
| } |
| |
| @Override |
| protected boolean isTagImplicit() { |
| return true; |
| } |
| |
| public static Collection<Asn1Tag> getPossibleFirstTags() { |
| if (TAG_af2Type != null) { |
| return ImmutableList.of(TAG_af2Type); |
| } else { |
| return Asn1Integer.getPossibleFirstTags(); |
| } |
| } |
| |
| /** |
| * Creates a new af2Type from encoded stream. |
| */ |
| public static af2Type fromPerUnaligned(byte[] encodedBytes) { |
| af2Type result = new af2Type(); |
| result.decodePerUnaligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| /** |
| * Creates a new af2Type from encoded stream. |
| */ |
| public static af2Type fromPerAligned(byte[] encodedBytes) { |
| af2Type result = new af2Type(); |
| result.decodePerAligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| @Override public Iterable<BitStream> encodePerUnaligned() { |
| return super.encodePerUnaligned(); |
| } |
| |
| @Override public Iterable<BitStream> encodePerAligned() { |
| return super.encodePerAligned(); |
| } |
| |
| @Override public void decodePerUnaligned(BitStreamReader reader) { |
| super.decodePerUnaligned(reader); |
| } |
| |
| @Override public void decodePerAligned(BitStreamReader reader) { |
| super.decodePerAligned(reader); |
| } |
| |
| @Override public String toString() { |
| return toIndentedString(""); |
| } |
| |
| public String toIndentedString(String indent) { |
| return "af2Type = " + getInteger() + ";\n"; |
| } |
| } |
| |
| |
| /* |
| */ |
| |
| |
| // |
| |
| /** |
| */ |
| public static class af1Type extends Asn1Integer { |
| // |
| |
| private static final Asn1Tag TAG_af1Type |
| = Asn1Tag.fromClassAndNumber(-1, -1); |
| |
| public af1Type() { |
| super(); |
| setValueRange("-32768", "32767"); |
| |
| } |
| |
| @Override |
| @Nullable |
| protected Asn1Tag getTag() { |
| return TAG_af1Type; |
| } |
| |
| @Override |
| protected boolean isTagImplicit() { |
| return true; |
| } |
| |
| public static Collection<Asn1Tag> getPossibleFirstTags() { |
| if (TAG_af1Type != null) { |
| return ImmutableList.of(TAG_af1Type); |
| } else { |
| return Asn1Integer.getPossibleFirstTags(); |
| } |
| } |
| |
| /** |
| * Creates a new af1Type from encoded stream. |
| */ |
| public static af1Type fromPerUnaligned(byte[] encodedBytes) { |
| af1Type result = new af1Type(); |
| result.decodePerUnaligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| /** |
| * Creates a new af1Type from encoded stream. |
| */ |
| public static af1Type fromPerAligned(byte[] encodedBytes) { |
| af1Type result = new af1Type(); |
| result.decodePerAligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| @Override public Iterable<BitStream> encodePerUnaligned() { |
| return super.encodePerUnaligned(); |
| } |
| |
| @Override public Iterable<BitStream> encodePerAligned() { |
| return super.encodePerAligned(); |
| } |
| |
| @Override public void decodePerUnaligned(BitStreamReader reader) { |
| super.decodePerUnaligned(reader); |
| } |
| |
| @Override public void decodePerAligned(BitStreamReader reader) { |
| super.decodePerAligned(reader); |
| } |
| |
| @Override public String toString() { |
| return toIndentedString(""); |
| } |
| |
| public String toIndentedString(String indent) { |
| return "af1Type = " + getInteger() + ";\n"; |
| } |
| } |
| |
| |
| /* |
| */ |
| |
| |
| // |
| |
| /** |
| */ |
| public static class af0Type extends Asn1Integer { |
| // |
| |
| private static final Asn1Tag TAG_af0Type |
| = Asn1Tag.fromClassAndNumber(-1, -1); |
| |
| public af0Type() { |
| super(); |
| setValueRange("-2097152", "2097151"); |
| |
| } |
| |
| @Override |
| @Nullable |
| protected Asn1Tag getTag() { |
| return TAG_af0Type; |
| } |
| |
| @Override |
| protected boolean isTagImplicit() { |
| return true; |
| } |
| |
| public static Collection<Asn1Tag> getPossibleFirstTags() { |
| if (TAG_af0Type != null) { |
| return ImmutableList.of(TAG_af0Type); |
| } else { |
| return Asn1Integer.getPossibleFirstTags(); |
| } |
| } |
| |
| /** |
| * Creates a new af0Type from encoded stream. |
| */ |
| public static af0Type fromPerUnaligned(byte[] encodedBytes) { |
| af0Type result = new af0Type(); |
| result.decodePerUnaligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| /** |
| * Creates a new af0Type from encoded stream. |
| */ |
| public static af0Type fromPerAligned(byte[] encodedBytes) { |
| af0Type result = new af0Type(); |
| result.decodePerAligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| @Override public Iterable<BitStream> encodePerUnaligned() { |
| return super.encodePerUnaligned(); |
| } |
| |
| @Override public Iterable<BitStream> encodePerAligned() { |
| return super.encodePerAligned(); |
| } |
| |
| @Override public void decodePerUnaligned(BitStreamReader reader) { |
| super.decodePerUnaligned(reader); |
| } |
| |
| @Override public void decodePerAligned(BitStreamReader reader) { |
| super.decodePerAligned(reader); |
| } |
| |
| @Override public String toString() { |
| return toIndentedString(""); |
| } |
| |
| public String toIndentedString(String indent) { |
| return "af0Type = " + getInteger() + ";\n"; |
| } |
| } |
| |
| |
| /* |
| */ |
| |
| |
| // |
| |
| /** |
| */ |
| public static class tgdType extends Asn1Integer { |
| // |
| |
| private static final Asn1Tag TAG_tgdType |
| = Asn1Tag.fromClassAndNumber(-1, -1); |
| |
| public tgdType() { |
| super(); |
| setValueRange("-128", "127"); |
| |
| } |
| |
| @Override |
| @Nullable |
| protected Asn1Tag getTag() { |
| return TAG_tgdType; |
| } |
| |
| @Override |
| protected boolean isTagImplicit() { |
| return true; |
| } |
| |
| public static Collection<Asn1Tag> getPossibleFirstTags() { |
| if (TAG_tgdType != null) { |
| return ImmutableList.of(TAG_tgdType); |
| } else { |
| return Asn1Integer.getPossibleFirstTags(); |
| } |
| } |
| |
| /** |
| * Creates a new tgdType from encoded stream. |
| */ |
| public static tgdType fromPerUnaligned(byte[] encodedBytes) { |
| tgdType result = new tgdType(); |
| result.decodePerUnaligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| /** |
| * Creates a new tgdType from encoded stream. |
| */ |
| public static tgdType fromPerAligned(byte[] encodedBytes) { |
| tgdType result = new tgdType(); |
| result.decodePerAligned(new BitStreamReader(encodedBytes)); |
| return result; |
| } |
| |
| @Override public Iterable<BitStream> encodePerUnaligned() { |
| return super.encodePerUnaligned(); |
| } |
| |
| @Override public Iterable<BitStream> encodePerAligned() { |
| return super.encodePerAligned(); |
| } |
| |
| @Override public void decodePerUnaligned(BitStreamReader reader) { |
| super.decodePerUnaligned(reader); |
| } |
| |
| @Override public void decodePerAligned(BitStreamReader reader) { |
| super.decodePerAligned(reader); |
| } |
| |
| @Override public String toString() { |
| return toIndentedString(""); |
| } |
| |
| public String toIndentedString(String indent) { |
| return "tgdType = " + getInteger() + ";\n"; |
| } |
| } |
| |
| |
| |
| |
| |
| @Override public Iterable<BitStream> encodePerUnaligned() { |
| return super.encodePerUnaligned(); |
| } |
| |
| @Override public Iterable<BitStream> encodePerAligned() { |
| return super.encodePerAligned(); |
| } |
| |
| @Override public void decodePerUnaligned(BitStreamReader reader) { |
| super.decodePerUnaligned(reader); |
| } |
| |
| @Override public void decodePerAligned(BitStreamReader reader) { |
| super.decodePerAligned(reader); |
| } |
| |
| @Override public String toString() { |
| return toIndentedString(""); |
| } |
| |
| public String toIndentedString(String indent) { |
| StringBuilder builder = new StringBuilder(); |
| builder.append("GPSClockModel = {\n"); |
| final String internalIndent = indent + " "; |
| for (SequenceComponent component : getComponents()) { |
| if (component.isExplicitlySet()) { |
| builder.append(internalIndent) |
| .append(component.toIndentedString(internalIndent)); |
| } |
| } |
| if (isExtensible()) { |
| builder.append(internalIndent).append("...\n"); |
| for (SequenceComponent component : getExtensionComponents()) { |
| if (component.isExplicitlySet()) { |
| builder.append(internalIndent) |
| .append(component.toIndentedString(internalIndent)); |
| } |
| } |
| } |
| builder.append(indent).append("};\n"); |
| return builder.toString(); |
| } |
| } |