Interface StoreTimer.Aggregate

    • Method Detail

      • getComponentEvents

        Set<? extends StoreTimer.Event> getComponentEvents()
        Returns the set of events that make up the aggregate. Note that theoretically an aggregate could be defined in a manner such that some events contributed to the aggregate in different fashions (for example, eventA + eventB - eventC), in which case this method would return the fact that the three events comprise the aggregate but with no indication of in which manner they contribute to its value.
        Returns:
        the events that comprise the aggregate
      • validate

        default <T extends StoreTimer.Event> T[] validate​(@Nonnull
                                                          T... events)
        Helper for implementations to validate that all of the events in the aggregate conform to some basic expectations.
        Type Parameters:
        T - the type of event
        Parameters:
        events - the events too validate
        Returns:
        the validated events
        Throws:
        RecordCoreArgumentException - if the validation assumptions are violated
      • validate

        default <T extends StoreTimer.Event> T[] validate​(@Nonnull
                                                          BiConsumer<T,​T> extraCheck,
                                                          @Nonnull
                                                          T... events)
        Helper for implementations to validate that all of the events in the aggregate conform to some basic expectations.
        Type Parameters:
        T - the type of event
        Parameters:
        extraCheck - a validation that takes the first event in the set of events and another event in the set of events and ensures that they are sufficiently compatible to aggregatee
        events - the events too validate
        Returns:
        the validated events
        Throws:
        RecordCoreArgumentException - if the validation assumptions are violated
      • compute

        @Nullable
        StoreTimer.Counter compute​(@Nonnull
                                   StoreTimer storeTimer)
        Compute the value for this aggregate.
        Parameters:
        storeTimer - the time from which to draw the values that are necessary to compute this aggregate
        Returns:
        the computed result or null if none of the value that comprise this aggregate were available
      • compute

        @Nullable
        default StoreTimer.Counter compute​(@Nonnull
                                           StoreTimer storeTimer,
                                           @Nonnull
                                           Set<? extends StoreTimer.Event> events)
        Compute the value for this aggregate.
        Parameters:
        storeTimer - the time from which to draw the values that are necessary to compute this aggregate
        events - the events that are to be aggregated into the resulting Counteer
        Returns:
        the computed result or null if none of the value that comprise this aggregate were available