1 /* 2 * Copyright (C) 2024 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 com.android.federatedcompute.services.training.util; 18 19 import android.annotation.Nullable; 20 import android.federatedcompute.aidl.IExampleStoreIterator; 21 22 import com.android.ondevicepersonalization.internal.util.DataClass; 23 24 @DataClass(genBuilder = true, genEqualsHashCode = true) 25 public class EligibilityResult { 26 private boolean mEligible = true; 27 @Nullable private IExampleStoreIterator mExampleStoreIterator; 28 29 // Code below generated by codegen v1.0.23. 30 // 31 // DO NOT MODIFY! 32 // CHECKSTYLE:OFF Generated code 33 // 34 // To regenerate run: 35 // $ codegen 36 // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/federatedcompute/src/com/android/federatedcompute/services/training/util/EligibilityResult.java 37 // 38 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 39 // Settings > Editor > Code Style > Formatter Control 40 // @formatter:off 41 42 @DataClass.Generated.Member EligibilityResult( boolean eligible, @Nullable IExampleStoreIterator exampleStoreIterator)43 /* package-private */ EligibilityResult( 44 boolean eligible, @Nullable IExampleStoreIterator exampleStoreIterator) { 45 this.mEligible = eligible; 46 this.mExampleStoreIterator = exampleStoreIterator; 47 48 // onConstructed(); // You can define this method to get a callback 49 } 50 51 @DataClass.Generated.Member isEligible()52 public boolean isEligible() { 53 return mEligible; 54 } 55 56 @DataClass.Generated.Member getExampleStoreIterator()57 public @Nullable IExampleStoreIterator getExampleStoreIterator() { 58 return mExampleStoreIterator; 59 } 60 61 @Override 62 @DataClass.Generated.Member equals(@ullable Object o)63 public boolean equals(@Nullable Object o) { 64 // You can override field equality logic by defining either of the methods like: 65 // boolean fieldNameEquals(EligibilityResult other) { ... } 66 // boolean fieldNameEquals(FieldType otherValue) { ... } 67 68 if (this == o) return true; 69 if (o == null || getClass() != o.getClass()) return false; 70 @SuppressWarnings("unchecked") 71 EligibilityResult that = (EligibilityResult) o; 72 //noinspection PointlessBooleanExpression 73 return true 74 && mEligible == that.mEligible 75 && java.util.Objects.equals(mExampleStoreIterator, that.mExampleStoreIterator); 76 } 77 78 @Override 79 @DataClass.Generated.Member hashCode()80 public int hashCode() { 81 // You can override field hashCode logic by defining methods like: 82 // int fieldNameHashCode() { ... } 83 84 int _hash = 1; 85 _hash = 31 * _hash + Boolean.hashCode(mEligible); 86 _hash = 31 * _hash + java.util.Objects.hashCode(mExampleStoreIterator); 87 return _hash; 88 } 89 90 /** A builder for {@link EligibilityResult} */ 91 @SuppressWarnings("WeakerAccess") 92 @DataClass.Generated.Member 93 public static class Builder { 94 95 private boolean mEligible; 96 private @Nullable IExampleStoreIterator mExampleStoreIterator; 97 98 private long mBuilderFieldsSet = 0L; 99 Builder()100 public Builder() {} 101 102 @DataClass.Generated.Member setEligible(boolean value)103 public @android.annotation.NonNull Builder setEligible(boolean value) { 104 checkNotUsed(); 105 mBuilderFieldsSet |= 0x1; 106 mEligible = value; 107 return this; 108 } 109 110 @DataClass.Generated.Member setExampleStoreIterator( @ndroid.annotation.NonNull IExampleStoreIterator value)111 public @android.annotation.NonNull Builder setExampleStoreIterator( 112 @android.annotation.NonNull IExampleStoreIterator value) { 113 checkNotUsed(); 114 mBuilderFieldsSet |= 0x2; 115 mExampleStoreIterator = value; 116 return this; 117 } 118 119 /** Builds the instance. This builder should not be touched after calling this! */ build()120 public @android.annotation.NonNull EligibilityResult build() { 121 checkNotUsed(); 122 mBuilderFieldsSet |= 0x4; // Mark builder used 123 124 if ((mBuilderFieldsSet & 0x1) == 0) { 125 mEligible = true; 126 } 127 EligibilityResult o = new EligibilityResult(mEligible, mExampleStoreIterator); 128 return o; 129 } 130 checkNotUsed()131 private void checkNotUsed() { 132 if ((mBuilderFieldsSet & 0x4) != 0) { 133 throw new IllegalStateException( 134 "This Builder should not be reused. Use a new Builder instance instead"); 135 } 136 } 137 } 138 139 // @formatter:on 140 // End of generated code 141 142 } 143