/* * 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.car.vms; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; import com.android.internal.util.DataClass; import java.util.Collections; import java.util.Objects; import java.util.Set; /** * Layer dependencies for single Vehicle Map Service layer. * * Dependencies are treated as hard dependencies, meaning that an offered layer will not be * reported as available until all dependent layers are also available. * * @hide */ @SystemApi @DataClass(genAidl = true, genEqualsHashCode = true, genToString = true) public final class VmsLayerDependency implements Parcelable { /** * Layer that has dependencies */ private final @NonNull VmsLayer mLayer; /** * Layers that the given layer depends on */ private @NonNull Set mDependencies; private void onConstructed() { mDependencies = Collections.unmodifiableSet(mDependencies); } private void parcelDependencies(Parcel dest, int flags) { dest.writeArraySet(new ArraySet<>(mDependencies)); } @SuppressWarnings("unchecked") private Set unparcelDependencies(Parcel in) { return (Set) in.readArraySet(VmsLayer.class.getClassLoader()); } /** * Creates a new VmsLayerDependency without dependencies. * * @param layer * Layer that has no dependencies */ public VmsLayerDependency(@NonNull VmsLayer layer) { this(layer, Collections.emptySet()); } // Code below generated by codegen v1.0.14. // // DO NOT MODIFY! // CHECKSTYLE:OFF Generated code // // To regenerate run: // $ codegen $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car/vms/VmsLayerDependency.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off /** * Creates a new VmsLayerDependency. * * @param layer * Layer that has dependencies * @param dependencies * Layers that the given layer depends on */ @DataClass.Generated.Member public VmsLayerDependency( @NonNull VmsLayer layer, @NonNull Set dependencies) { this.mLayer = layer; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mLayer); this.mDependencies = dependencies; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mDependencies); onConstructed(); } /** * Layer that has dependencies */ @DataClass.Generated.Member public @NonNull VmsLayer getLayer() { return mLayer; } /** * Layers that the given layer depends on */ @DataClass.Generated.Member public @NonNull Set getDependencies() { return mDependencies; } @Override @DataClass.Generated.Member public String toString() { // You can override field toString logic by defining methods like: // String fieldNameToString() { ... } return "VmsLayerDependency { " + "layer = " + mLayer + ", " + "dependencies = " + mDependencies + " }"; } @Override @DataClass.Generated.Member public boolean equals(@android.annotation.Nullable Object o) { // You can override field equality logic by defining either of the methods like: // boolean fieldNameEquals(VmsLayerDependency other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") VmsLayerDependency that = (VmsLayerDependency) o; //noinspection PointlessBooleanExpression return true && Objects.equals(mLayer, that.mLayer) && Objects.equals(mDependencies, that.mDependencies); } @Override @DataClass.Generated.Member public int hashCode() { // You can override field hashCode logic by defining methods like: // int fieldNameHashCode() { ... } int _hash = 1; _hash = 31 * _hash + Objects.hashCode(mLayer); _hash = 31 * _hash + Objects.hashCode(mDependencies); return _hash; } @Override @DataClass.Generated.Member public void writeToParcel(@NonNull Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } dest.writeTypedObject(mLayer, flags); parcelDependencies(dest, flags); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ VmsLayerDependency(@NonNull Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } VmsLayer layer = (VmsLayer) in.readTypedObject(VmsLayer.CREATOR); Set dependencies = unparcelDependencies(in); this.mLayer = layer; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mLayer); this.mDependencies = dependencies; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mDependencies); onConstructed(); } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public VmsLayerDependency[] newArray(int size) { return new VmsLayerDependency[size]; } @Override public VmsLayerDependency createFromParcel(@NonNull Parcel in) { return new VmsLayerDependency(in); } }; @DataClass.Generated( time = 1582065875835L, codegenVersion = "1.0.14", sourceFile = "packages/services/Car/car-lib/src/android/car/vms/VmsLayerDependency.java", inputSignatures = "private final @android.annotation.NonNull android.car.vms.VmsLayer mLayer\nprivate @android.annotation.NonNull java.util.Set mDependencies\nprivate void onConstructed()\nprivate void parcelDependencies(android.os.Parcel,int)\nprivate @java.lang.SuppressWarnings(\"unchecked\") java.util.Set unparcelDependencies(android.os.Parcel)\nclass VmsLayerDependency extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genAidl=true, genEqualsHashCode=true, genToString=true)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }