• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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.telephony.statslib;
18 
19 import android.util.StatsEvent;
20 
21 import java.util.Objects;
22 
23 /** AtomsTestInfo class */
24 public class AtomsPushedTestInfo extends AtomsPushed {
25 
26     /** atom #1 : test atom #1 */
27     private int mTestAtom;
28 
29     /** Constructor of AtomsTestInfo */
AtomsPushedTestInfo()30     public AtomsPushedTestInfo() {}
31 
32     /**
33      * Constructor of AtomsTestInfo
34      *
35      * @param testAtom initial value
36      */
AtomsPushedTestInfo(int testAtom)37     public AtomsPushedTestInfo(int testAtom) {
38         mTestAtom = testAtom;
39     }
40 
41     /**
42      * Copy Constructor of AtomsTestInfo
43      *
44      * @param info The info param to copy from.
45      */
AtomsPushedTestInfo(AtomsPushedTestInfo info)46     public AtomsPushedTestInfo(AtomsPushedTestInfo info) {
47         mTestAtom = info.mTestAtom;
48     }
49 
50     /**
51      * Write the atom information to be recorded to the builder according to the type in order.
52      *
53      * @param builder Builder class for StatsEvent Builder object.
54      */
55     @Override
build(StatsEvent.Builder builder)56     public void build(StatsEvent.Builder builder) {
57         builder.writeInt(mTestAtom); // atom #1
58     }
59 
60     /** Return atom id defined in proto. */
61     @Override
getStatsId()62     public int getStatsId() {
63         return 701;
64     }
65 
66     /** Return copy of the AtomsTestInfo */
67     @Override
copy()68     public AtomsPushed copy() {
69         return new AtomsPushedTestInfo(this);
70     }
71 
getTestAtom()72     public int getTestAtom() {
73         return mTestAtom;
74     }
75 
setTestAtom(int testAtom)76     public void setTestAtom(int testAtom) {
77         mTestAtom = testAtom;
78     }
79 
80     @Override
toString()81     public String toString() {
82         return "AtomsPushedTestInfo{" + "mTestAtom=" + mTestAtom + '}';
83     }
84 
85     @Override
equals(Object o)86     public boolean equals(Object o) {
87         if (this == o) return true;
88         if (!(o instanceof AtomsPushedTestInfo)) return false;
89         AtomsPushedTestInfo that = (AtomsPushedTestInfo) o;
90         return mTestAtom == that.mTestAtom;
91     }
92 
93     @Override
hashCode()94     public int hashCode() {
95         return Objects.hash(mTestAtom);
96     }
97 }
98