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 com.android.adservices.service.measurement.noising;
18 
19 import java.util.Objects;
20 
21 /**
22  * POJO for Impression Noise params.
23  */
24 public class ImpressionNoiseParams {
25     private final int mReportCount;
26     private final int mTriggerDataCardinality;
27     private final int mReportingWindowCount;
28     private final int mDestinationTypeMultiplier;
29 
ImpressionNoiseParams( int reportCount, int triggerDataCardinality, int reportingWindowCount, int destinationTypeMultiplier)30     public ImpressionNoiseParams(
31             int reportCount,
32             int triggerDataCardinality,
33             int reportingWindowCount,
34             int destinationTypeMultiplier) {
35         mReportCount = reportCount;
36         mTriggerDataCardinality = triggerDataCardinality;
37         mReportingWindowCount = reportingWindowCount;
38         mDestinationTypeMultiplier = destinationTypeMultiplier;
39     }
40 
41     @Override
toString()42     public String toString() {
43         return "ImpressionNoiseParams{"
44                 + "mReportCount="
45                 + mReportCount
46                 + ", mTriggerDataCardinality="
47                 + mTriggerDataCardinality
48                 + ", mReportingWindowCount="
49                 + mReportingWindowCount
50                 + ", mDestinationTypeMultiplier="
51                 + mDestinationTypeMultiplier
52                 + '}';
53     }
54 
55     @Override
equals(Object o)56     public boolean equals(Object o) {
57         if (this == o) return true;
58         if (!(o instanceof ImpressionNoiseParams)) return false;
59         ImpressionNoiseParams that = (ImpressionNoiseParams) o;
60         return mReportCount == that.mReportCount
61                 && mTriggerDataCardinality == that.mTriggerDataCardinality
62                 && mDestinationTypeMultiplier == that.mDestinationTypeMultiplier
63                 && mReportingWindowCount == that.mReportingWindowCount;
64     }
65 
66     @Override
hashCode()67     public int hashCode() {
68         return Objects.hash(mReportCount, mTriggerDataCardinality, mReportingWindowCount);
69     }
70 
71     /**
72      * Number of reports.
73      */
getReportCount()74     public int getReportCount() {
75         return mReportCount;
76     }
77 
78     /**
79      * Trigger data cardinality.
80      */
getTriggerDataCardinality()81     public int getTriggerDataCardinality() {
82         return mTriggerDataCardinality;
83     }
84 
85     /**
86      * Number of report windows.
87      */
getReportingWindowCount()88     public int getReportingWindowCount() {
89         return mReportingWindowCount;
90     }
91 
92     /**
93      * Its value depends on number of destinations to consider for report generation. Helps to
94      * increase possible states count accordingly.
95      */
getDestinationTypeMultiplier()96     public int getDestinationTypeMultiplier() {
97         return mDestinationTypeMultiplier;
98     }
99 }
100