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 CircularArea extends Asn1Sequence { 41 // 42 43 private static final Asn1Tag TAG_CircularArea 44 = Asn1Tag.fromClassAndNumber(-1, -1); 45 CircularArea()46 public CircularArea() { 47 super(); 48 } 49 50 @Override 51 @Nullable getTag()52 protected Asn1Tag getTag() { 53 return TAG_CircularArea; 54 } 55 56 @Override isTagImplicit()57 protected boolean isTagImplicit() { 58 return true; 59 } 60 getPossibleFirstTags()61 public static Collection<Asn1Tag> getPossibleFirstTags() { 62 if (TAG_CircularArea != null) { 63 return ImmutableList.of(TAG_CircularArea); 64 } else { 65 return Asn1Sequence.getPossibleFirstTags(); 66 } 67 } 68 69 /** 70 * Creates a new CircularArea from encoded stream. 71 */ fromPerUnaligned(byte[] encodedBytes)72 public static CircularArea fromPerUnaligned(byte[] encodedBytes) { 73 CircularArea result = new CircularArea(); 74 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 75 return result; 76 } 77 78 /** 79 * Creates a new CircularArea from encoded stream. 80 */ fromPerAligned(byte[] encodedBytes)81 public static CircularArea fromPerAligned(byte[] encodedBytes) { 82 CircularArea result = new CircularArea(); 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 Coordinate coordinate_; getCoordinate()102 public Coordinate getCoordinate() { 103 return coordinate_; 104 } 105 /** 106 * @throws ClassCastException if value is not a Coordinate 107 */ setCoordinate(Asn1Object value)108 public void setCoordinate(Asn1Object value) { 109 this.coordinate_ = (Coordinate) value; 110 } setCoordinateToNewInstance()111 public Coordinate setCoordinateToNewInstance() { 112 coordinate_ = new Coordinate(); 113 return coordinate_; 114 } 115 116 private CircularArea.radiusType radius_; getRadius()117 public CircularArea.radiusType getRadius() { 118 return radius_; 119 } 120 /** 121 * @throws ClassCastException if value is not a CircularArea.radiusType 122 */ setRadius(Asn1Object value)123 public void setRadius(Asn1Object value) { 124 this.radius_ = (CircularArea.radiusType) value; 125 } setRadiusToNewInstance()126 public CircularArea.radiusType setRadiusToNewInstance() { 127 radius_ = new CircularArea.radiusType(); 128 return radius_; 129 } 130 131 private CircularArea.radius_minType radius_min_; getRadius_min()132 public CircularArea.radius_minType getRadius_min() { 133 return radius_min_; 134 } 135 /** 136 * @throws ClassCastException if value is not a CircularArea.radius_minType 137 */ setRadius_min(Asn1Object value)138 public void setRadius_min(Asn1Object value) { 139 this.radius_min_ = (CircularArea.radius_minType) value; 140 } setRadius_minToNewInstance()141 public CircularArea.radius_minType setRadius_minToNewInstance() { 142 radius_min_ = new CircularArea.radius_minType(); 143 return radius_min_; 144 } 145 146 private CircularArea.radius_maxType radius_max_; getRadius_max()147 public CircularArea.radius_maxType getRadius_max() { 148 return radius_max_; 149 } 150 /** 151 * @throws ClassCastException if value is not a CircularArea.radius_maxType 152 */ setRadius_max(Asn1Object value)153 public void setRadius_max(Asn1Object value) { 154 this.radius_max_ = (CircularArea.radius_maxType) value; 155 } setRadius_maxToNewInstance()156 public CircularArea.radius_maxType setRadius_maxToNewInstance() { 157 radius_max_ = new CircularArea.radius_maxType(); 158 return radius_max_; 159 } 160 161 162 163 164 165 getComponents()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 getCoordinate() != 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 getCoordinate(); 186 } 187 188 @Override public void setToNewInstance() { 189 setCoordinateToNewInstance(); 190 } 191 192 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 193 return tag == null ? Coordinate.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 "coordinate : " 208 + getCoordinate().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 getRadius() != null; 217 } 218 219 @Override public boolean hasDefaultValue() { 220 return false; 221 } 222 223 @Override public boolean isOptional() { 224 return false; 225 } 226 227 @Override public Asn1Object getComponentValue() { 228 return getRadius(); 229 } 230 231 @Override public void setToNewInstance() { 232 setRadiusToNewInstance(); 233 } 234 235 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 236 return tag == null ? CircularArea.radiusType.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 "radius : " 251 + getRadius().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 getRadius_min() != null; 260 } 261 262 @Override public boolean hasDefaultValue() { 263 return false; 264 } 265 266 @Override public boolean isOptional() { 267 return true; 268 } 269 270 @Override public Asn1Object getComponentValue() { 271 return getRadius_min(); 272 } 273 274 @Override public void setToNewInstance() { 275 setRadius_minToNewInstance(); 276 } 277 278 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 279 return tag == null ? CircularArea.radius_minType.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 "radius_min : " 294 + getRadius_min().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 getRadius_max() != 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 getRadius_max(); 315 } 316 317 @Override public void setToNewInstance() { 318 setRadius_maxToNewInstance(); 319 } 320 321 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 322 return tag == null ? CircularArea.radius_maxType.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 "radius_max : " 337 + getRadius_max().toIndentedString(indent); 338 } 339 }); 340 341 return builder.build(); 342 } 343 344 @Override public Iterable<? extends SequenceComponent> getExtensionComponents()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 /** 361 */ 362 public static class radiusType extends Asn1Integer { 363 // 364 365 private static final Asn1Tag TAG_radiusType 366 = Asn1Tag.fromClassAndNumber(-1, -1); 367 radiusType()368 public radiusType() { 369 super(); 370 setValueRange("1", "1000000"); 371 372 } 373 374 @Override 375 @Nullable getTag()376 protected Asn1Tag getTag() { 377 return TAG_radiusType; 378 } 379 380 @Override isTagImplicit()381 protected boolean isTagImplicit() { 382 return true; 383 } 384 getPossibleFirstTags()385 public static Collection<Asn1Tag> getPossibleFirstTags() { 386 if (TAG_radiusType != null) { 387 return ImmutableList.of(TAG_radiusType); 388 } else { 389 return Asn1Integer.getPossibleFirstTags(); 390 } 391 } 392 393 /** 394 * Creates a new radiusType from encoded stream. 395 */ fromPerUnaligned(byte[] encodedBytes)396 public static radiusType fromPerUnaligned(byte[] encodedBytes) { 397 radiusType result = new radiusType(); 398 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 399 return result; 400 } 401 402 /** 403 * Creates a new radiusType from encoded stream. 404 */ fromPerAligned(byte[] encodedBytes)405 public static radiusType fromPerAligned(byte[] encodedBytes) { 406 radiusType result = new radiusType(); 407 result.decodePerAligned(new BitStreamReader(encodedBytes)); 408 return result; 409 } 410 encodePerUnaligned()411 @Override public Iterable<BitStream> encodePerUnaligned() { 412 return super.encodePerUnaligned(); 413 } 414 encodePerAligned()415 @Override public Iterable<BitStream> encodePerAligned() { 416 return super.encodePerAligned(); 417 } 418 decodePerUnaligned(BitStreamReader reader)419 @Override public void decodePerUnaligned(BitStreamReader reader) { 420 super.decodePerUnaligned(reader); 421 } 422 decodePerAligned(BitStreamReader reader)423 @Override public void decodePerAligned(BitStreamReader reader) { 424 super.decodePerAligned(reader); 425 } 426 toString()427 @Override public String toString() { 428 return toIndentedString(""); 429 } 430 toIndentedString(String indent)431 public String toIndentedString(String indent) { 432 return "radiusType = " + getInteger() + ";\n"; 433 } 434 } 435 436 437 /* 438 */ 439 440 441 // 442 443 /** 444 */ 445 public static class radius_minType extends Asn1Integer { 446 // 447 448 private static final Asn1Tag TAG_radius_minType 449 = Asn1Tag.fromClassAndNumber(-1, -1); 450 radius_minType()451 public radius_minType() { 452 super(); 453 setValueRange("1", "1000000"); 454 455 } 456 457 @Override 458 @Nullable getTag()459 protected Asn1Tag getTag() { 460 return TAG_radius_minType; 461 } 462 463 @Override isTagImplicit()464 protected boolean isTagImplicit() { 465 return true; 466 } 467 getPossibleFirstTags()468 public static Collection<Asn1Tag> getPossibleFirstTags() { 469 if (TAG_radius_minType != null) { 470 return ImmutableList.of(TAG_radius_minType); 471 } else { 472 return Asn1Integer.getPossibleFirstTags(); 473 } 474 } 475 476 /** 477 * Creates a new radius_minType from encoded stream. 478 */ fromPerUnaligned(byte[] encodedBytes)479 public static radius_minType fromPerUnaligned(byte[] encodedBytes) { 480 radius_minType result = new radius_minType(); 481 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 482 return result; 483 } 484 485 /** 486 * Creates a new radius_minType from encoded stream. 487 */ fromPerAligned(byte[] encodedBytes)488 public static radius_minType fromPerAligned(byte[] encodedBytes) { 489 radius_minType result = new radius_minType(); 490 result.decodePerAligned(new BitStreamReader(encodedBytes)); 491 return result; 492 } 493 encodePerUnaligned()494 @Override public Iterable<BitStream> encodePerUnaligned() { 495 return super.encodePerUnaligned(); 496 } 497 encodePerAligned()498 @Override public Iterable<BitStream> encodePerAligned() { 499 return super.encodePerAligned(); 500 } 501 decodePerUnaligned(BitStreamReader reader)502 @Override public void decodePerUnaligned(BitStreamReader reader) { 503 super.decodePerUnaligned(reader); 504 } 505 decodePerAligned(BitStreamReader reader)506 @Override public void decodePerAligned(BitStreamReader reader) { 507 super.decodePerAligned(reader); 508 } 509 toString()510 @Override public String toString() { 511 return toIndentedString(""); 512 } 513 toIndentedString(String indent)514 public String toIndentedString(String indent) { 515 return "radius_minType = " + getInteger() + ";\n"; 516 } 517 } 518 519 520 /* 521 */ 522 523 524 // 525 526 /** 527 */ 528 public static class radius_maxType extends Asn1Integer { 529 // 530 531 private static final Asn1Tag TAG_radius_maxType 532 = Asn1Tag.fromClassAndNumber(-1, -1); 533 radius_maxType()534 public radius_maxType() { 535 super(); 536 setValueRange("1", "1500000"); 537 538 } 539 540 @Override 541 @Nullable getTag()542 protected Asn1Tag getTag() { 543 return TAG_radius_maxType; 544 } 545 546 @Override isTagImplicit()547 protected boolean isTagImplicit() { 548 return true; 549 } 550 getPossibleFirstTags()551 public static Collection<Asn1Tag> getPossibleFirstTags() { 552 if (TAG_radius_maxType != null) { 553 return ImmutableList.of(TAG_radius_maxType); 554 } else { 555 return Asn1Integer.getPossibleFirstTags(); 556 } 557 } 558 559 /** 560 * Creates a new radius_maxType from encoded stream. 561 */ fromPerUnaligned(byte[] encodedBytes)562 public static radius_maxType fromPerUnaligned(byte[] encodedBytes) { 563 radius_maxType result = new radius_maxType(); 564 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 565 return result; 566 } 567 568 /** 569 * Creates a new radius_maxType from encoded stream. 570 */ fromPerAligned(byte[] encodedBytes)571 public static radius_maxType fromPerAligned(byte[] encodedBytes) { 572 radius_maxType result = new radius_maxType(); 573 result.decodePerAligned(new BitStreamReader(encodedBytes)); 574 return result; 575 } 576 encodePerUnaligned()577 @Override public Iterable<BitStream> encodePerUnaligned() { 578 return super.encodePerUnaligned(); 579 } 580 encodePerAligned()581 @Override public Iterable<BitStream> encodePerAligned() { 582 return super.encodePerAligned(); 583 } 584 decodePerUnaligned(BitStreamReader reader)585 @Override public void decodePerUnaligned(BitStreamReader reader) { 586 super.decodePerUnaligned(reader); 587 } 588 decodePerAligned(BitStreamReader reader)589 @Override public void decodePerAligned(BitStreamReader reader) { 590 super.decodePerAligned(reader); 591 } 592 toString()593 @Override public String toString() { 594 return toIndentedString(""); 595 } 596 toIndentedString(String indent)597 public String toIndentedString(String indent) { 598 return "radius_maxType = " + getInteger() + ";\n"; 599 } 600 } 601 602 603 604 605 encodePerUnaligned()606 @Override public Iterable<BitStream> encodePerUnaligned() { 607 return super.encodePerUnaligned(); 608 } 609 encodePerAligned()610 @Override public Iterable<BitStream> encodePerAligned() { 611 return super.encodePerAligned(); 612 } 613 decodePerUnaligned(BitStreamReader reader)614 @Override public void decodePerUnaligned(BitStreamReader reader) { 615 super.decodePerUnaligned(reader); 616 } 617 decodePerAligned(BitStreamReader reader)618 @Override public void decodePerAligned(BitStreamReader reader) { 619 super.decodePerAligned(reader); 620 } 621 toString()622 @Override public String toString() { 623 return toIndentedString(""); 624 } 625 toIndentedString(String indent)626 public String toIndentedString(String indent) { 627 StringBuilder builder = new StringBuilder(); 628 builder.append("CircularArea = {\n"); 629 final String internalIndent = indent + " "; 630 for (SequenceComponent component : getComponents()) { 631 if (component.isExplicitlySet()) { 632 builder.append(internalIndent) 633 .append(component.toIndentedString(internalIndent)); 634 } 635 } 636 if (isExtensible()) { 637 builder.append(internalIndent).append("...\n"); 638 for (SequenceComponent component : getExtensionComponents()) { 639 if (component.isExplicitlySet()) { 640 builder.append(internalIndent) 641 .append(component.toIndentedString(internalIndent)); 642 } 643 } 644 } 645 builder.append(indent).append("};\n"); 646 return builder.toString(); 647 } 648 } 649