public class MultiValueResolutionDecision extends Object
| Modifier and Type | Field and Description |
|---|---|
private TagCollection |
tags
the collection of tags for which a decision is needed
|
private MultiValueDecisionType |
type
the type of decision
|
private String |
value
the selected value if
type is MultiValueDecisionType.KEEP_ONE |
| Constructor and Description |
|---|
MultiValueResolutionDecision()
constuctor
|
MultiValueResolutionDecision(TagCollection tags)
Creates a new decision for the tag collection
tags. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTo(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(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
|
String |
getChosenValue()
Replies the chosen value
|
MultiValueDecisionType |
getDecisionType()
Replies the type of the resolution
|
String |
getKey()
Replies the key of the tag to be resolved by this resolution
|
Tag |
getResolution()
Replies a tag representing the current resolution.
|
List<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(String value)
Apply the decision to keep exactly one value
|
void |
setNew(String value)
sets a new value for this
|
void |
undecide()
marks this as undecided
|
private MultiValueDecisionType type
private TagCollection tags
private String value
type is MultiValueDecisionType.KEEP_ONEpublic MultiValueResolutionDecision()
public MultiValueResolutionDecision(TagCollection tags) throws IllegalArgumentException
tags.
All tags must have the same key.tags - the tags. Must not be null.IllegalArgumentException - thrown if tags is nullIllegalArgumentException - thrown if there are more than one keysIllegalArgumentException - thrown if tags is emptyprotected void autoDecide()
public void keepNone()
public void keepAll()
public void keepOne(String value) throws IllegalArgumentException, IllegalStateException
value - the value to keepIllegalArgumentException - thrown if value is nullIllegalStateException - thrown if value is not in the list of known values for this tagpublic void undecide()
public String getChosenValue() throws IllegalStateException
IllegalStateException - thrown if this resolution is not yet decidedpublic List<String> getValues()
public String getKey()
public boolean canKeepNone()
public boolean canKeepAll()
public boolean isDecided()
public MultiValueDecisionType getDecisionType()
public void applyTo(OsmPrimitive primitive) throws IllegalStateException
OsmPrimitiveprimitive - the primitiveIllegalStateException - thrown if this resolution is not resolved yetpublic void applyTo(Collection<? extends OsmPrimitive> primitives) throws IllegalStateException
primitives - the collection of primitivesIllegalStateException - thrown if this resolution is not resolved yetpublic Command buildChangeCommand(OsmPrimitive primitive) throws IllegalArgumentException, IllegalStateException
primitive - the primitiveIllegalArgumentException - thrown if primitive is nullIllegalStateException - thrown if this resolution is not resolved yetpublic Command buildChangeCommand(Collection<? extends OsmPrimitive> primitives)
primitives - the collection of primitivesIllegalArgumentException - thrown if primitives is nullIllegalStateException - thrown if this resolution is not resolved yetpublic Tag getResolution()