Class IntSpan

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

public class IntSpan extends Span<Integer> implements Number
Class for representing sets of contiguous integer values between a lower and an upper bound. The bounds may be inclusive or not.

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

>>> IntSpan('(2, 5]')

Another possibility is to provide the ``lower`` and ``upper`` named parameters (of type str or int), and optionally indicate whether the bounds are inclusive or exclusive (by default, the lower bound is inclusive and the upper is exclusive):

>>> IntSpan(lower=2, upper=5) >>> IntSpan(lower=2, upper=5, lower_inc=False, upper_inc=True) >>> IntSpan(lower='2', upper='5', upper_inc=True)

Author:
ARIJIT SAMAL
  • Field Details

    • _inner

      private final jnr.ffi.Pointer _inner
  • Constructor Details

    • IntSpan

      public IntSpan(jnr.ffi.Pointer inner)
      ------------------------- Constructor ----------------------------------------
    • IntSpan

      public IntSpan(String str)
    • IntSpan

      public IntSpan(int lower, int upper, boolean lower_inc, boolean upper_inc)
    • IntSpan

      public IntSpan(int lower, String upper, boolean lower_inc, boolean upper_inc)
    • IntSpan

      public IntSpan(String lower, String upper, boolean lower_inc, boolean upper_inc)
    • IntSpan

      public IntSpan(String lower, int upper, boolean lower_inc, boolean upper_inc)
    • IntSpan

      public IntSpan(int lower, int upper)
  • Method Details

    • createStringInner

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

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

      public jnr.ffi.Pointer createIntInt(Number lower, Number upper, boolean lower_inc, boolean upper_inc)
      Specified by:
      createIntInt in class Span<Integer>
    • createIntStr

      public jnr.ffi.Pointer createIntStr(Number lower, String upper, boolean lower_inc, boolean upper_inc)
      Specified by:
      createIntStr in class Span<Integer>
    • createStrStr

      public jnr.ffi.Pointer createStrStr(String lower, String upper, boolean lower_inc, boolean upper_inc)
      Specified by:
      createStrStr in class Span<Integer>
    • createStrInt

      public jnr.ffi.Pointer createStrInt(String lower, Number upper, boolean lower_inc, boolean upper_inc)
      Specified by:
      createStrInt in class Span<Integer>
    • createIntIntNb

      public jnr.ffi.Pointer createIntIntNb(Number lower, Number upper)
      Specified by:
      createIntIntNb in class Span<Integer>
    • copy

      public IntSpan copy()
      Return a copy of "this".

      MEOS Functions:

    • span_copy
    • Returns:
      a new IntSpan instance
    • from_hexwkb

      public IntSpan from_hexwkb(String str)
      Returns a tstzspan from its WKB representation in hex-encoded ASCII.

      MEOS Functions:

    • span_from_hexwkb
    • Parameters:
      str - WKB representation in hex-encoded ASCII
      Returns:
    • toString

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

      MEOS Functions:

    • intspan_out
    • Overrides:
      toString in class Object
      Returns:
      A new String instance
    • to_spanset

      public IntSpanSet to_spanset()
      Returns a SpanSet that contains a Span for each element in "this".

      MEOS Functions:

    • span_to_spanset
    • Returns:
      A new IntSpanSet instance
    • tofloatspan

      public FloatSpan tofloatspan()
      Converts "this" to a FloatSpan instance.

      MEOS Functions:

    • intspan_floatspan
    • Returns:
      A new :class:`FloatSpan` instance
    • get_inner

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

      public Integer lower()
      Returns the lower bound of "this".

      MEOS Functions:

    • period_lower
    • Specified by:
      lower in class Span<Integer>
      Returns:
      The lower bound of the span as a Integer
    • upper

      public Integer upper()
      Returns the upper bound of "this".

      MEOS Functions:

    • period_upper
    • Specified by:
      upper in class Span<Integer>
      Returns:
      The lower bound of the span as a Integer
    • width

      public float width()
      Returns the width of "this".

      MEOS Functions:

    • span_width
    • Overrides:
      width in class Span<Integer>
      Returns:
      Returns a "float" representing the width of the span
    • shift

      public IntSpan 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 IntSpan 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 IntSpan 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_span_span
    • adjacent_span_spanset
    • adjacent_intspan_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_set_set
    • contains_intspan_int
    • 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 before "other". That is, "this" ends before "other" starts.

      MEOS Functions: left_span_span left_span_spanset left_intspan_int

      Parameters:
      other - object to compare with
      Returns:
      True if before, False otherwise
      Throws:
      Exception
    • is_over_or_left

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

      MEOS Functions:

    • overleft_span_span
    • overleft_span_spanset
    • overleft_intspan_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 after "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 after, False otherwise
      Throws:
      Exception
    • is_over_or_right

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

      MEOS Functions:

    • overright_span_span
    • overright_span_spanset
    • overright_intspan_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_span_span
    • distance_span_spanset
    • distance_intspan_int
    • Parameters:
      other - object to compare with
      Returns:
      A float value
      Throws:
      Exception
    • intersection

      public IntSpan intersection(Object other) throws Exception
      Throws:
      Exception
    • minus

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

      MEOS Functions:

    • minus_span_span
    • minus_spanset_span
    • minus_intspan_int
    • Parameters:
      other - object to diff with
      Returns:
      A IntSpanSet instance.
    • union

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

      MEOS Functions:

    • union_spanset_span
    • union_span_span
    • union_intspan_int
    • Parameters:
      other - object to merge with
      Returns:
      A IntSpanSet instance.
      Throws:
      Exception