Class AutoCompletionPriority
- java.lang.Object
-
- org.openstreetmap.josm.data.tagging.ac.AutoCompletionPriority
-
- All Implemented Interfaces:
Comparable<AutoCompletionPriority>
public class AutoCompletionPriority extends Object implements Comparable<AutoCompletionPriority>
Describes the priority of an item in an autocompletion set. The selected flag is currently only used in plugins. Instances of this class are not modifiable.- Since:
- 12859 (copied from
gui.tagging.ac.AutoCompletionItemPriority
)
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
inDataSet
private boolean
inStandard
static AutoCompletionPriority
IS_IN_DATASET
Indicates that this is an arbitrary value from the data set, i.e.static AutoCompletionPriority
IS_IN_SELECTION
Indicates that this is a value from a selected object.static AutoCompletionPriority
IS_IN_STANDARD
Indicates that this is a standard value, i.e.static AutoCompletionPriority
IS_IN_STANDARD_AND_IN_DATASET
Indicates, that the value is standard and it is found in the data.private static int
NO_USER_INPUT
private boolean
selected
static AutoCompletionPriority
UNKNOWN
Unknown priority.private int
userInput
-
Constructor Summary
Constructors Constructor Description AutoCompletionPriority(boolean inDataSet, boolean inStandard, boolean selected)
Constructs a newAutoCompletionItemPriority
.AutoCompletionPriority(boolean inDataSet, boolean inStandard, boolean selected, Integer userInput)
Constructs a newAutoCompletionItemPriority
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AutoCompletionPriority other)
Imposes an ordering on the priorities.boolean
equals(Object obj)
Integer
getUserInput()
Returns a number when the tag key / value has been entered by the user before.int
hashCode()
boolean
isInDataSet()
Determines if the item is found in the currently active data layer.boolean
isInStandard()
Determines if the item is a standard tag, e.g.boolean
isSelected()
Determines if it is found on an object that is currently selected.AutoCompletionPriority
mergeWith(AutoCompletionPriority other)
Merges two priorities.String
toString()
-
-
-
Field Detail
-
IS_IN_STANDARD_AND_IN_DATASET
public static final AutoCompletionPriority IS_IN_STANDARD_AND_IN_DATASET
Indicates, that the value is standard and it is found in the data. This has higher priority than some arbitrary standard value that is usually not used by the user.
-
IS_IN_DATASET
public static final AutoCompletionPriority IS_IN_DATASET
Indicates that this is an arbitrary value from the data set, i.e. the value of a tag name=*.
-
IS_IN_STANDARD
public static final AutoCompletionPriority IS_IN_STANDARD
Indicates that this is a standard value, i.e. a standard tag name or a standard value for a given tag name (from the presets).
-
IS_IN_SELECTION
public static final AutoCompletionPriority IS_IN_SELECTION
Indicates that this is a value from a selected object.
-
UNKNOWN
public static final AutoCompletionPriority UNKNOWN
Unknown priority. This is the lowest priority.
-
NO_USER_INPUT
private static final int NO_USER_INPUT
- See Also:
- Constant Field Values
-
userInput
private final int userInput
-
inDataSet
private final boolean inDataSet
-
inStandard
private final boolean inStandard
-
selected
private final boolean selected
-
-
Constructor Detail
-
AutoCompletionPriority
public AutoCompletionPriority(boolean inDataSet, boolean inStandard, boolean selected, Integer userInput)
Constructs a newAutoCompletionItemPriority
.- Parameters:
inDataSet
- true, if the item is found in the currently active data layerinStandard
- true, if the item is a standard tag, e.g. from the presetsselected
- true, if it is found on an object that is currently selecteduserInput
- null, if the user hasn't entered this tag so far. A number when the tag key / value has been entered by the user before. A lower number means this happened more recently and beats a higher number in priority.
-
AutoCompletionPriority
public AutoCompletionPriority(boolean inDataSet, boolean inStandard, boolean selected)
Constructs a newAutoCompletionItemPriority
.- Parameters:
inDataSet
- true, if the item is found in the currently active data layerinStandard
- true, if the item is a standard tag, e.g. from the presetsselected
- true, if it is found on an object that is currently selected
-
-
Method Detail
-
isInDataSet
public boolean isInDataSet()
Determines if the item is found in the currently active data layer.- Returns:
true
if the item is found in the currently active data layer
-
isInStandard
public boolean isInStandard()
Determines if the item is a standard tag, e.g. from the presets.- Returns:
true
if the item is a standard tag, e.g. from the presets
-
isSelected
public boolean isSelected()
Determines if it is found on an object that is currently selected.- Returns:
true
if it is found on an object that is currently selected
-
getUserInput
public Integer getUserInput()
Returns a number when the tag key / value has been entered by the user before. A lower number means this happened more recently and beats a higher number in priority.- Returns:
- a number when the tag key / value has been entered by the user before.
null
, if the user hasn't entered this tag so far.
-
compareTo
public int compareTo(AutoCompletionPriority other)
Imposes an ordering on the priorities. Currently, being in the current DataSet is worth more than being in the Presets.- Specified by:
compareTo
in interfaceComparable<AutoCompletionPriority>
-
mergeWith
public AutoCompletionPriority mergeWith(AutoCompletionPriority other)
Merges two priorities. The resulting priority is always >= the original ones.- Parameters:
other
- other priority- Returns:
- the merged priority
-
-