Class Priority
- java.lang.Object
-
- org.scijava.Priority
-
public final class Priority extends Object
Constants for specifying an item's priority.- Author:
- Johannes Schindelin, Curtis Rueden
- See Also:
Prioritized.getPriority(),Plugin.priority()
-
-
Field Summary
Fields Modifier and Type Field Description static doubleEXTREMELY_HIGHPriority for items that very strongly prefer to be sorted early.static doubleEXTREMELY_LOWPriority for items that very strongly prefer to be sorted late.static doubleFIRSTPriority for items that must be sorted first.static doubleFIRST_PRIORITYDeprecated.UseFIRSTinstead.static doubleHIGHPriority for items that prefer to be sorted earlier.static doubleHIGH_PRIORITYDeprecated.UseHIGHinstead.static doubleLASTPriority for items that must be sorted last.static doubleLAST_PRIORITYDeprecated.UseLASTinstead.static doubleLOWPriority for items that prefer to be sorted later.static doubleLOW_PRIORITYDeprecated.UseLOWinstead.static doubleNORMALDefault priority for items.static doubleNORMAL_PRIORITYDeprecated.UseNORMALinstead.static doubleVERY_HIGHPriority for items that strongly prefer to be sorted early.static doubleVERY_HIGH_PRIORITYDeprecated.UseVERY_HIGHinstead.static doubleVERY_LOWPriority for items that strongly prefer to be sorted late.static doubleVERY_LOW_PRIORITYDeprecated.UseVERY_LOWinstead.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompare(Prioritized p1, Prioritized p2)Compares twoPrioritizedobjects.static booleaninject(Object o, double priority)Injects the specified priority into the given object.
-
-
-
Field Detail
-
FIRST
public static final double FIRST
Priority for items that must be sorted first.Note that it is still possible to prioritize something earlier than this value (e.g., for testing purposes), although doing so strongly discouraged in production.
- See Also:
- Constant Field Values
-
EXTREMELY_HIGH
public static final double EXTREMELY_HIGH
Priority for items that very strongly prefer to be sorted early.- See Also:
- Constant Field Values
-
VERY_HIGH
public static final double VERY_HIGH
Priority for items that strongly prefer to be sorted early.- See Also:
- Constant Field Values
-
HIGH
public static final double HIGH
Priority for items that prefer to be sorted earlier.- See Also:
- Constant Field Values
-
NORMAL
public static final double NORMAL
Default priority for items.- See Also:
- Constant Field Values
-
LOW
public static final double LOW
Priority for items that prefer to be sorted later.- See Also:
- Constant Field Values
-
VERY_LOW
public static final double VERY_LOW
Priority for items that strongly prefer to be sorted late.- See Also:
- Constant Field Values
-
EXTREMELY_LOW
public static final double EXTREMELY_LOW
Priority for items that very strongly prefer to be sorted late.- See Also:
- Constant Field Values
-
LAST
public static final double LAST
Priority for items that must be sorted last.Note that it is still possible to prioritize something later than this value (e.g., for testing purposes), although doing so strongly discouraged in production.
- See Also:
- Constant Field Values
-
FIRST_PRIORITY
@Deprecated public static final double FIRST_PRIORITY
Deprecated.UseFIRSTinstead.- See Also:
- Constant Field Values
-
VERY_HIGH_PRIORITY
@Deprecated public static final double VERY_HIGH_PRIORITY
Deprecated.UseVERY_HIGHinstead.- See Also:
- Constant Field Values
-
HIGH_PRIORITY
@Deprecated public static final double HIGH_PRIORITY
Deprecated.UseHIGHinstead.- See Also:
- Constant Field Values
-
NORMAL_PRIORITY
@Deprecated public static final double NORMAL_PRIORITY
Deprecated.UseNORMALinstead.- See Also:
- Constant Field Values
-
LOW_PRIORITY
@Deprecated public static final double LOW_PRIORITY
Deprecated.UseLOWinstead.- See Also:
- Constant Field Values
-
VERY_LOW_PRIORITY
@Deprecated public static final double VERY_LOW_PRIORITY
Deprecated.UseVERY_LOWinstead.- See Also:
- Constant Field Values
-
LAST_PRIORITY
@Deprecated public static final double LAST_PRIORITY
Deprecated.UseLASTinstead.- See Also:
- Constant Field Values
-
-
Method Detail
-
compare
public static int compare(Prioritized p1, Prioritized p2)
Compares twoPrioritizedobjects.Note: this method provides a natural ordering that may be inconsistent with equals. That is, two unequal objects may often have the same priority, and thus return 0 when compared in this fashion. Hence, if this method is used as a basis for implementing
Comparable.compareTo(T)orComparator.compare(T, T), that implementation may want to impose logic beyond that of this method, for breaking ties, if a total ordering consistent with equals is always required.- Returns:
- -1 if
p1's priority is higher thanp2's, 1 ifp2's priority is higher thanp1's, or 0 if they have the same priority. - See Also:
ClassUtils.compare(Class, Class)
-
inject
public static boolean inject(Object o, double priority)
Injects the specified priority into the given object. Note that this is only possible if the given object implements thePrioritizedinterface.- Parameters:
o- The object to which the priority should be assigned.- Returns:
- true If the priority was successfully injected.
-
-