Class StdOperator<T extends ChronoEntity<T>>

java.lang.Object
net.time4j.engine.StdOperator<T>
Type Parameters:
T - generic target type of operator
All Implemented Interfaces:
Function<T,​T>, UnaryOperator<T>, ChronoOperator<T>

public class StdOperator<T extends ChronoEntity<T>> extends Object implements ChronoOperator<T>

Factory for producing standard chronological operators which are applicable on most chronological entities.

Since:
3.5/4.3
Author:
Meno Hochschild
  • Method Details

    • apply

      public T apply(T entity)
      Description copied from interface: ChronoOperator

      Adjusts given entity and yields a changed copy of argument.

      Will be called by ChronoEntity.with(ChronoOperator).

      Specified by:
      apply in interface ChronoOperator<T extends ChronoEntity<T>>
      Specified by:
      apply in interface Function<T extends ChronoEntity<T>,​T extends ChronoEntity<T>>
      Parameters:
      entity - chronological entity to be adjusted
      Returns:
      adjusted copy of argument which itself remains unaffected
    • minimized

      public static <T extends ChronoEntity<T>> ChronoOperator<T> minimized(ChronoElement<?> element)

      Yields a new operator which can set any entity to its minimum element value.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
    • maximized

      public static <T extends ChronoEntity<T>> ChronoOperator<T> maximized(ChronoElement<?> element)

      Yields a new operator which can set any entity to its maximum element value.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
    • decremented

      public static <T extends ChronoEntity<T>> ChronoOperator<T> decremented(ChronoElement<?> element)

      Yields a new operator which can set any entity such that its actual element value gets the decremented value.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
      See Also:
      TimeAxis.getBaseUnit(ChronoElement)
    • incremented

      public static <T extends ChronoEntity<T>> ChronoOperator<T> incremented(ChronoElement<?> element)

      Yields a new operator which can set any entity such that its actual element value gets the incremented value.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
      See Also:
      TimeAxis.getBaseUnit(ChronoElement)
    • atFloor

      public static <T extends ChronoEntity<T>> ChronoOperator<T> atFloor(ChronoElement<?> element)

      Yields an operator which rounds any entity down so that the child elements will be set to the minimum.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
    • atCeiling

      public static <T extends ChronoEntity<T>> ChronoOperator<T> atCeiling(ChronoElement<?> element)

      Yields an operator which rounds any entity up so that the child elements will be set to the maximum.

      Type Parameters:
      T - generic type of target entity
      Parameters:
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
    • setLenient

      public static <T extends ChronoEntity<T>,​ V> ChronoOperator<T> setLenient(V value, ChronoElement<V> element)

      Yields an operator which sets any entity such that its actual element value will be set in lenient mode to given value.

      Type Parameters:
      T - generic type of target entity
      V - generic element value type
      Parameters:
      value - new element value
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3
    • newValue

      public static <T extends ChronoEntity<T>,​ V> ChronoOperator<T> newValue(V value, ChronoElement<V> element)

      Yields an operator which sets any entity such that its actual element value will be set in normal mode to given value.

      Type Parameters:
      T - generic type of target entity
      V - generic element value type
      Parameters:
      value - new element value
      element - associated chronological element
      Returns:
      operator
      Since:
      3.5/4.3