some more TagSet utilities
This commit is contained in:
parent
46c7c34bb2
commit
1359dedcd4
@ -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];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user