summaryrefslogtreecommitdiff
path: root/src/com/android/loganalysis/parser/AbstractSectionParser.java
diff options
context:
space:
mode:
authorEric Rowe <erowe@google.com>2013-03-20 11:10:24 -0700
committerEric Rowe <erowe@google.com>2013-04-04 16:41:25 -0700
commitb54a24815a6dc0e365571f23d712aa9b63927e39 (patch)
tree8d6ceba1b74f51a1ee1fbe748a442da01882220f /src/com/android/loganalysis/parser/AbstractSectionParser.java
parent585f40977a39311ba06f56cd341c639594056c55 (diff)
downloadloganalysis-b54a24815a6dc0e365571f23d712aa9b63927e39.tar.gz
Allow the section parser to use the same parser
Allow the section parser to use the same parser in multiple sections of the log. This is needed to allow a kernel parser to parse both the kernel log and last kernel log. Change-Id: I22f1b9f2dc0f316dcc9ada77aceebc74a53609c7
Diffstat (limited to 'src/com/android/loganalysis/parser/AbstractSectionParser.java')
-rw-r--r--src/com/android/loganalysis/parser/AbstractSectionParser.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/com/android/loganalysis/parser/AbstractSectionParser.java b/src/com/android/loganalysis/parser/AbstractSectionParser.java
index c57546d..91baeaa 100644
--- a/src/com/android/loganalysis/parser/AbstractSectionParser.java
+++ b/src/com/android/loganalysis/parser/AbstractSectionParser.java
@@ -36,7 +36,7 @@ public abstract class AbstractSectionParser implements IParser {
private RegexTrie<IParser> mSectionTrie = new RegexTrie<IParser>();
private IParser mCurrentParser = new NoopParser();
private List<String> mParseBlock = new LinkedList<String>();
- private Map<String, IItem> mSections = new HashMap<String, IItem>();
+ private Map<IParser, IItem> mSections = new HashMap<IParser, IItem>();
/**
* A method to add a given section parser to the set of potential parsers to use.
@@ -89,11 +89,11 @@ public abstract class AbstractSectionParser implements IParser {
/**
* Gets the {@link IItem} for a given section.
*
- * @param section The {@link IItem} type for the section.
+ * @param parser The {@link IParser} type for the section.
* @return The {@link IItem}.
*/
- protected IItem getSection(String section) {
- return mSections.get(section);
+ protected IItem getSection(IParser parser) {
+ return mSections.get(parser);
}
/**
@@ -115,7 +115,7 @@ public abstract class AbstractSectionParser implements IParser {
if (mCurrentParser != null) {
IItem item = mCurrentParser.parse(mParseBlock);
if (item != null && !(mCurrentParser instanceof NoopParser)) {
- mSections.put(item.getType(), item);
+ mSections.put(mCurrentParser, item);
// CLog.v("Just ran the %s parser", mCurrentParser.getClass().getSimpleName());
}
}