Enum Class Time
- All Implemented Interfaces:
Serializable
,Comparable<Time>
,Constable
A value that refers to the state before or after an edit occurred.
These correspond to the time values b and a from our paper.
- Author:
- Paul Bittner
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Invoke the given function for each time value (i.e., each value in this enum).<T> T
Pattern matching on Time for Suppliers.<T> T
match
(T before, T after) Pattern matching on Time.other()
Returns the complement of this time.static Time
Returns the enum constant of this class with the specified name.static Time[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BEFORE
-
AFTER
-
-
Constructor Details
-
Time
private Time()
-
-
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
-
forAll
Invoke the given function for each time value (i.e., each value in this enum).- Parameters:
f
- callback
-
match
Pattern matching on Time for Suppliers. Invokes the corresponding supplier depending on this time's value. If this time is BEFORE, then the before supplier is invoked, otherwise the after supplier is invoked.- Type Parameters:
T
- Type of the value to produce.- Parameters:
before
- The supplier to invoke when this time is BEFORE.after
- The supplier to invoke when this time is AFTER.- Returns:
- The value returned by the corresponding supplier.
-
match
public <T> T match(T before, T after) Pattern matching on Time. Returns the corresponding value depending on this time's value.- Type Parameters:
T
- Value type- Parameters:
before
- Value to return if this time is BEFORE.after
- Value to return if this time is AFTER.- Returns:
- The value for the corresponding time.
-
other
Returns the complement of this time.- Returns:
BEFORE
ifthis == AFTER
orAFTER
ifthis == BEFORE
-