Class PiecewiseConstantSpecificDays

java.lang.Object
net.sourceforge.plantuml.project.ngm.math.AbstractPiecewiseConstant
net.sourceforge.plantuml.project.ngm.math.PiecewiseConstantSpecificDays
All Implemented Interfaces:
PiecewiseConstant

public final class PiecewiseConstantSpecificDays extends AbstractPiecewiseConstant
Immutable implementation of PiecewiseConstant that models a workload pattern defined by specific dates.

Each specific LocalDate value is associated with a constant Fraction representing the workload for that day (for example 3/10 for 30%). A zero value is meaningful and represents no allocation on that day.

For any date not explicitly mapped, a default value is returned.

  • Method Details

    • of

      public static PiecewiseConstantSpecificDays of(Fraction value)
      Creates a PiecewiseConstantSpecificDays with the given default value.
      Parameters:
      value - The default workload fraction.
      Returns:
      A new PiecewiseConstantSpecificDays instance.
    • withDay

      public PiecewiseConstantSpecificDays withDay(LocalDate day, Fraction value)
      Returns a new PiecewiseConstantSpecificDays with the specified day associated with the given fraction.
      Parameters:
      day - The specific date to associate.
      value - The workload fraction for the specified date.
      Returns:
      A new PiecewiseConstantSpecificDays instance with the updated mapping.
    • segmentAt

      public Segment segmentAt(LocalDateTime instant, TimeDirection direction)
      (non-Javadoc)
      See Also:
      • net.sourceforge.plantuml.project.ngm.math.AbstractPiecewiseConstant#segmentAt(java.time.LocalDateTime)