Class FloatSpanSet

java.lang.Object
types.collections.base.SpanSet<Float>
types.collections.number.FloatSpanSet
All Implemented Interfaces:
Base, Collection, Number, TemporalObject

public class FloatSpanSet extends SpanSet<Float> implements Number
Class for representing lists of disjoint floatspans.

``FloatSpanSet`` objects can be created with a single argument of type string as in MobilityDB.

>>> FloatSpanSet(string='{[8, 10], [11, 1]}')

Another possibility is to give a list specifying the composing spans, which can be instances of ``str`` or ``FloatSpan``. The composing spans must be given in increasing order.

>>> FloatSpanSet(span_list=['[8, 10]', '[11, 12]']) >>> FloatSpanSet(span_list=[FloatSpan('[8, 10]'), FloatSpan('[11, 12]')])

Author:
ARIJIT SAMAL
  • Field Details

    • _inner

      private final jnr.ffi.Pointer _inner
  • Constructor Details

    • FloatSpanSet

      public FloatSpanSet(jnr.ffi.Pointer inner)
      ------------------------- Constructors ----------------------------------
    • FloatSpanSet

      public FloatSpanSet(String str)
  • Method Details

    • createStringInner

      public jnr.ffi.Pointer createStringInner(String str)
      Specified by:
      createStringInner in class SpanSet<Float>
    • createInner

      public jnr.ffi.Pointer createInner(jnr.ffi.Pointer inner)
      Specified by:
      createInner in class SpanSet<Float>
    • toString

      public String toString(int max_decimals)
      Return the string representation of the content of "this".

      MEOS Functions:

    • floatspanset_out
    • Parameters:
      max_decimals - number of maximum decimals
      Returns:
      A new String instance
    • to_span

      public FloatSpan to_span()
      Returns a span that encompasses "this".

      MEOS Functions:

    • spanset_span
    • Returns:
      A new FloatSpan instance
    • to_intspanset

      public IntSpanSet to_intspanset()
      Returns an intspanset that encompasses "this".

      MEOS Functions:

    • floatspanset_intspanset
    • Returns:
      A new IntSpanSet instance
    • get_inner

      public jnr.ffi.Pointer get_inner()
      ------------------------- Accessors -------------------------------------
      Specified by:
      get_inner in class SpanSet<Float>
    • width

      public float width(boolean ignore_gaps)
      Returns the width of the spanset. By default, i.e., when the second argument is False, the function takes into account the gaps within, i.e., returns the sum of the widths of the spans within. Otherwise, the function returns the width of the spanset ignoring any gap, i.e., the width from the lower bound of the first span to the upper bound of the last span.

      MEOS Functions:

    • spanset_width
    • Parameters:
      ignore_gaps - Whether to take into account potential gaps in * the spanset.
      Returns:
      A `float` representing the duration of the spanset
    • start_span

      public FloatSpan start_span()
    • end_span

      public FloatSpan end_span()
    • span_n

      public FloatSpan span_n(int n)
    • spans

      public List<FloatSpan> spans()
    • shift

      public FloatSpanSet shift(int delta)
      Return a new "FloatSpanSet" with the lower and upper bounds shifted by "delta".

      MEOS Functions:

    • floatspanset_shift_scale
    • Parameters:
      delta - The value to shift by
      Returns:
      A new FloatSpanSet instance
    • scale

      public FloatSpanSet scale(int width)
      Return a new "FloatSpanSet" with the lower and upper bounds scaled so that the width is "width".

      MEOS Functions:

    • floatspanset_shift_scale
    • Parameters:
      width - The new width
      Returns:
      a new FloatSpanSet instance
    • shift_scale

      public FloatSpanSet shift_scale(int delta, int width)
      Return a new "FloatSpanSet" with the lower and upper bounds shifted by "delta" and scaled so that the width is "width".

      MEOS Functions:

    • floatspanset_shift_scale
    • Parameters:
      delta - The value to shift by
      width - v
      Returns:
      a new FloatSpanSet instance
    • is_adjacent

      public boolean is_adjacent(Object other) throws Exception
      Returns whether "this" is adjacent to "other". That is, they share a bound but only one of them contains it.

      MEOS Functions:

    • adjacent_spanset_span
    • adjacent_spanset_spanset
    • adjacent_floatspanset_float
    • Parameters:
      other - object to compare with
      Returns:
      True if adjacent, False otherwise
      Throws:
      Exception
    • contains

      public boolean contains(Object other) throws Exception
      Returns whether "this" contains "content".

      MEOS Functions:

    • contains_spanset_span
    • contains_spanset_spanset
    • contains_floatspanset_float
    • Parameters:
      other - object to compare with
      Returns:
      True if contains, False otherwise
      Throws:
      Exception
    • is_same

      public boolean is_same(Object other) throws Exception
      Returns whether "this" and the bounding period of "other" is the same.

      MEOS Functions:

    • same_period_temporal
    • Parameters:
      other - object to compare with
      Returns:
      True if equal, False otherwise
      Throws:
      Exception
    • is_left

      public boolean is_left(Object other) throws Exception
      Returns whether "this" is strictly left of "other". That is, "this" ends before "other" starts.

      MEOS Functions:

    • left_span_span
    • left_span_spanset
    • left_floatspan_float
    • Parameters:
      other - object to compare with
      Returns:
      True if left, False otherwise
      Throws:
      Exception
    • is_over_or_left

      public boolean is_over_or_left(Object other) throws Exception
      Returns whether "this" is left "other" allowing overlap. That is, "this" ends before "other" ends (or at the same value).

      MEOS Functions:

    • overleft_span_span
    • overleft_span_spanset
    • overleft_floatspan_float
    • Parameters:
      other - object to compare with
      Returns:
      True if before, False otherwise
      Throws:
      Exception
    • is_right

      public boolean is_right(Object other) throws Exception
      Returns whether "this" is strictly right "other". That is, "this" starts after "other" ends.

      MEOS Functions:

    • right_span_span
    • right_span_spanset
    • right_floatspan_float
    • Parameters:
      other - object to compare with
      Returns:
      True if right, False otherwise
      Throws:
      Exception
    • is_over_or_right

      public boolean is_over_or_right(Object other) throws Exception
      Returns whether "this" is right "other" allowing overlap. That is, "this" starts after "other" starts (or at the same value).

      MEOS Functions:

    • overright_spanset_span
    • overright_spanset_spanset
    • overright_floatspanset_float
    • Parameters:
      other - object to compare with
      Returns:
      True if overlapping or after, False otherwise
      Throws:
      Exception
    • distance

      public float distance(Object other) throws Exception
      Returns the distance between "this" and "other".

      MEOS Functions:

    • distance_spanset_span
    • distance_spanset_spanset
    • distance_floatspanset_float
    • Parameters:
      other - object to compare with
      Returns:
      A float value
      Throws:
      Exception
    • intersection

      public FloatSpanSet intersection(Object other) throws Exception
      Returns the intersection of "this" and "other".

      MEOS Functions:

    • intersection_floatspanset_float
    • Parameters:
      other - object to intersect with
      Returns:
      An boolean value
      Throws:
      Exception
    • mul

      public FloatSpanSet mul(int other) throws Exception
      Throws:
      Exception
    • minus

      public FloatSpanSet minus(Object other) throws Exception
      Returns the difference of "this" and "other".

      MEOS Functions:

    • minus_spanset_span
    • minus_spanset_spanset
    • minus_floatspanset_float
    • Parameters:
      other - object to diff with
      Returns:
      A FloatSpanSet instance.
      Throws:
      Exception
    • sub

      public FloatSpanSet sub(int other) throws Exception
      Throws:
      Exception
    • union

      public FloatSpanSet union(Object other) throws Exception
      Returns the union of "this" and "other".

      MEOS Functions:

    • union_floatspanset_float
    • union_spanset_spanset
    • union_spanset_span
    • Parameters:
      other - object to merge with
      Returns:
      A FloatSpanSet instance.
      Throws:
      Exception
    • add

      public FloatSpanSet add(int other) throws Exception
      Throws:
      Exception