1 /*
2  * Copyright (C) 2018 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.powermodel.component;
18 
19 import java.util.Arrays;
20 
21 import com.android.powermodel.ComponentProfile;
22 import com.android.powermodel.ParseException;
23 
24 public class GpsProfile extends ComponentProfile {
25     public float onMa;
26     public float[] signalQualityMa;
27 
28     public static class Builder {
29         private float onMa;
30         private float[] mSignalQualityMa;
31 
Builder()32         public Builder() {
33         }
34 
setOnMa(float value)35         public void setOnMa(float value) throws ParseException {
36             onMa = value;
37         }
38 
setSignalMa(float[] value)39         public void setSignalMa(float[] value) throws ParseException {
40             mSignalQualityMa = value;
41         }
42 
build()43         public GpsProfile build() throws ParseException {
44             GpsProfile result = new GpsProfile();
45             result.onMa = onMa;
46             result.signalQualityMa = mSignalQualityMa == null
47                     ? new float[0]
48                     : Arrays.copyOf(mSignalQualityMa, mSignalQualityMa.length);
49             return result;
50         }
51     }
52 }
53 
54