1 /*
2  * Copyright (C) 2017 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.loganalysis.item;
18 
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24 
25 /**
26  * An {@link IItem} used to store different infos logged in dmesg.
27  */
28 public class DmesgItem extends GenericItem {
29 
30     private Map<String, DmesgServiceInfoItem> mServiceInfoItems = new HashMap<>();
31 
32     private List<DmesgStageInfoItem> mStageInfoItems = new ArrayList<>();
33 
34     private List<DmesgActionInfoItem> mActionInfoItems = new ArrayList<>();
35 
DmesgItem()36     public DmesgItem() {
37         super(Collections.emptySet());
38     }
39 
40     /**
41      * @return the serviceInfoItems
42      */
getServiceInfoItems()43     public Map<String, DmesgServiceInfoItem> getServiceInfoItems() {
44         return mServiceInfoItems;
45     }
46 
47     /**
48      * @param key to identify service info item
49      * @param serviceInfoItem to add
50      */
addServiceInfoItem(String key, DmesgServiceInfoItem serviceInfoItem)51     public void addServiceInfoItem(String key, DmesgServiceInfoItem serviceInfoItem) {
52         mServiceInfoItems.put(key, serviceInfoItem);
53     }
54 
55     /**
56      * @return stageInfoItems
57      */
getStageInfoItems()58     public List<DmesgStageInfoItem> getStageInfoItems() {
59         return mStageInfoItems;
60     }
61 
62     /**
63      * @param stageInfoItem to be added to the list
64      */
addStageInfoItem(DmesgStageInfoItem stageInfoItem)65     public void addStageInfoItem(DmesgStageInfoItem stageInfoItem) {
66         mStageInfoItems.add(stageInfoItem);
67     }
68 
69     /**
70      * @return actionInfoItems
71      */
getActionInfoItems()72     public List<DmesgActionInfoItem> getActionInfoItems() {
73         return mActionInfoItems;
74     }
75 
76     /**
77      * @param actionInfoItem to be added to the list
78      */
addActionInfoItem(DmesgActionInfoItem actionInfoItem)79     public void addActionInfoItem(DmesgActionInfoItem actionInfoItem) {
80         mActionInfoItems.add(actionInfoItem);
81     }
82 
83 }
84