Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Unified Diff: src/com/dom_distiller/client/sax/AttributesImpl.java

Issue 296113004: Start using computed style instead of default tag actions. (Closed) Base URL: https://code.google.com/p/dom-distiller/@master
Patch Set: Fixed nit. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/com/dom_distiller/client/sax/AttributesImpl.java
diff --git a/src/com/dom_distiller/client/sax/AttributesImpl.java b/src/com/dom_distiller/client/sax/AttributesImpl.java
index 03e47b26c0b3a18c0bf576af7e1ce6a1f35516a5..022664a79adb594e5f7fa60ef1adb79e3b905f6b 100644
--- a/src/com/dom_distiller/client/sax/AttributesImpl.java
+++ b/src/com/dom_distiller/client/sax/AttributesImpl.java
@@ -10,65 +10,52 @@ import java.util.List;
import java.util.Map;
public class AttributesImpl implements Attributes {
- private List<AttributeData> attributes;
- private Map<String, Integer> attributesMap;
-
- public AttributesImpl() {
- attributes = new ArrayList<AttributeData>();
- attributesMap = new HashMap<String, Integer>();
- }
-
- public int getIndex(String key) {
- return attributesMap.get(key);
- }
-
- public String getValue(String key) {
- return getValue(getIndex(key));
- }
-
- public String getURI(int index) {
- return attributes.get(index).uri;
- }
-
- public String getLocalName(int index) {
- return attributes.get(index).localName;
- }
-
- public String getQName(int index) {
- return attributes.get(index).qName;
- }
-
- public String getType(int index) {
- return attributes.get(index).type;
- }
-
- public String getValue(int index) {
- return attributes.get(index).value;
- }
-
- public int getLength() {
- return attributes.size();
- }
-
- public void addAttribute(String uri, String localName, String qName, String type, String value) {
- attributesMap.put(qName, attributes.size());
- AttributeData data = new AttributeData(uri, localName, qName, type, value);
- attributes.add(data);
- }
-
- private static class AttributeData {
- String uri;
- String localName;
- String qName;
- String type;
- String value;
-
- AttributeData(String uri, String localName, String qName, String type, String value) {
- this.uri = uri;
- this.localName = localName;
- this.qName = qName;
- this.type = type;
- this.value = value;
- }
- }
+ private List<AttributeData> attributes;
+ private Map<String, Integer> attributesMap;
+
+ public AttributesImpl() {
+ attributes = new ArrayList<AttributeData>();
+ attributesMap = new HashMap<String, Integer>();
+ }
+
+ @Override
+ public String getValue(String key) {
+ return getValue(getIndex(key));
+ }
+
+ @Override
+ public int getIndex(String key) {
+ return attributesMap.get(key);
+ }
+
+ @Override
+ public String getName(int index) {
+ return attributes.get(index).name;
+ }
+
+ @Override
+ public String getValue(int index) {
+ return attributes.get(index).value;
+ }
+
+ @Override
+ public int getLength() {
+ return attributes.size();
+ }
+
+ public void addAttribute(String name, String value) {
+ attributesMap.put(name, attributes.size());
+ AttributeData data = new AttributeData(name, value);
+ attributes.add(data);
+ }
+
+ private static class AttributeData {
+ private final String name;
+ private final String value;
+
+ private AttributeData(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+ }
}
« no previous file with comments | « src/com/dom_distiller/client/sax/Attributes.java ('k') | src/com/dom_distiller/client/sax/ContentHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698