• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
36     private Map<String, DmesgModuleInfoItem> mModuleInfoItems = new HashMap<>();
37 
DmesgItem()38     public DmesgItem() {
39         super(Collections.emptySet());
40     }
41 
42     /**
43      * @return the serviceInfoItems
44      */
getServiceInfoItems()45     public Map<String, DmesgServiceInfoItem> getServiceInfoItems() {
46         return mServiceInfoItems;
47     }
48 
49     /**
50      * @param key to identify service info item
51      * @param serviceInfoItem to add
52      */
addServiceInfoItem(String key, DmesgServiceInfoItem serviceInfoItem)53     public void addServiceInfoItem(String key, DmesgServiceInfoItem serviceInfoItem) {
54         mServiceInfoItems.put(key, serviceInfoItem);
55     }
56 
57     /**
58      * @return stageInfoItems
59      */
getStageInfoItems()60     public List<DmesgStageInfoItem> getStageInfoItems() {
61         return mStageInfoItems;
62     }
63 
64     /**
65      * @param stageInfoItem to be added to the list
66      */
addStageInfoItem(DmesgStageInfoItem stageInfoItem)67     public void addStageInfoItem(DmesgStageInfoItem stageInfoItem) {
68         mStageInfoItems.add(stageInfoItem);
69     }
70 
71     /**
72      * @return actionInfoItems
73      */
getActionInfoItems()74     public List<DmesgActionInfoItem> getActionInfoItems() {
75         return mActionInfoItems;
76     }
77 
78     /**
79      * @param actionInfoItem to be added to the list
80      */
addActionInfoItem(DmesgActionInfoItem actionInfoItem)81     public void addActionInfoItem(DmesgActionInfoItem actionInfoItem) {
82         mActionInfoItems.add(actionInfoItem);
83     }
84 
85     /** @return moduleInfoItem */
getModuleInfoItems()86     public Map<String, DmesgModuleInfoItem> getModuleInfoItems() {
87         return mModuleInfoItems;
88     }
89 
90     /**
91      * @param key to identify module info item
92      * @param moduleInfoItem to be added to the list
93      */
addModuleInfoItem(String key, DmesgModuleInfoItem moduleInfoItem)94     public void addModuleInfoItem(String key, DmesgModuleInfoItem moduleInfoItem) {
95         mModuleInfoItems.put(key, moduleInfoItem);
96     }
97 }
98