public class MultiValueResolutionDecision extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
SUMMABLE_KEYS |
private TagCollection |
tags
the collection of tags for which a decision is needed
|
private MultiValueDecisionType |
type
the type of decision
|
private java.lang.String |
value
the selected value if
type is MultiValueDecisionType.KEEP_ONE |
Constructor and Description |
---|
MultiValueResolutionDecision()
constructor
|
MultiValueResolutionDecision(TagCollection tags)
Creates a new decision for the tag collection
tags . |
Modifier and Type | Method and Description |
---|---|
void |
applyTo(java.util.Collection<? extends OsmPrimitive> primitives)
Applies this resolution to a collection of primitives
|
void |
applyTo(OsmPrimitive primitive)
Applies the resolution to an
OsmPrimitive |
protected void |
autoDecide()
Tries to find the best decision based on the current values.
|
Command |
buildChangeCommand(java.util.Collection<? extends OsmPrimitive> primitives)
Builds a change command for applying this resolution to a collection of primitives
|
Command |
buildChangeCommand(OsmPrimitive primitive)
Builds a change command for applying this resolution to a primitive
|
boolean |
canKeepAll()
Replies true, if this resolution has more than 1 possible non-empty values
|
boolean |
canKeepNone()
Replies true if the empty value is a possible value in this resolution
|
boolean |
canSumAllNumeric()
Replies true, if summing all numeric values is a possible value in this resolution
|
java.lang.String |
getChosenValue()
Replies the chosen value
|
MultiValueDecisionType |
getDecisionType()
Replies the type of the resolution
|
java.lang.String |
getKey()
Replies the key of the tag to be resolved by this resolution
|
Tag |
getResolution()
Replies a tag representing the current resolution.
|
java.util.List<java.lang.String> |
getValues()
Replies the list of possible, non empty values
|
boolean |
isDecided()
Replies true if this resolution is decided
|
void |
keepAll()
Apply the decision to keep all values
|
void |
keepNone()
Apply the decision to keep no value
|
void |
keepOne(java.lang.String value)
Apply the decision to keep exactly one value
|
void |
setNew(java.lang.String value)
sets a new value for this
|
void |
sumAllNumeric()
Apply the decision to sum all numeric values
|
void |
undecide()
marks this as undecided
|
private MultiValueDecisionType type
private TagCollection tags
private java.lang.String value
type
is MultiValueDecisionType.KEEP_ONE
private static final java.lang.String[] SUMMABLE_KEYS
public MultiValueResolutionDecision()
public MultiValueResolutionDecision(TagCollection tags)
tags
.
All tags must have the same key.tags
- the tags. Must not be null.java.lang.IllegalArgumentException
- if tags is nulljava.lang.IllegalArgumentException
- if there are more than one keysjava.lang.IllegalArgumentException
- if tags is emptyprotected final void autoDecide()
public void keepNone()
public void keepAll()
public void sumAllNumeric()
public void keepOne(java.lang.String value)
value
- the value to keepjava.lang.IllegalArgumentException
- if value is nulljava.lang.IllegalStateException
- if value is not in the list of known values for this tagpublic void setNew(java.lang.String value)
value
- the new vlauepublic void undecide()
public java.lang.String getChosenValue()
java.lang.IllegalStateException
- if this resolution is not yet decidedpublic java.util.List<java.lang.String> getValues()
public java.lang.String getKey()
public boolean canKeepNone()
public boolean canKeepAll()
public boolean canSumAllNumeric()
public boolean isDecided()
public MultiValueDecisionType getDecisionType()
public void applyTo(OsmPrimitive primitive)
OsmPrimitive
primitive
- the primitivejava.lang.IllegalStateException
- if this resolution is not resolved yetpublic void applyTo(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- the collection of primitivesjava.lang.IllegalStateException
- if this resolution is not resolved yetpublic Command buildChangeCommand(OsmPrimitive primitive)
primitive
- the primitivejava.lang.IllegalArgumentException
- if primitive is nulljava.lang.IllegalStateException
- if this resolution is not resolved yetpublic Command buildChangeCommand(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- the collection of primitivesjava.lang.IllegalArgumentException
- if primitives is nulljava.lang.IllegalStateException
- if this resolution is not resolved yetpublic Tag getResolution()