Class KeyedItem.Usage
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem.Usage
-
- Enclosing class:
- KeyedItem
public static class KeyedItem.Usage extends Object
Usage information on a key TODO merge withTagCollection
-
-
Constructor Summary
Constructors Constructor Description Usage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFirst()
Get the first value available.int
getSelectedCount()
Returns the number of primitives selected.boolean
hadKeys()
Check if we encountered any primitive that had any keysboolean
hasUniqueValue()
Check if there is exactly one value for this key.KeyedItem.Usage
splitValues(String delimiter)
Splits multiple values and adds their usage counts as single value.boolean
unused()
Check if this key was not used in any primitive
-
-
-
Constructor Detail
-
Usage
public Usage()
-
-
Method Detail
-
hasUniqueValue
public boolean hasUniqueValue()
Check if there is exactly one value for this key.- Returns:
true
if there was exactly one value.
-
unused
public boolean unused()
Check if this key was not used in any primitive- Returns:
true
if it was unused.
-
getFirst
public String getFirst()
Get the first value available.- Returns:
- The first value
- Throws:
NoSuchElementException
- if there is no such value.
-
hadKeys
public boolean hadKeys()
Check if we encountered any primitive that had any keys- Returns:
true
if any of the primitives had any tags.
-
getSelectedCount
public int getSelectedCount()
Returns the number of primitives selected.- Returns:
- the number of primitives selected.
-
splitValues
public KeyedItem.Usage splitValues(String delimiter)
Splits multiple values and adds their usage counts as single value.A value of
regional;pizza
will increment the count ofregional
and ofpizza
.- Parameters:
delimiter
- The delimiter used for splitting.- Returns:
- A new usage object with the new counts.
-
-