compile TagSet to Tag[]

This commit is contained in:
Hannes Janetzek 2013-05-16 22:17:09 +02:00
parent 6ff66a7567
commit 00abbc839b

View File

@ -14,14 +14,15 @@
*/ */
package org.oscim.core; package org.oscim.core;
public class TagSet { public class TagSet {
public static TagSet EMPTY_TAG_SET = new TagSet(); public static TagSet EMPTY_TAG_SET = new TagSet();
public Tag[] tags; public Tag[] tags;
public int numTags; public int numTags;
private TagSet() { public TagSet() {
tags = new Tag[10];
} }
public TagSet(int count) { public TagSet(int count) {
@ -32,6 +33,12 @@ public class TagSet {
numTags = 0; numTags = 0;
} }
public Tag[] asArray(){
Tag[] result = new Tag[numTags];
System.arraycopy(tags, 0, result, 0, numTags);
return result;
}
/** find Tag by key - NOTE: key must be internal() */ /** find Tag by key - NOTE: key must be internal() */
public Tag get(String key) { public Tag get(String key) {
for (int i = 0; i < numTags; i++) { for (int i = 0; i < numTags; i++) {