An intersected table is a table that describes visits by a certain dimension for the visits
represented by a row in another table. This method fetches intersected tables either via
subtable or by using a segment. Read the class docs for more info.
557768
private function getIntersectedTable(DataTable $table, Row $row)
    {
        if ($this->isPivotDimensionSubtable()) {
            return $this->loadSubtable($table, $row);
        }

        if ($this->isFetchingBySegmentEnabled) {
            $segment = $row->getMetadata('segment');
            if (empty($segment)) {
                $segmentValue = $row->getMetadata('segmentValue');
                if ($segmentValue === false) {
                    $segmentValue = $row->getColumn('label');
                }

                $segmentName = $this->thisReportDimensionSegment->getSegment();
                if (empty($segmentName)) {
                    throw new \Exception("Invalid segment found when pivoting: " . $this->thisReportDimensionSegment->getName());
                }

                $segment = $segmentName . "==" . urlencode($segmentValue);
            }
            return $this->fetchIntersectedWithThisBySegment($table, $segment);
        }

        // should never occur, unless checkSupportedPivot() fails to catch an unsupported pivot
        throw new Exception("Unexpected error, cannot fetch intersected table.");
    }
1025622
def intersects(self, e):
    
    if self.chrom != e.chrom:
      return False

    if e.start >= self.start and e.start < self.end:
      return True
    if e.end > self.start and e.end <= self.end:
      return True
    if e.start < self.start and e.end > self.end:
      return True
    return False
493027
public static <T> boolean intersectsAll(T[] a1, T[] a2) {
        for (T anA1 : a1) {
            if (!contains(a2, anA1)) {
                return false;
            }
        }

        for (T anA2 : a2) {
            if (!contains(a1, anA2)) {
                return false;
            }
        }

        return true;
    }
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))
1324058
public boolean intersects(Iterable<Range<T>> ranges)
    {
        for (Range<T> range2 : ranges)
        {
            if (range2.intersects(this))
                return true;
        }
        return false;
    }
221741
def intersection(self,other):
        
        res = []
        for i1 in self.ints:
            for i2 in other.ints:
                res.append(i1.intersection(i2))

        return IntervalSet(res)
1003356
public static boolean intersectsRegion(final CellRangeAddressBase my, final CellRangeAddressBase other) {
        return my.getFirstRow() <= other.getLastRow() &&
                my.getFirstColumn() <= other.getLastColumn() &&
                other.getFirstRow() <= my.getLastRow() &&
                other.getFirstColumn() <= my.getLastColumn();
    }
1119796
private int indexRows(TableIndex tableIndex, FeatureResultSet resultSet) {

		int count = -1;

		try {
			while ((progress == null || progress.isActive())
					&& resultSet.moveToNext()) {
				if (count < 0) {
					count++;
				}
				try {
					FeatureRow row = resultSet.getRow();
					boolean indexed = index(tableIndex, row.getId(),
							row.getGeometry());
					if (indexed) {
						count++;
					}
					if (progress != null) {
						progress.addProgress(1);
					}
				} catch (Exception e) {
					log.log(Level.SEVERE, "Failed to index feature. Table: "
							+ tableIndex.getTableName() + ", Position: "
							+ resultSet.getPosition(), e);
				}
			}
		} finally {
			resultSet.close();
		}

		return count;
	}
1015709
def intersect_boxes(box1, box2):
    """"""
    if not box1 and not box2: return None
    if not box1: return box2
    if not box2: return box1
    intersect = RectangleObject([0, 0, 0, 0]) # Note [llx,lly,urx,ury] == [l,b,r,t]
    intersect.upperRight = (min(box1.upperRight[0], box2.upperRight[0]),
                            min(box1.upperRight[1], box2.upperRight[1]))
    intersect.lowerLeft = (max(box1.lowerLeft[0], box2.lowerLeft[0]),
                           max(box1.lowerLeft[1], box2.lowerLeft[1]))
    return intersect
83334
public CompactSketch intersect(final Sketch a, final Sketch b) {
    return intersect(a, b, true, null);
  }
566868
void analyzeTablePartitioning(Collection<StmtTableScan> collection)
            throws PlanningErrorException
    {
        m_countOfPartitionedTables = 0;
        // Do we have a need for a distributed scan at all?
        // Iterate over the tables to collect partition columns.
        for (StmtTableScan tableScan : collection) {
            if ( ! tableScan.getIsReplicated()) {
                ++m_countOfPartitionedTables;
            }
        }
        // Initial guess -- as if no equality filters.
        m_countOfIndependentlyPartitionedTables = m_countOfPartitionedTables;
    }
618830
def intersects(self, other):
		
		return any(key in self and self[key].intersects(value) for key, value in other.iteritems())
334782
public void intersect(Collection<? extends Range> ranges) {
		Ranges targetRanges;
		if (ranges instanceof Ranges) {
			targetRanges = (Ranges) ranges;
		} else {
			targetRanges = new Ranges(ranges);
		}

		List<Range> newList = new ArrayList<>();
		for (Iterator<? extends Range> iterator = this.ranges.iterator(); iterator.hasNext();) {
			Range r = iterator.next();
			List<Range> hasIntersections = getHasIntersections(targetRanges, r);
			if (hasIntersections.isEmpty()) {
				iterator.remove();
			} else {
				if (hasIntersections.size() == 1) {
					Range target = hasIntersections.get(0);
					if (r.equals(target)) {
						continue;
					}
				}
				iterator.remove();
				for (Range rangeHasIntersection : hasIntersections) {
					newList.add(rangeHasIntersection.intersection(r));
				}
			}
		}
		addAll(newList);
	}
292452
def check_name_collisions(self):
        
        table_index = 0
        table_names = {}
        for table in self.tables + self.with_tables:
            table_prefix = 'T{0}'.format(table_index)
            auto_alias = '{0}{1}'.format(self.table_prefix, table_prefix)

            identifier = table.get_identifier()
            if identifier is None or identifier in table_names:
                table.auto_alias = auto_alias
            table_names[identifier] = True

            # prefix inner query args and update self args
            if type(table) is QueryTable:
                table.query.prefix_args(auto_alias)
                table.query.table_prefix = auto_alias

            table_index += 1
81478
def rows(self, table, cols):
        '''
        
        '''
        if self.orng_tables:
            data = []
            for ex in self.orng_tables[table]:
                data.append([ex[str(col)] for col in cols])
            return data
        else:
            return self.fetch(table, cols)
466446
public QueryBuilder intersectAll() {
        this.firstQuery = query();
        this.firstQuerySetOperation = Operation.INTERSECT;
        this.firstQueryAll = true;
        clear(false);
        return this;
    }
236181
def join_offset(entry)
      name, offset = entry[0], entry[1]

      # determine which subtuple of the collection contains the table
      # referenced in entry.
      subtuple = 0
      all_rels_below[0..all_rels_below.length-1].each_with_index do |t,i|
        if t.qualified_tabname == name
          subtuple = i
          break
        end
      end

      return subtuple, offset
    end