Class FloatSpan

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

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

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

>>> FloatSpan('(2.5, 5.21]')

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

>>> FloatSpan(lower=2.0, upper=5.8) >>> FloatSpan(lower=2.0, upper=5.8, lower_inc=False, upper_inc=True) >>> FloatSpan(lower='2.0', upper='5.8', upper_inc=True)

Author:
ARIJIT SAMAL
  • Field Details

    • _inner

      private final jnr.ffi.Pointer _inner
  • Constructor Details

    • FloatSpan

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

      public FloatSpan(String str)
    • FloatSpan

      public FloatSpan(float lower, float upper, boolean lower_inc, boolean upper_inc)
    • FloatSpan

      public FloatSpan(float lower, String upper, boolean lower_inc, boolean upper_inc)
    • FloatSpan

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

      public FloatSpan(String lower, float upper, boolean lower_inc, boolean upper_inc)
    • FloatSpan

      public FloatSpan(float lower, float upper)
  • Method Details

    • createStringInner

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

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

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

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

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

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

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

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

      MEOS Functions:

    • floatspan_out
    • Parameters:
      max_decimals - number of maximum decimals
      Returns:
      A new String instance
    • to_spanset

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

      MEOS Functions:

    • set_to_spanset
    • Returns:
      A new FloatSpanSet instance
    • to_intspan

      public IntSpan to_intspan()
      Converts "this" to a IntSpan instance.

      MEOS Functions:

    • floatspan_intspan
    • Returns:
      A new IntSpan instance
    • get_inner

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

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

      MEOS Functions:

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

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

      MEOS Functions:

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

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

      MEOS Functions:

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

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

      MEOS Functions:

    • floatspan_shift_scale
    • Parameters:
      delta - The value to shift by
      Returns:
      A new FloatSpan instance
    • scale

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

      MEOS Functions:

    • floatspan_shift_scale
    • Parameters:
      width - The new width
      Returns:
      a new FloatSpan instance
    • shift_scale

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

      MEOS Functions:

    • floatspan_shift_scale
    • Parameters:
      delta - The value to shift by
      width - value to compare with
      Returns:
      a new FloatSpan 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_floatspan_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_set_set
    • contains_floatspan_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 before "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 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_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 after "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 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_floatspan_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_span_span
    • distance_span_spanset
    • distance_floatspan_float
    • Parameters:
      other - object to compare with
      Returns:
      A float value
      Throws:
      Exception
    • intersection

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

      MEOS Functions:

    • intersection_span_span
    • intersection_spanset_span
    • intersection_floatset_float
    • Parameters:
      other - object to intersect with
      Returns:
      A Number. The actual class depends on * "other".
      Throws:
      Exception
    • minus

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

      MEOS Functions:

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

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

      MEOS Functions:

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