SPPAS 4.22

https://sppas.org/

Module sppas.src.anndata

Class sppasDurationCompare

Description

Comparison methods for sppasDuration.

Constructor

Create a sppasDurationCompare instance.

View Source
def __init__(self):
    """Create a sppasDurationCompare instance."""
    super(sppasDurationCompare, self).__init__()
    self.methods['eq'] = sppasDurationCompare.eq
    self.methods['ne'] = sppasDurationCompare.ne
    self.methods['gt'] = sppasDurationCompare.gt
    self.methods['lt'] = sppasDurationCompare.lt
    self.methods['le'] = sppasDurationCompare.le
    self.methods['ge'] = sppasDurationCompare.ge

Public functions

eq

Return True if duration is equal to x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def eq(duration, x):
    """Return True if duration is equal to x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration == x

ne

Return True if duration is different to x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def ne(duration, x):
    """Return True if duration is different to x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration != x

gt

Return True if duration is greater than x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def gt(duration, x):
    """Return True if duration is greater than x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration > x

lt

Return True if duration is lower than x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def lt(duration, x):
    """Return True if duration is lower than x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration < x

ge

Return True if duration is greater or equal than x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def ge(duration, x):
    """Return True if duration is greater or equal than x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration >= x

le

Return True if duration is lower or equal than x.

Parameters
  • duration: (sppasDuration)
  • x: (int, float)
Returns
  • (bool)
View Source
@staticmethod
def le(duration, x):
    """Return True if duration is lower or equal than x.

        :param duration: (sppasDuration)
        :param x: (int, float)
        :returns: (bool)

        """
    if isinstance(duration, sppasDuration) is False:
        raise AnnDataTypeError(duration, 'sppasDuration')
    if (sppasType().is_number(x) or isinstance(x, sppasDuration)) is False:
        raise AnnDataTypeError(x, 'int/float/sppasDuration')
    return duration <= x