Class Span<T>

java.lang.Object
types.collections.base.Span<T>
All Implemented Interfaces:
Base, Collection, TemporalObject
Direct Known Subclasses:
datespan, FloatSpan, IntSpan, tstzspan

public abstract class Span<T> extends Object implements Collection, Base
Abstract class that represents a span of temporal object
Author:
ARIJIT SAMAL
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private jnr.ffi.Pointer
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ------------------------- Constructors ----------------------------------
    Span(Number lower, Number upper)
     
    Span(Number lower, Number upper, boolean lower_inc, boolean upper_inc)
     
    Span(Number lower, String upper, boolean lower_inc, boolean upper_inc)
     
    Span(String str)
     
    Span(String lower, Number upper, boolean lower_inc, boolean upper_inc)
     
    Span(String lower, String upper, boolean lower_inc, boolean upper_inc)
     
    Span(jnr.ffi.Pointer inner)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Base other)
     
    Returns the WKB representation in hex-encoded ASCII.
    jnr.ffi.Pointer
    Returns the WKB representation
    boolean
    contains(Base other)
    Returns whether "this" contains "content".
    copy(Class<T> span)
    Returns the copy of a span
    abstract jnr.ffi.Pointer
    createInner(jnr.ffi.Pointer inner)
     
    abstract jnr.ffi.Pointer
    createIntInt(Number lower, Number upper, boolean lower_inc, boolean upper_inc)
     
    abstract jnr.ffi.Pointer
    createIntIntNb(Number lower, Number upper)
     
    abstract jnr.ffi.Pointer
    createIntStr(Number lower, String upper, boolean lower_inc, boolean upper_inc)
     
    abstract jnr.ffi.Pointer
     
    abstract jnr.ffi.Pointer
    createStrInt(String lower, Number upper, boolean lower_inc, boolean upper_inc)
     
    abstract jnr.ffi.Pointer
    createStrStr(String lower, String upper, boolean lower_inc, boolean upper_inc)
     
    private void
    distance(Base other)
    Returns the distance between "this" and "other".
    boolean
    eq(Base other)
    Return whether "this" and "other" are equal.
    static <T> T
    from_hexwkb(String hexwkb, Class<T> spanType)
    Returns a `TsTzSpan` from its WKB representation in hex-encoded ASCII.
    <T> T
    from_wkb(jnr.ffi.Pointer wkb, long size, Class<T> spansetType)
    Returns a `TsTzSpan` from its WKB representation.
    abstract jnr.ffi.Pointer
     
    boolean
    Return whether "this" is greater than "other".
    boolean
    Return whether "this" is greater than or equal to "other".
    long
    Return the hash representation of "this".
    private Base
    Returns the intersection of "this" and "other".
    boolean
    Returns whether "this" is adjacent to "other".
    boolean
    Returns whether "this" is contained in "container".
    boolean
    is_left(Base other)
    Returns whether "this" is strictly before "other".
    boolean
    Returns whether "this" is before "other" allowing overlap.
    boolean
    Returns whether "this" is after "other" allowing overlap.
    boolean
    is_right(Base other)
    Returns whether "this" is strictly after "other".
    boolean
    is_same(Base other)
     
    boolean
    lessThan(Base other)
    Return whether "this" is less than "other".
    boolean
    Return whether "this" is less than or equal to "other".
    abstract T
    Returns the lower bound of a period
    boolean
    Returns whether the lower bound of the period is inclusive or not
    protected Base
    minus(Base other)
     
    mul(Base other)
     
    boolean
    notEquals(Base other)
    Return whether "this" and "other" are not equal.
    boolean
    overlaps(Base other)
    Returns whether "this" overlaps "other".
    <T> T
    to_spanset(Class<T> spansetType)
    Returns a tstzspan set containing span
    protected Base
    union(Base other)
    Returns the temporal union of "this" and "other".
    abstract T
    Returns the upper bound of a period
    boolean
    Returns whether the upper bound of the period is inclusive or not
    float
    Returns the duration of the period.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _inner

      private jnr.ffi.Pointer _inner
  • Constructor Details

    • Span

      public Span()
      ------------------------- Constructors ----------------------------------
    • Span

      public Span(jnr.ffi.Pointer inner)
    • Span

      public Span(String str)
    • Span

      public Span(Number lower, Number upper, boolean lower_inc, boolean upper_inc)
    • Span

      public Span(Number lower, String upper, boolean lower_inc, boolean upper_inc)
    • Span

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

      public Span(String lower, Number upper, boolean lower_inc, boolean upper_inc)
    • Span

      public Span(Number lower, Number upper)
  • Method Details

    • get_inner

      public abstract jnr.ffi.Pointer get_inner()
    • createInner

      public abstract jnr.ffi.Pointer createInner(jnr.ffi.Pointer inner)
    • createStringInner

      public abstract jnr.ffi.Pointer createStringInner(String str)
    • createIntInt

      public abstract jnr.ffi.Pointer createIntInt(Number lower, Number upper, boolean lower_inc, boolean upper_inc)
    • createIntStr

      public abstract jnr.ffi.Pointer createIntStr(Number lower, String upper, boolean lower_inc, boolean upper_inc)
    • createStrStr

      public abstract jnr.ffi.Pointer createStrStr(String lower, String upper, boolean lower_inc, boolean upper_inc)
    • createStrInt

      public abstract jnr.ffi.Pointer createStrInt(String lower, Number upper, boolean lower_inc, boolean upper_inc)
    • createIntIntNb

      public abstract jnr.ffi.Pointer createIntIntNb(Number lower, Number upper)
    • lower

      public abstract T lower()
      Returns the lower bound of a period
      Returns:
      T type
    • upper

      public abstract T upper()
      Returns the upper bound of a period
      Returns:
      T type
    • copy

      Returns the copy of a span
      Returns:
      Pointer type
      Throws:
      NoSuchMethodException
      InvocationTargetException
      InstantiationException
      IllegalAccessException
    • from_wkb

      public <T> T from_wkb(jnr.ffi.Pointer wkb, long size, Class<T> spansetType) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
      Returns a `TsTzSpan` from its WKB representation.
      Returns:
      Pointer type
      Throws:
      NoSuchMethodException
      InvocationTargetException
      InstantiationException
      IllegalAccessException
    • from_hexwkb

      public static <T> T from_hexwkb(String hexwkb, Class<T> spanType) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
      Returns a `TsTzSpan` from its WKB representation in hex-encoded ASCII.
      Returns:
      T type
      Throws:
      NoSuchMethodException
      InvocationTargetException
      InstantiationException
      IllegalAccessException
    • as_wkb

      public jnr.ffi.Pointer as_wkb()
      Returns the WKB representation
      Returns:
      Pointer type
    • as_hexwkb

      public String as_hexwkb()
      Returns the WKB representation in hex-encoded ASCII.
      Returns:
      String type
    • to_spanset

      Returns a tstzspan set containing span
      Returns:
      String type
      Throws:
      NoSuchMethodException
      InvocationTargetException
      InstantiationException
      IllegalAccessException
    • lower_inc

      public boolean lower_inc()
      Returns whether the lower bound of the period is inclusive or not

      MEOS Functions:

    • span_lower_inc
    • Returns:
      True if the lower bound of the period is inclusive and False otherwise
    • upper_inc

      public boolean upper_inc()
      Returns whether the upper bound of the period is inclusive or not

      MEOS Functions:

    • span_upper_inc
    • Returns:
      True if the upper bound of the period is inclusive and False otherwise
    • width

      public float width()
      Returns the duration of the period.

      MEOS Functions:

    • span_width
    • Returns:
      Returns a Float representing the duration of the period in seconds
    • hash

      public long hash()
      Return the hash representation of "this".

      MEOS Functions:

    • span_hash
    • Returns:
      A new Integer instance
    • is_adjacent

      public boolean is_adjacent(Base 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
    • Parameters:
      other - object to compare with
      Returns:
      True if adjacent, False otherwise
      Throws:
      Exception
    • is_contained_in

      public boolean is_contained_in(Base other) throws Exception
      Returns whether "this" is contained in "container".

      MEOS Functions:

    • contained_span_span
    • contained_span_spanset
    • contained_period_temporal
    • Specified by:
      is_contained_in in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if contained, False otherwise
      Throws:
      Exception
    • contains

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

      MEOS Functions:

      • contains_span_span
      • contains_span_spanset
      • contains_period_timestamp
      • contains_period_timestampset
      • contains_period_temporal
      Specified by:
      contains in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if contains, False otherwise
      Throws:
      Exception
    • overlaps

      public boolean overlaps(Base other) throws Exception
      Returns whether "this" overlaps "other". That is, both share at least an element.

      MEOS Functions:

    • overlaps_span_span
    • overlaps_span_spanset
    • Specified by:
      overlaps in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if overlaps, False otherwise
      Throws:
      Exception
    • is_same

      public boolean is_same(Base other) throws Exception
      Throws:
      Exception
    • is_left

      public boolean is_left(Base 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
    • Specified by:
      is_left in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if before, False otherwise
      Throws:
      Exception
    • is_over_or_left

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

      MEOS Functions:

    • overleft_span_span
    • overleft_span_spanset
    • Specified by:
      is_over_or_left in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if before, False otherwise
      Throws:
      Exception
    • is_right

      public boolean is_right(Base 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
    • Specified by:
      is_right in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if after, False otherwise
      Throws:
      Exception
    • is_over_or_right

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

      MEOS Functions:

      • overright_span_span
      • overright_span_spanset
      • overafter_period_timestamp
      • overafter_period_timestampset
      • overafter_period_temporal
      Specified by:
      is_over_or_right in interface Collection<T>
      Parameters:
      other - temporal object to compare with
      Returns:
      True if overlapping or after, False otherwise
      Throws:
      Exception
    • distance

      private void distance(Base other) throws Exception
      Returns the distance between "this" and "other".

      MEOS Functions:

      • distance_span_span
      • distance_spanset_span

      Parameters:
      other - object to compare with
      Throws:
      Exception
    • intersection

      private Base intersection(Base other) throws Exception
      Returns the intersection of "this" and "other".

      MEOS Functions:

    • intersection_span_span
    • intersection_spanset_span
    • intersection_period_timestamp
    • Parameters:
      other - object to intersect with
      Returns:
      A collection instance. The actual class depends on ``other``.
      Throws:
      Exception
    • mul

      public Base mul(Base other) throws Exception
      Throws:
      Exception
    • minus

      protected Base minus(Base other) throws Exception
      Throws:
      Exception
    • union

      protected Base union(Base other) throws Exception
      Returns the temporal union of "this" and "other".

      MEOS Functions:

    • union_period_timestamp
    • union_spanset_span
    • union_span_span
    • Parameters:
      other - temporal object to merge with
      Throws:
      Exception
    • add

      public Base add(Base other) throws Exception
      Throws:
      Exception
    • eq

      public boolean eq(Base other)
      Return whether "this" and "other" are equal.

      MEOS Functions:

    • span_eq
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if equal, False otherwise
    • notEquals

      public boolean notEquals(Base other)
      Return whether "this" and "other" are not equal.

      MEOS Functions:

    • span_neq
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if not equal, False otherwise
    • lessThan

      public boolean lessThan(Base other) throws Exception
      Return whether "this" is less than "other".

      MEOS Functions:

    • span_lt
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if less than, False otherwise
      Throws:
      Exception
    • lessThanOrEqual

      public boolean lessThanOrEqual(Base other) throws Exception
      Return whether "this" is less than or equal to "other".

      MEOS Functions:

    • span_le
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if less than or equal, False otherwise
      Throws:
      Exception
    • greaterThan

      public boolean greaterThan(Base other) throws Exception
      Return whether "this" is greater than "other".

      MEOS Functions:

    • span_gt
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if greater than, False otherwise
      Throws:
      Exception
    • greaterThanOrEqual

      public boolean greaterThanOrEqual(Base other) throws Exception
      Return whether "this" is greater than or equal to "other".

      MEOS Functions:

    • span_ge
    • Parameters:
      other - temporal object to compare with
      Returns:
      True if greater than or equal, False otherwise
      Throws:
      Exception