• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.adservices.ondevicepersonalization;
18 
19 import android.annotation.NonNull;
20 
21 import com.android.ondevicepersonalization.internal.util.AnnotationValidations;
22 import com.android.ondevicepersonalization.internal.util.DataClass;
23 
24 import java.util.Collections;
25 import java.util.List;
26 
27 /** The output data of {@link IsolatedWorker#onTrainingExamples} */
28 @DataClass(genBuilder = true, genEqualsHashCode = true)
29 public final class TrainingExamplesOutput {
30     /**
31      * The list of training example byte arrays. The format is a binary serialized <a
32      * href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/example/example.proto">
33      * tensorflow.Example</a> proto. The maximum allowed example size is 50KB.
34      */
35     @NonNull
36     @DataClass.PluralOf("trainingExampleRecord")
37     private List<TrainingExampleRecord> mTrainingExampleRecords = Collections.emptyList();
38 
39     // Code below generated by codegen v1.0.23.
40     //
41     // DO NOT MODIFY!
42     // CHECKSTYLE:OFF Generated code
43     //
44     // To regenerate run:
45     // $ codegen
46     // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/TrainingExamplesOutput.java
47     //
48     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
49     //   Settings > Editor > Code Style > Formatter Control
50     // @formatter:off
51 
52     @DataClass.Generated.Member
TrainingExamplesOutput( @onNull List<TrainingExampleRecord> trainingExampleRecords)53     /* package-private */ TrainingExamplesOutput(
54             @NonNull List<TrainingExampleRecord> trainingExampleRecords) {
55         this.mTrainingExampleRecords = trainingExampleRecords;
56         AnnotationValidations.validate(NonNull.class, null, mTrainingExampleRecords);
57 
58         // onConstructed(); // You can define this method to get a callback
59     }
60 
61     /**
62      * The list of training example byte arrays. The format is a binary serialized <a
63      * href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/example/example.proto">
64      * tensorflow.Example</a> proto. The maximum allowed example size is 50KB.
65      */
66     @DataClass.Generated.Member
getTrainingExampleRecords()67     public @NonNull List<TrainingExampleRecord> getTrainingExampleRecords() {
68         return mTrainingExampleRecords;
69     }
70 
71     @Override
72     @DataClass.Generated.Member
equals(@ndroid.annotation.Nullable Object o)73     public boolean equals(@android.annotation.Nullable Object o) {
74         // You can override field equality logic by defining either of the methods like:
75         // boolean fieldNameEquals(TrainingExamplesOutput other) { ... }
76         // boolean fieldNameEquals(FieldType otherValue) { ... }
77 
78         if (this == o) return true;
79         if (o == null || getClass() != o.getClass()) return false;
80         @SuppressWarnings("unchecked")
81         TrainingExamplesOutput that = (TrainingExamplesOutput) o;
82         //noinspection PointlessBooleanExpression
83         return true
84                 && java.util.Objects.equals(mTrainingExampleRecords, that.mTrainingExampleRecords);
85     }
86 
87     @Override
88     @DataClass.Generated.Member
hashCode()89     public int hashCode() {
90         // You can override field hashCode logic by defining methods like:
91         // int fieldNameHashCode() { ... }
92 
93         int _hash = 1;
94         _hash = 31 * _hash + java.util.Objects.hashCode(mTrainingExampleRecords);
95         return _hash;
96     }
97 
98     /** A builder for {@link TrainingExamplesOutput} */
99     @SuppressWarnings("WeakerAccess")
100     @DataClass.Generated.Member
101     public static final class Builder {
102 
103         private @NonNull List<TrainingExampleRecord> mTrainingExampleRecords;
104 
105         private long mBuilderFieldsSet = 0L;
106 
Builder()107         public Builder() {}
108 
109         /**
110          * The list of training example byte arrays. The format is a binary serialized <a
111          * href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/example/example.proto">
112          * tensorflow.Example</a> proto. The maximum allowed example size is 50KB.
113          */
114         @DataClass.Generated.Member
setTrainingExampleRecords( @onNull List<TrainingExampleRecord> value)115         public @NonNull Builder setTrainingExampleRecords(
116                 @NonNull List<TrainingExampleRecord> value) {
117             checkNotUsed();
118             mBuilderFieldsSet |= 0x1;
119             mTrainingExampleRecords = value;
120             return this;
121         }
122 
123         /**
124          * @see #setTrainingExampleRecords
125          */
126         @DataClass.Generated.Member
addTrainingExampleRecord(@onNull TrainingExampleRecord value)127         public @NonNull Builder addTrainingExampleRecord(@NonNull TrainingExampleRecord value) {
128             if (mTrainingExampleRecords == null)
129                 setTrainingExampleRecords(new java.util.ArrayList<>());
130             mTrainingExampleRecords.add(value);
131             return this;
132         }
133 
134         /** Builds the instance. This builder should not be touched after calling this! */
build()135         public @NonNull TrainingExamplesOutput build() {
136             checkNotUsed();
137             mBuilderFieldsSet |= 0x2; // Mark builder used
138 
139             if ((mBuilderFieldsSet & 0x1) == 0) {
140                 mTrainingExampleRecords = Collections.emptyList();
141             }
142             TrainingExamplesOutput o = new TrainingExamplesOutput(mTrainingExampleRecords);
143             return o;
144         }
145 
checkNotUsed()146         private void checkNotUsed() {
147             if ((mBuilderFieldsSet & 0x2) != 0) {
148                 throw new IllegalStateException(
149                         "This Builder should not be reused. Use a new Builder instance instead");
150             }
151         }
152     }
153 
154     @DataClass.Generated(
155             time = 1704915709729L,
156             codegenVersion = "1.0.23",
157             sourceFile =
158                     "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/TrainingExamplesOutput.java",
159             inputSignatures =
160                     "private @android.annotation.NonNull"
161                         + " @com.android.ondevicepersonalization.internal.util.DataClass.PluralOf(\"trainingExampleRecord\")"
162                         + " java.util.List<android.adservices.ondevicepersonalization.TrainingExampleRecord>"
163                         + " mTrainingExampleRecords\n"
164                         + "class TrainingExamplesOutput extends java.lang.Object implements []\n"
165                         + "@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true,"
166                         + " genEqualsHashCode=true)")
167     @Deprecated
__metadata()168     private void __metadata() {}
169 
170     // @formatter:on
171     // End of generated code
172 
173 }
174