org.openstreetmap.josm.plugins.graphview.core.data
Class MapBasedTagGroup

Object
  extended by MapBasedTagGroup
All Implemented Interfaces:
Iterable<Tag>, TagGroup

public class MapBasedTagGroup
extends Object
implements TagGroup

TagGroup that uses a key-value-Map to store tags


Constructor Summary
MapBasedTagGroup(Iterable<Tag> tags)
           
MapBasedTagGroup(Map<String,String> tagMap)
           
MapBasedTagGroup(Tag... tags)
           
 
Method Summary
 boolean contains(String key, String value)
          returns true if this tag group contains the tag
 boolean contains(Tag tag)
          returns true if this tag group contains the given tag
 boolean containsKey(String key)
          returns true if this tag group contains a tag with the given key
 boolean containsValue(String value)
          returns true if this tag group contains at least one tag with the given value
 String getValue(String key)
          returns the value for the given key or null if no tag in this group uses that key
 boolean isEmpty()
          returns true if this group contains any tags
 Iterator<Tag> iterator()
          returns an Iterator providing access to all Tags.
 int size()
          returns the number of tags in this group
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapBasedTagGroup

public MapBasedTagGroup(Map<String,String> tagMap)
Parameters:
tagMap - map from keys to values; != null; must not be modified after being used as parameter

MapBasedTagGroup

public MapBasedTagGroup(Iterable<Tag> tags)
Parameters:
tags - tags to add to the group; != null, each != null

MapBasedTagGroup

public MapBasedTagGroup(Tag... tags)
Parameters:
tags - tags to add to the group; each != null
Method Detail

getValue

public String getValue(String key)
Description copied from interface: TagGroup
returns the value for the given key or null if no tag in this group uses that key

Specified by:
getValue in interface TagGroup
Parameters:
key - key whose value will be returned; != null

containsKey

public boolean containsKey(String key)
Description copied from interface: TagGroup
returns true if this tag group contains a tag with the given key

Specified by:
containsKey in interface TagGroup
Parameters:
key - key to check for; != null

containsValue

public boolean containsValue(String value)
Description copied from interface: TagGroup
returns true if this tag group contains at least one tag with the given value

Specified by:
containsValue in interface TagGroup
Parameters:
value - value to check for; != null

contains

public boolean contains(Tag tag)
Description copied from interface: TagGroup
returns true if this tag group contains the given tag

Specified by:
contains in interface TagGroup
Parameters:
tag - tag to check for; != null

contains

public boolean contains(String key,
                        String value)
Description copied from interface: TagGroup
returns true if this tag group contains the tag

Specified by:
contains in interface TagGroup
Parameters:
key - key of the tag to check for; != null
value - value of the tag to check for; != null

size

public int size()
Description copied from interface: TagGroup
returns the number of tags in this group

Specified by:
size in interface TagGroup

isEmpty

public boolean isEmpty()
Description copied from interface: TagGroup
returns true if this group contains any tags

Specified by:
isEmpty in interface TagGroup

iterator

public Iterator<Tag> iterator()
returns an Iterator providing access to all Tags. The Iterator does not support the Iterator.remove() method.

Specified by:
iterator in interface Iterable<Tag>

toString

public String toString()
Overrides:
toString in class Object