1 /*
2  * Copyright (C) 2015 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 package com.android.loganalysis.item;
17 
18 import java.util.Arrays;
19 import java.util.HashSet;
20 import java.util.Set;
21 
22 /**
23  * An {@link GenericItem} used to store the power analysis summary
24  */
25 public class BatteryStatsSummaryInfoItem extends GenericItem {
26 
27     /** Constant for JSON output */
28     public static final String DISCHARGE_RATE = "DISCHARGE_RATE";
29     /** Constant for JSON output */
30     public static final String PEAK_DISCHARGE_TIME = "PEAK_DISCHARGE_TIME";
31 
32     private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
33             DISCHARGE_RATE, PEAK_DISCHARGE_TIME));
34 
35     /**
36       * The constructor for {@link BatteryStatsSummaryInfoItem}.
37       */
BatteryStatsSummaryInfoItem()38     public BatteryStatsSummaryInfoItem() {
39         super(ATTRIBUTES);
40     }
41 
42     /**
43      * Get the battery discharge rate
44      */
getBatteryDischargeRate()45     public String getBatteryDischargeRate() {
46         return (String) getAttribute(DISCHARGE_RATE);
47     }
48 
49     /**
50      * Set the battery discharge rate
51      */
setBatteryDischargeRate(String dischargeRate)52     public void setBatteryDischargeRate(String dischargeRate) {
53         setAttribute(DISCHARGE_RATE, dischargeRate);
54     }
55 
56     /**
57      * Get the peak discharge time
58      */
getPeakDischargeTime()59     public String getPeakDischargeTime() {
60         return (String) getAttribute(PEAK_DISCHARGE_TIME);
61     }
62 
63     /**
64      * Set the peak discharge time
65      */
setPeakDischargeTime(String peakDischargeTime)66     public void setPeakDischargeTime(String peakDischargeTime) {
67         setAttribute(PEAK_DISCHARGE_TIME, peakDischargeTime);
68     }
69 }
70