some more TagSet utilities

This commit is contained in:
Hannes Janetzek 2013-05-11 17:33:26 +02:00
parent 46c7c34bb2
commit 1359dedcd4

View File

@ -40,6 +40,29 @@ public class TagSet {
} }
return null; return null;
} }
public boolean containsKey(String key){
for (int i = 0; i < numTags; i++) {
if (tags[i].key == key)
return true;
}
return false;
}
public String getValue(String key){
for (int i = 0; i < numTags; i++) {
if (tags[i].key == key)
return tags[i].value;
}
return null;
}
public boolean contains(String key, String value){
for (int i = 0; i < numTags; i++) {
if (tags[i].key == key)
return value.equals(tags[i].value);
}
return false;
}
public void add(Tag tag) { public void add(Tag tag) {
if (numTags >= tags.length) { if (numTags >= tags.length) {
@ -50,6 +73,7 @@ public class TagSet {
tags[numTags++] = tag; tags[numTags++] = tag;
} }
public boolean contains(Tag tag) { public boolean contains(Tag tag) {
for (int i = 0; i < numTags; i++) { for (int i = 0; i < numTags; i++) {
Tag t = tags[i]; Tag t = tags[i];