Click or drag to resize
RangeCollection Class
A set of longs. Internally, represents this set as a sequence of ranges, for example, 1-10,333-1200,1300, so if the longs are clumpy then RangeCollection is very fast and uses very little memory.
Inheritance Hierarchy
SystemObject
  Bio.UtilRangeCollection

Namespace: Bio.Util
Assembly: Bio.Core (in Bio.Core.dll) Version: 2.0.0.1 (2.0.0.1)
Syntax
public class RangeCollection : ISet<long>, 
	ICollection<long>, IEnumerable<long>, IEnumerable, IXmlSerializable

The RangeCollection type exposes the following members.

Constructors
  NameDescription
Public methodRangeCollection
Create an new, empty, RangeCollection.
Public methodRangeCollection(IEnumerableInt32)
Create a new RangeCollection containing the longs from a sequence.
Public methodRangeCollection(IEnumerableInt64)
Create a new RangeCollection containing the longs from a sequence.
Public methodRangeCollection(Int64)
Create an new RangeCollection containing a single long.
Public methodRangeCollection(RangeCollection)
Create a RangeCollection by doing a deep copy of a RangeCollection
Public methodRangeCollection(Int64, Int64)
Create a new Range collection containing all the longs in a range (inclusive)
Top
Properties
  NameDescription
Public propertyFirstElement
The smallest long in the RangeCollection.
Public propertyIsEmpty
True if the RangeCollection contains no elements; otherwise, false.
Public propertyIsReadOnly
Returns whether this collection is considered read-only. The Range is not changeable through ICollection.
Public propertyLastElement
The largest long in the RangeCollection
Public propertyStatic memberMaxValue
The range starting at 0 (inclusive) and going to long.MaxValue (exclusive).
Public propertyRangeCount
Returns the number of contiguous ranges in this collection. Useful for memory consumption debugging.
Public propertyRanges
The ranges as a sequence, for example, 1-10 then 333-1200 then 1300
Top
Methods
  NameDescription
Public methodAdd
Add an long to the RangeCollection. The long may or may not already be in the RangeCollection.
Public methodAddNew
Add an long to the RangeCollection. An exception is thrown if the long is already in the RangeCollection.
Public methodAddRange(IEnumerableInt32)
Add a sequence of integers to the RangeCollection. Each may or may not already be in the RangeCollection.
Public methodAddRange(IEnumerableInt64)
Add a sequence of integers to the RangeCollection. Each may or may not already be in the RangeCollection.
Public methodAddRange(String)
Given a contiguous range represented as a string, for example, "1-5", add all the longs in that range to this RangeCollection.
Public methodAddRange(Int64, Int64)
Add all the longs starting at 'begin' to 'last' (inclusive) to the RangeCollection. They may or may not already be in the RangeCollection. The number of longs added must not be more than long.MaxValue.
Public methodAddRangeCollection
Add the longs of one RangeCollection to this RangeCollection.
Public methodAddRanges
Given a sequence of strings, each of which represents a contiguous range, add all the longs in all the ranges to this RangeCollection.
Public methodClear
Make the set empty
Public methodComplement
Returns the competeCollection - thisCollection
Public methodContains(Int64)
Returns true if item is within the ranges of this RangeCollection.
Public methodContains(RangeCollection)
Tells if this RangeCollection is a superset of another. An an equal RangeCollection is a superset.
Public methodContains(Int64, Int64)
Tells if all longs from start to last (inclusive) are members of this RangeCollection.
Public methodCopyTo
Copies the contents of the range into an array.
Public methodCount
The number of long elements in the RangeCollection
Public methodCount(Int64, Int64)
The number of long elements in the RangeCollection between min and max (inclusive)
Public methodElementAt
Returns what would be the nth element if each element were enumerated.
Public methodElementsAt
Returns a collection of elements at what would be the nth element for i \in rangeCollectionOfIndeces.
Public methodEquals(Object)
True if and only if two RangeCollections have exactly the same elements.
(Overrides ObjectEquals(Object).)
Public methodEquals(RangeCollection)
Tests equality between two range collections
Public methodExceptWith
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumeration of the long elements in this RangeCollection.
Public methodGetHashCode
Two RangeCollections with exactly the same elements will have the same hash code.
(Overrides ObjectGetHashCode.)
Public methodGetSchema
Required to override XmlSerialization. We use the default schema
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIntersectWith
Public methodIsBetween
Tells if every element of the RangeCollection is between low (inclusive) and high (inclusive)
Public methodIsComplete(Int64)
Tells if the range collection includes all longs from 0 (inclusive) to itemCount-1 (inclusive)
Public methodIsComplete(Int64, Int64)
Tells if the range collection includes all longs from firstItem to lastItem (inclusive)
Public methodIsContiguous
Tells if the range collection contains a continuous set of longs.
Public methodIsProperSubsetOf
Public methodIsProperSupersetOf
Public methodIsSubsetOf
Public methodIsSupersetOf
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOverlaps
Public methodStatic memberParse
Parses strings of the form -10--5,-2-10,12-12 . Spaces are allowed, no other characters are. If mergeOverlappingRanges, then, for example, 2-3,4-5 is represented as 2-5. Otherwise, they're maintained as separate ranges. The only difference is in the behavior of the ToString() call. By extension, this will change how a RangeCollection is parsed into a RangeCollectionCollection using the latter's GetInstance(RangeCollection) initializer.
Public methodReadXml
Overrides default XML serialization by using the ToString representation.
Public methodRemove
Remove an item from the collection. This is not supported with the RangeCollection.
Public methodSetEquals
Public methodSymmetricExceptWith
Public methodToString
Returns RangeCollection as a string in the form. For example, the range collection containing 1, 2, 10, 11, and 12 returns "1-2,10-12". If the set is empty, returns "Empty"
(Overrides ObjectToString.)
Public methodToString(String, String)
Returns RangeCollection as a string in the form. For example, the range collection containing 1, 2, 10, 11, and 12 returns "1-2,10-12". If the set is empty, returns "Empty"
Public methodTryAdd
Trys to add a new element to the set.
Public methodTryAddRangeCollection
Add the longs of one RangeCollection to this RangeCollection.
Public methodUnionWith
Public methodWriteXml
Overrides default XML serialization by using the ToString representation.
Top
Extension Methods
  NameDescription
