Class SpanToolkit


  • public class SpanToolkit
    extends Object
    Toolkit for calculating combined span values. Creates spans which consist of at least a start time, an end time and a value. Spans are then combined together (see Combinable and Combiner) to form the largest time span where the combined value is still deemed to be over some threshold. Threshold can be either a defined limit or a calculated density.

    Currently, it's up to the caller of this toolkit to call the methods with a subset of items that have only one item iterable, which means that events should not overlap in time.

    • Constructor Detail

      • SpanToolkit

        public SpanToolkit()
    • Method Detail

      • getMaxCountCluster

        public static SpanSquare getMaxCountCluster​(IItemCollection items,
                                                    IAttribute<IQuantity> countAttribute,
                                                    IAttribute<IQuantity> timestampAttribute)
        Calculates the largest count cluster.
        Parameters:
        items - the item collection
        countAttribute - the attribute to get count value from, is assumed to be an accumulative value, for example exception statistics
        timestampAttribute - the attribute to get a time stamp from
        Returns:
        The maximum count span
      • getMaxDurationCluster

        public static SpanSquare getMaxDurationCluster​(IItemCollection items)
        Calculates the largest duration cluster.
        Parameters:
        items - the item collection
        Returns:
        The maximum duration span
      • getMaxSpanLimit

        public static SpanLimit getMaxSpanLimit​(IItemCollection items,
                                                IAttribute<IQuantity> valueAttribute,
                                                IAttribute<IQuantity> endTimeAttribute,
                                                double limit)
        Calculates the longest span where the combined value still is above the limit.
        Parameters:
        items - the item collection
        valueAttribute - the value attribute
        endTimeAttribute - the end time attribute
        limit - the min limit
        Returns:
        a span