java.lang.Object
java.lang.Enum<Time>
org.variantsync.diffdetective.variation.diff.Time
All Implemented Interfaces:
Serializable, Comparable<Time>, Constable

public enum Time extends Enum<Time>
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
  • Enum Constant Details

    • BEFORE

      public static final Time BEFORE
    • AFTER

      public static final Time AFTER
  • Constructor Details

    • Time

      private Time()
  • Method Details

    • values

      public static Time[] 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

      public static Time valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • forAll

      public static void forAll(Consumer<Time> f)
      Invoke the given function for each time value (i.e., each value in this enum).
      Parameters:
      f - callback
    • match

      public <T> T match(Supplier<T> before, Supplier<T> after)
      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

      public Time other()
      Returns the complement of this time.
      Returns:
      BEFORE if this == AFTER or AFTER if this == BEFORE