soot.jimple.infoflow.android.axml.parsers.AbstractBinaryXMLFileParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soot-infoflow-android Show documentation
Show all versions of soot-infoflow-android Show documentation
Android-specific components of FlowDroid
package soot.jimple.infoflow.android.axml.parsers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import soot.jimple.infoflow.android.axml.AXmlDocument;
import soot.jimple.infoflow.android.axml.AXmlNode;
/**
* Abstract base class for all binary XML file parsers
*
* @author Steven Arzt
*/
public abstract class AbstractBinaryXMLFileParser implements IBinaryXMLFileParser {
/**
* Map containing lists of nodes sharing the same tag
.
* The tag
is the key to access the list.
*/
protected HashMap> nodesWithTag = new HashMap>();
/**
* The xml document.
*/
protected AXmlDocument document = new AXmlDocument();
/**
* Adds a pointer to the given node
with the key tag
.
*
* @param tag the node's tag
* @param node the node being pointed to
*/
protected void addPointer(String tag, AXmlNode node) {
if(!this.nodesWithTag.containsKey(tag)) this.nodesWithTag.put(tag, new ArrayList());
this.nodesWithTag.get(tag).add(node);
}
@Override
public AXmlDocument getDocument() {
return this.document;
}
@Override
public List getNodesWithTag(String tag) {
if(this.nodesWithTag.containsKey(tag))
return new ArrayList(this.nodesWithTag.get(tag));
else
return Collections.emptyList();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy