Package ch.njol.skript.classes
Enum Class Comparator.Relation
- All Implemented Interfaces:
Serializable
,Comparable<Comparator.Relation>
,Constable
- Enclosing interface:
- Comparator<T1,T2>
represents a relation between two objects.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Comparator.Relation
get(boolean b)
Returns EQUAL for true or NOT_EQUAL for falsestatic Comparator.Relation
get(double d)
Gets a Relation from a difference: If d is 0, EQUAL is returned, if d is greater than 0, GREATER is returned, otherwise SMALLER.static Comparator.Relation
get(int i)
Gets a Relation from a difference: If i is 0, EQUAL is returned, if i is greater than 0, GREATER is returned, otherwise SMALLER.Gets the inverse of this relation, i.e if this relation fulfilsX rel Y
, then the returned relation fulfils!(X rel Y)
.int
Gets the relation which has switched arguments, i.e.boolean
is(Comparator.Relation other)
Test whether this relation is fulfilled if another is, i.e.boolean
toString()
Returns this relation's string representation, which is similar to "equal to" or "greater than".static Comparator.Relation
Returns the enum constant of this class with the specified name.static Comparator.Relation[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EQUAL
-
NOT_EQUAL
-
GREATER
-
GREATER_OR_EQUAL
-
SMALLER
-
SMALLER_OR_EQUAL
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
get
Returns EQUAL for true or NOT_EQUAL for false- Parameters:
b
-- Returns:
- b ? Relation.EQUAL : Relation.NOT_EQUAL
-
get
Gets a Relation from a difference: If i is 0, EQUAL is returned, if i is greater than 0, GREATER is returned, otherwise SMALLER.- Parameters:
i
-- Returns:
- i == 0 ? Relation.EQUAL : i > 0 ? Relation.GREATER : Relation.SMALLER
-
get
Gets a Relation from a difference: If d is 0, EQUAL is returned, if d is greater than 0, GREATER is returned, otherwise SMALLER.- Parameters:
d
-- Returns:
- d == 0 ? Relation.EQUAL : d > 0 ? Relation.GREATER : Relation.SMALLER
-
is
Test whether this relation is fulfilled if another is, i.e. if the parameter relation fulfilsX rel Y
, then this relation fulfilsX rel Y
as well.- Parameters:
other
-- Returns:
- Whether this relation is part of the given relation, e.g.
GREATER_OR_EQUAL.is(EQUAL)
returns true.
-
toString
Returns this relation's string representation, which is similar to "equal to" or "greater than".- Overrides:
toString
in classEnum<Comparator.Relation>
-
getInverse
Gets the inverse of this relation, i.e if this relation fulfilsX rel Y
, then the returned relation fulfils!(X rel Y)
.- Returns:
- !this
-
getSwitched
Gets the relation which has switched arguments, i.e. if this relation fulfilsX rel Y
, then the returned relation fulfilsY rel X
.- Returns:
- siht
-
isEqualOrInverse
public boolean isEqualOrInverse() -
getRelation
public int getRelation()
-