示例#1
0
		public static IBTreeRange Union(BTreeRangeUnion union, BTreeRangeSingle single)
		{
			if (single.IsEmpty())
			{
				return union;
			}
			SortedCollection4 sorted = NewBTreeRangeSingleCollection();
			sorted.Add(single);
			BTreeRangeSingle range = single;
			IEnumerator ranges = union.Ranges();
			while (ranges.MoveNext())
			{
				BTreeRangeSingle current = (BTreeRangeSingle)ranges.Current;
				if (CanBeMerged(current, range))
				{
					sorted.Remove(range);
					range = Merge(current, range);
					sorted.Add(range);
				}
				else
				{
					sorted.Add(current);
				}
			}
			return ToRange(sorted);
		}
示例#2
0
		public static IBTreeRange Intersect(BTreeRangeUnion union, BTreeRangeSingle single
			)
		{
			SortedCollection4 collection = NewBTreeRangeSingleCollection();
			CollectIntersections(collection, union, single);
			return ToRange(collection);
		}
示例#3
0
		public static IBTreeRange Union(BTreeRangeUnion union1, BTreeRangeUnion union2)
		{
			IEnumerator ranges = union1.Ranges();
			IBTreeRange merged = union2;
			while (ranges.MoveNext())
			{
				merged = merged.Union((IBTreeRange)ranges.Current);
			}
			return merged;
		}
示例#4
0
		public static IBTreeRange Intersect(BTreeRangeUnion union1, BTreeRangeUnion union2
			)
		{
			SortedCollection4 collection = NewBTreeRangeSingleCollection();
			IEnumerator ranges = union1.Ranges();
			while (ranges.MoveNext())
			{
				BTreeRangeSingle current = (BTreeRangeSingle)ranges.Current;
				CollectIntersections(collection, union2, current);
			}
			return ToRange(collection);
		}
示例#5
0
		private static void CollectIntersections(SortedCollection4 collection, BTreeRangeUnion
			 union, BTreeRangeSingle single)
		{
			IEnumerator ranges = union.Ranges();
			while (ranges.MoveNext())
			{
				BTreeRangeSingle current = (BTreeRangeSingle)ranges.Current;
				if (single.Overlaps(current))
				{
					collection.Add(single.Intersect(current));
				}
			}
		}
		public BTreeRangeUnionOperation(BTreeRangeUnion union)
		{
			_union = union;
		}
		protected override IBTreeRange Execute(BTreeRangeUnion union)
		{
			return BTreeAlgebra.Union(union, _single);
		}
示例#8
0
		protected abstract IBTreeRange Execute(BTreeRangeUnion union);
示例#9
0
		public void Visit(BTreeRangeUnion union)
		{
			_resultingRange = Execute(union);
		}
示例#10
0
		protected override IBTreeRange Execute(BTreeRangeUnion union)
		{
			return BTreeAlgebra.Intersect(_union, union);
		}
示例#11
0
		public BTreeRangeUnionIntersect(BTreeRangeUnion union) : base(union)
		{
		}
示例#12
0
		public BTreeRangeUnionUnion(BTreeRangeUnion union) : base(union)
		{
		}