Class IntSpanSet

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

public class IntSpanSet extends SpanSet<Integer> implements Number
Class for representing lists of disjoint intspans.

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

>>> IntSpanSet(string='{[8, 10], [11, 12]}')

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

>>> IntSpanSet(span_list=['[8, 10]', '[11, 12]']) >>> IntSpanSet(span_list=[IntSpan('[8, 10]'), IntSpan('[11, 12]')])

Author:
ARIJIT SAMAL
  • Field Details

    • _inner

      private final jnr.ffi.Pointer _inner
  • Constructor Details

    • IntSpanSet

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

      public IntSpanSet(String str)
  • Method Details

    • createStringInner

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

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

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

      MEOS Functions:

    • intspanset_out
    • Overrides:
      toString in class Object
      Returns:
      A new String instance
    • to_span

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

      MEOS Functions:

    • spanset_span
    • Returns:
      A new IntSpan instance
    • to_floatspanset

      public FloatSpanSet to_floatspanset()
      Returns an intspanset that encompasses "this".

      MEOS Functions:

    • intspanset_floatspanset
    • Returns:
      A new FloatSpanSet instance
    • get_inner

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

      public int 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 IntSpan start_span()
    • end_span

      public IntSpan end_span()
    • span_n

      public IntSpan span_n(int n)
    • spans

      public List<IntSpan> spans()
    • shift

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

      MEOS Functions:

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

      public IntSpanSet scale(int width)
      Return a new "IntSpanSet" 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 IntSpanSet instance
    • shift_scale

      public IntSpanSet shift_scale(int delta, int width)
      Return a new "IntSpanSet" 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 IntSpanSet 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_intspanset_int
    • 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_intspanset_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_intspanset_int
    • 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_intspanset_int
    • 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_intspan_int
    • 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_intspanset_int
    • 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_intspanset_int
    • Parameters:
      other - object to compare with
      Returns:
      A float value
      Throws:
      Exception
    • intersection

      public IntSpanSet intersection(Object other) throws Exception
      ------------------------- Set Operations --------------------------------
      Throws:
      Exception
    • mul

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

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

      MEOS Functions:

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

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

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

      MEOS Functions:

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

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