Class TagSet

java.lang.Object
org.oscim.core.TagSet

public class TagSet extends Object
The Class TagSet holds a set of Tags.
  • Constructor Details

    • TagSet

      public TagSet()
      Instantiates a new TagSet with initial size of 10.
    • TagSet

      public TagSet(int size)
      Instantiates a new tag set initialized with the given size.
      Parameters:
      size - the initial size.
  • Method Details

    • clear

      public void clear()
      Reset the TagSet to contain 0 tags.
    • size

      public int size()
      Returns:
      Size of TagSet
    • clearAndNullTags

      public void clearAndNullTags()
      Clear. Reset the TagSet to contain 0 tags and null out tags.
    • asArray

      public Tag[] asArray()
      Return Tags contained in TagSet as new array.
      Returns:
      the tag[]
    • get

      public Tag get(int index)
      Find Tag by given index.
      Parameters:
      index - the index of tag.
      Returns:
      the tag if found, null otherwise.
    • get

      public Tag get(String key)
      Find Tag by given key.
      Parameters:
      key - the key as intern String.
      Returns:
      the tag if found, null otherwise.
    • getTags

      public Tag[] getTags()
      Return Tags array contained in TagSet.
      Returns:
      the tags array.
    • containsKey

      public boolean containsKey(String key)
      Checks if any tag has the key 'key'.
      Parameters:
      key - the key as intern String.
      Returns:
      true, if any tag has the given key
    • getValue

      public String getValue(String key)
      Get the value for a given key.
      Parameters:
      key - the key as intern String
      Returns:
      the value when found, null otherwise
    • add

      public void add(Tag tag)
      Adds the Tag tag to TagSet.
      Parameters:
      tag - the Tag to be added
    • set

      public void set(Tag[] tagArray)
      Sets the tags from 'tagArray'.
      Parameters:
      tagArray - the tag array
    • set

      public void set(TagSet tagSet)
      Sets the tags from 'tagSet'.
      Parameters:
      tagSet - the tag set
    • contains

      public boolean contains(Tag tag)
      Checks if 'tag' is contained in TagSet.
      Parameters:
      tag - the tag
      Returns:
      true, iff tag is in TagSet
    • contains

      public boolean contains(String key, String value)
      Checks if a Tag with given key and value is contained in TagSet.
      Parameters:
      key - the key as intern String
      value - the value as intern String
      Returns:
      true, iff any tag has the given key and value
    • contains

      public boolean contains(Collection<Tag> tags)
      Checks if any tag is contained in TagSet.
      Parameters:
      tags - the tags
      Returns:
      true, iff any tag is in TagSet
    • toString

      public String toString()
      Overrides:
      toString in class Object