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.settingslib.net;
18 
19 /**
20  * Base data structure representing usage data in a billing cycle.
21  */
22 public class NetworkCycleData {
23 
24     private long mStartTime;
25     private long mEndTime;
26     private long mTotalUsage;
27 
NetworkCycleData()28     protected NetworkCycleData() {
29     }
30 
getStartTime()31     public long getStartTime() {
32         return mStartTime;
33     }
34 
getEndTime()35     public long getEndTime() {
36         return mEndTime;
37     }
38 
getTotalUsage()39     public long getTotalUsage() {
40         return mTotalUsage;
41     }
42 
43     public static class Builder {
44 
45         private NetworkCycleData mObject = new NetworkCycleData();
46 
setStartTime(long start)47         public Builder setStartTime(long start) {
48             getObject().mStartTime = start;
49             return this;
50         }
51 
setEndTime(long end)52         public Builder setEndTime(long end) {
53             getObject().mEndTime = end;
54             return this;
55         }
56 
setTotalUsage(long total)57         public Builder setTotalUsage(long total) {
58             getObject().mTotalUsage = total;
59             return this;
60         }
61 
getObject()62         protected NetworkCycleData getObject() {
63             return mObject;
64         }
65 
build()66         public NetworkCycleData build() {
67             return getObject();
68         }
69     }
70 }
71