def __init__(self, start, end, includes_start=True, includes_end=False, point_type=None): if point_type is None: from hail.expr.expressions import impute_type, unify_types_limited start_type = impute_type(start) end_type = impute_type(end) point_type = unify_types_limited(start_type, end_type) if point_type is None: raise TypeError("'start' and 'end' have incompatible types: '{}', '{}'.".format(start_type, end_type)) self._point_type = point_type self._start = start self._end = end self._includes_start = includes_start self._includes_end = includes_end
def contains(self, value): """True if `value` is contained within the interval. Examples -------- .. doctest:: >>> interval.contains(5) True >>> interval.contains(6) False Parameters ---------- value : Object with type :meth:`.point_type`. Returns ------- :obj:`bool` """ from hail.expr.expressions import impute_type value_type = impute_type(value) if value_type != self.point_type: raise TypeError("'value' is incompatible with the interval point type: '{}', '{}'".format(value_type, self.point_type)) return self._jrep.contains(self.point_type._jtype.ordering(), self.point_type._convert_to_j(value))
def contains(self, value): """True if `value` is contained within the interval. Examples -------- >>> interval2.contains(5) True >>> interval2.contains(6) False Parameters ---------- value : Object with type :meth:`.point_type`. Returns ------- :obj:`bool` """ from hail.expr.expressions import impute_type value_type = impute_type(value) if value_type != self.point_type: raise TypeError("'value' is incompatible with the interval point type: '{}', '{}'".format(value_type, self.point_type)) return self._jrep.contains(self.point_type._jtype.ordering(), self.point_type._convert_to_j(value))
def __init__(self, start, end, includes_start=True, includes_end=False): from hail.expr.expressions import impute_type, unify_types_limited start_type = impute_type(start) end_type = impute_type(end) point_type = unify_types_limited(start_type, end_type) if point_type is None: raise TypeError("'start' and 'end' have incompatible types: '{}', '{}'.".format(start_type, end_type)) self._point_type = point_type self._start = start self._end = end self._includes_start = includes_start self._includes_end = includes_end self._jrep = scala_object(Env.hail().utils, 'Interval').apply( point_type._convert_to_j(start), point_type._convert_to_j(end), includes_start, includes_end)
def __init__(self, start, end, includes_start=True, includes_end=False, point_type=None): if point_type is None: from hail.expr.expressions import impute_type, unify_types_limited start_type = impute_type(start) end_type = impute_type(end) point_type = unify_types_limited(start_type, end_type) if point_type is None: raise TypeError( "'start' and 'end' have incompatible types: '{}', '{}'.". format(start_type, end_type)) self._point_type = point_type self._start = start self._end = end self._includes_start = includes_start self._includes_end = includes_end