Public Extension MethodAppendInt64(Int64)Overloaded.
Yield an Enumeration of the list with the item appended to the end
(Defined by IEnumerableExtensions.)
Public Extension MethodAppendInt64(IEnumerableInt64)Overloaded.
Yield a concatenation of the two Enumerable lists
(Defined by IEnumerableExtensions.)
Public Extension MethodElementAtInt64
Returns the element at a specified index in a sequence.
(Defined by IEnumerableExtensions.)
Public Extension MethodForEachInt64(ActionInt64)Overloaded.
Calls an action on each element of a sequence. The action takes one argument: an element. It has no return value.
(Defined by IEnumerableExtensions.)
Public Extension MethodForEachInt64(ActionInt64, Int32)Overloaded.
Calls an action on each element of a sequence. The action takes two arguments: an element and the index of the element. It has no return value.
(Defined by IEnumerableExtensions.)
Public Extension MethodShuffleInt64
Shuffles the elements of a sequence.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoinOverloaded.
Creates a string from a sequence of elements. No delimiter is used.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoin(String)Overloaded.
Creates a delimited string from a sequence of elements.
(Defined by IEnumerableExtensions.)
Public Extension MethodStringJoin(String, Int32, String)Overloaded.
Creates a delimited string from a sequence of elements. At most maxLength elements will be used and "..." shows that more elements were in the list.
(Defined by IEnumerableExtensions.)
Public Extension MethodSubSequenceInt64
Take the items from a sequence starting with item # start (index 0) and contining for count items.
(Defined by IEnumerableExtensions.)
Public Extension MethodToHashSetInt64Overloaded.
Creates a HashSet from a sequence. If the sequence is already a HashSet, a new HashSet is still created.
(Defined by IEnumerableExtensions.)
Public Extension MethodToHashSetInt64(IEqualityComparerInt64)Overloaded.
Creates a HashSet from a sequence. If the sequence is already a HashSet, a new HashSet is still created.
(Defined by IEnumerableExtensions.)
Public Extension MethodToQueueInt64
Creates a Queue from a sequence. If the sequence is already a Queue, a new Queue is still created.
(Defined by IEnumerableExtensions.)
Top
See Also