Class MemberAccessorToolkit


  • public class MemberAccessorToolkit
    extends Object
    Toolkit for working with member accessors. The methods in this class can create accessors that perform various types of calculations based on the values retrieved by other accessors.
    • Constructor Detail

      • MemberAccessorToolkit

        public MemberAccessorToolkit()
    • Method Detail

      • difference

        public static <T> IMemberAccessor<IQuantity,​T> difference​(IMemberAccessor<IQuantity,​T> minuend,
                                                                        IMemberAccessor<IQuantity,​T> subtrahend)
        Create an accessor that subtracts values of one accessor from the values of another accessor.
        Parameters:
        minuend - accessor retrieving the value to subtract from
        subtrahend - accessor retrieving the value to subtract
        Returns:
        an accessor returning the difference between the input accessor values
      • sum

        public static <T> IMemberAccessor<IQuantity,​T> sum​(IMemberAccessor<IQuantity,​T> term1,
                                                                 IMemberAccessor<IQuantity,​T> term2)
        Create an accessor that adds the values of two accessors.
        Parameters:
        term1 - accessor retrieving the first value to add
        term2 - accessor retrieving the second value to add
        Returns:
        an accessor returning the sum of the input accessor values
      • avg

        public static <T> IMemberAccessor<IQuantity,​T> avg​(IMemberAccessor<IQuantity,​T> data1,
                                                                 IMemberAccessor<IQuantity,​T> data2)
        Create an accessor that calculates the average of the values from two accessors.
        Parameters:
        data1 - accessor retrieving the first value
        data2 - accessor retrieving the second value
        Returns:
        an accessor returning the average of the input accessor values
      • addHalfDelta

        public static <T> IMemberAccessor<IQuantity,​T> addHalfDelta​(IMemberAccessor<IQuantity,​T> bias,
                                                                          IMemberAccessor<IQuantity,​T> delta)
        Create an accessor that adds half of a delta value to a bias value. Useful for example to find a center time if the bias is a start time and the delta is the duration of an event.
        Parameters:
        bias - accessor retrieving the bias value
        delta - accessor retrieving the delta value
        Returns:
        an accessor returning the the bias value plus half of the delta value
      • subtractHalfDelta

        public static <T> IMemberAccessor<IQuantity,​T> subtractHalfDelta​(IMemberAccessor<IQuantity,​T> bias,
                                                                               IMemberAccessor<IQuantity,​T> delta)
        Create an accessor that subtracts half of a delta value from a bias value. Useful for example to find a center time if the bias is an end time and the delta is the duration of an event.
        Parameters:
        bias - accessor retrieving the bias value
        delta - accessor retrieving the delta value
        Returns:
        an accessor returning the the bias value minus half of the delta value
      • rangeWithEnd

        public static <T> IMemberAccessor<IRange<IQuantity>,​T> rangeWithEnd​(IMemberAccessor<IQuantity,​T> start,
                                                                                  IMemberAccessor<IQuantity,​T> end)
        Create an accessor that constructs ranges based on start and end values.
        Parameters:
        start - accessor retrieving the start value
        end - accessor retrieving the end value
        Returns:
        an accessor returning ranges based on the start and end values
      • rangeWithExtent

        public static <T> IMemberAccessor<IRange<IQuantity>,​T> rangeWithExtent​(IMemberAccessor<IQuantity,​T> start,
                                                                                     IMemberAccessor<IQuantity,​T> extent)
        Create an accessor that constructs ranges based on start and extent values.
        Parameters:
        start - accessor retrieving the start value
        extent - accessor retrieving the range extent
        Returns:
        an accessor returning ranges based on the start and extent values
      • rangeWithExtentEnd

        public static <T> IMemberAccessor<IRange<IQuantity>,​T> rangeWithExtentEnd​(IMemberAccessor<IQuantity,​T> extent,
                                                                                        IMemberAccessor<IQuantity,​T> end)
        Create an accessor that constructs ranges based on end and extent values.
        Parameters:
        extent - accessor retrieving the range extent
        end - accessor retrieving the end value
        Returns:
        an accessor returning ranges based on the end and extent values
      • pointRange

        public static <T> IMemberAccessor<IRange<IQuantity>,​T> pointRange​(IMemberAccessor<IQuantity,​T> point)
        Create an accessor that constructs point ranges (ranges with zero extent) based on point values.
        Parameters:
        point - accessor retrieving the point position values
        Returns:
        an accessor returning point ranges
      • constant

        public static <T,​M,​V extends M> IMemberAccessor<M,​T> constant​(V value)
        Create an accessor that always return the same value.
        Parameters:
        value - constant value to return
        Returns:
        an accessor returning the constant value
      • arrayElement

        public static IMemberAccessor<?,​Object[]> arrayElement​(int index)
        Create an accessor that returns a fixed element index from arrays.
        Parameters:
        index - array index to return
        Returns:
        an accessor returning the object at the specified index in an array
      • compositeElement

        public static IMemberAccessor<?,​CompositeData> compositeElement​(String key)
        Create an accessor that returns a specified value from CompositeData instances.
        Parameters:
        key - key of the value to get
        Returns:
        an accessor returning the value associated with the specified key