Returns a new :class:`~pyinter.Interval` representing the intersection of this :class:`~pyinter.Interval`
        with the other :class:`~pyinter.Interval`
9546
def intersect(self, other):
        """"""
        if self.overlaps(other):
            newlower_value = max(self.lower_value, other.lower_value)
            new_upper_value = min(self._upper_value, other._upper_value)
            new_lower, new_upper = self._get_new_lower_upper(other, self.intersect)
            return Interval(new_lower, newlower_value, new_upper_value, new_upper)
        else:
            return None
194706
def boxes_intersect(box1, box2):
    """"""
    xmin1, xmax1, ymin1, ymax1 = box1
    xmin2, xmax2, ymin2, ymax2 = box2
    if interval_intersection_width(xmin1, xmax1, xmin2, xmax2) and \
            interval_intersection_width(ymin1, ymax1, ymin2, ymax2):
        return True
    else:
        return False
147702
def intersection(self, other):
        
        relative_position = self.relative_position_of(other)
        if relative_position in [
            self.RELATIVE_POSITION_PP_C,
            self.RELATIVE_POSITION_PI_LC,
            self.RELATIVE_POSITION_PI_LG,
            self.RELATIVE_POSITION_PI_CG,
            self.RELATIVE_POSITION_IP_B,
            self.RELATIVE_POSITION_II_LB,
        ]:
            return TimeInterval(begin=self.begin, end=self.begin)
        if relative_position in [
            self.RELATIVE_POSITION_IP_E,
            self.RELATIVE_POSITION_II_EG,
        ]:
            return TimeInterval(begin=self.end, end=self.end)
        if relative_position in [
            self.RELATIVE_POSITION_II_BI,
            self.RELATIVE_POSITION_II_BE,
            self.RELATIVE_POSITION_II_II,
            self.RELATIVE_POSITION_II_IE,
        ]:
            return TimeInterval(begin=other.begin, end=other.end)
        if relative_position in [
            self.RELATIVE_POSITION_IP_I,
            self.RELATIVE_POSITION_II_LI,
            self.RELATIVE_POSITION_II_LE,
            self.RELATIVE_POSITION_II_LG,
            self.RELATIVE_POSITION_II_BG,
            self.RELATIVE_POSITION_II_IG,
        ]:
            begin = max(self.begin, other.begin)
            end = min(self.end, other.end)
            return TimeInterval(begin=begin, end=end)
        return None
315340
def intersection(self,other):
        
        if self.everything:
            if other.everything:
                return DiscreteSet()
            else:
                return DiscreteSet(other.elements)
        else:
            if other.everything:
                return DiscreteSet(self.elements)
            else:
                return DiscreteSet(self.elements.intersection(other.elements))
839405
def intersection(self, *args):
        
        if type(self.obj[0]) is int:
            a = self.obj
        else:
            a = tuple(self.obj[0])
        setobj = set(a)
        for i, v in enumerate(args):
            setobj = setobj & set(args[i])
        return self._wrap(list(setobj))
516001
public function intersection(Interval $other)
	{
		if ($this->isContaining($other)) {
			return $other;

		} elseif ($other->isContaining($this)) {
			return $this;

		} elseif ($this->isOverlappedFromRightBy($other)) {
			// This:  □□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□□□□□□□
			// Other: □□□□□□□□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□
			//    $other->from   |   | <- $this-till

			return new static($other->getLeft(), $this->getRight());

		} elseif ($other->isOverlappedFromRightBy($this)) {
			// This:  □□□□□□□□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□□□□
			// Other: □□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□□□□□□□□□□
			//    $this->from -> |   | <- $other-till

			return new static($this->getLeft(), $other->getRight());
		}

		$dummy = $this->left->asOpened();

		return new static($dummy, $dummy);
	}
807904
def intersection(*argv):
        
        res = OrderedSet(argv[0])
        for ods in argv:
            res = ods & res
        return res
482950
def interval(best,lo=np.nan,hi=np.nan):
    
    return [float(best),[float(lo),float(hi)]]
1323809
def first_interval_ending(self, end: datetime.datetime) \
            -> Optional[Interval]:
        
        for i in self.intervals:
            if i.end == end:
                return i
        return None
426239
public boolean intersects(Interval1D<V> other) {
    if (other.hi.compareTo(this.lo) < 0) {
      return false;
    }
    if (this.hi.compareTo(other.lo) < 0) {
      return false;
    }

    return true;
  }
47329
def widen(self, other):
        
        if self.low < other.low:
            low = -float("inf")
        else:
            low = self.low
        if self.high > other.high:
            high = float("inf")
        else:
            high = self.high
        return Interval(low, high)
187286
def min_interval(self,name, alpha=_alpha, **kwargs):
        
        data = self.get(name, **kwargs)
        return min_interval(data,alpha)
989921
def _bigger(interval1, interval2):
        
        if interval2.cardinality > interval1.cardinality:
            return interval2.copy()
        return interval1.copy()
420503
def intersection_update(self, other):
        
        if not isinstance(other, Set):
            raise ValueError('other must be a Set instance')
        if self is other:
            return
        # we make a copy of the list so that we can remove items from
        # the list without breaking the iterator.
        for item in list(self.items):
            if item not in other.items:
                self.items.remove(item)
496115
public boolean overlaps(Interval<E> other)
  {
    if (other == null) return false;
    int comp12 = this.first.compareTo(other.second());
    int comp21 = this.second.compareTo(other.first());
    if (comp12 > 0 || comp21 < 0) {
      return false;
    } else {
      if (comp12 == 0) {
        if (!this.includesBegin() || !other.includesEnd()) {
          return false;
        }
      }
      if (comp21 == 0) {
        if (!this.includesEnd() || !other.includesBegin()) {
          return false;
        }
      }
      return true;
    }
  }
391096
def intersection(self, *iterables):
        
        comb = self._set.intersection(*iterables)
        return self._fromset(comb, key=self._key)
552986
def _intersection_with_si(self, si):
        

        new_si_set = set()
        for si_ in self._si_set:
            r = si_.intersection(si)
            new_si_set.add(r)

        if len(new_si_set):
            ret = DiscreteStridedIntervalSet(bits=self.bits, si_set=new_si_set)

            if ret.should_collapse(): return ret.collapse()
            else: return ret

        else:
            # There is no intersection between two operands
            return StridedInterval.empty(self.bits)