Class Bands
The class Bands is a collection class for the band class with mainly standard functionality.Overview
Bands |
New() |
New(BandsList: String) |
item(index: Integer): Band {default; read-only} |
add(ByRef NewBand: Band, Optional IgnoreDuplicates: Boolean = True) |
addRange(NewBands: Bands, Optional IgnoreDuplicates: Boolean = True) |
clone(): Object {Implements ICloneable.Clone} |
contains(ByRef BandToCheck: Band): Boolean |
count(): Integer |
GetEnumerator(): IEnumerator {Implements IEnumerable.GetEnumerator} |
inverted(): Bands |
sort() |
toString(): String |
toString(Sorted: Boolean): String |
toString(format: String): String |
toString(format: String, Sorted: Boolean): String |
Programming Language
- Microsoft Visual Basic .Net.
Availability
- Copyrighted but free software under the GNU Public License.
- Binaries and source code can be obtained from the Download section.
Constructors
Public Sub New()
Instantiates a new (empty) Bands object.Public Sub New(ByVal BandsList As String)
Instantiates a new class object and fills its internal collection with the bands passed in as a comma separated list. Here, a band will be added only once into the collection.Parameters
- BandList: a comma separated list of textual description of bands
Remarks
- Duplicates are ignored.
Example
- To instantiate a bands object with bands "9q34" and "22q11", do:
myBands= New Bands("9q34,22q11")
Interfaces
ICloneable
is implemented with the clone function.IEnumerable
is implemented with the GetEnumerator function.Properties
Default Public ReadOnly Property item(ByVal index As Integer) As Band
Gets the Band object at the specified index.Parameters
- index: The zero-based index of the element to get.
Property Value
- The Band object at the specified index.
Exceptions
- ArgumentOutOfRangeException: index is less than zero or index is equal to or greater than count.
Remarks
- This property provides the ability to access a specific Band object in the Bands object by using the following syntax: myBands(index).
Methods
Public Sub add(ByRef NewBand As Band, Optional ByVal IgnoreDuplicates As Boolean = True)
Adds the band passed to the function into the internal collection. By default, duplicates are ignored.Parameters
- NewBand: a reference to the Band object to be added.
- IgnoreDuplicates: indicates if a Band object needs not be added to the collection if an equal Band object is already contained (default: true).
Remarks
- If IgnoreDuplicates is true, the Bands object uses its contains function to determine if an equal band is already present in the collection; the contains function calls the strict comparison method of the band object (Band.equals(BandToCheck, True))
Exceptions
- ArgumentNullException: NewBand must not be a NULL reference
Public Sub addRange(ByRef NewBands As Bands, Optional ByVal IgnoreDuplicates As Boolean = True)
Adds each band contained in the NewBands object into the internal collection. By default, duplicates are ignored.Parameters
- NewBands: a reference to the Bands object whose Band objects are to be added.
- IgnoreDuplicates: indicates if a Band object needs not be added to the collection if an equal Band object is already conatined (default: true).
Remarks
- If IgnoreDuplicates is true, the Bands object uses its contains function to determine for each band to be added if an equal band is already present in the collection; the contains function calls the strict comparison method of the band object (Band.equals(BandToCheck, True))
Exceptions
- ArgumentNullException: NewBands must not be a NULL reference.
Public Function clone() As Object Implements ICloneable.Clone
Creates a deep copy of the Bands object; i.e. while cloning, each Band object contained in the collection is cloned.Return Value
- A deep copy of the Bands object.
Implements
Remarks
- A deep copy copies not only the elements of the internal collection, but it does also copy the objects that the references refer to. That is, all band objects in the internal collection will be cloned using Band.clone.
Public Function contains(ByRef BandToCheck As Band) As Boolean
Determines whether BandToCheck is in the internal collection of the Bands object.Parameters
- BandToCheck: a reference to the Band object to locate in the Bands object. It must not be a null reference.
Return Value
- true, if BandToCheck is found in the Bands object.
- false, otherwise.
Exceptions
- ArgumentNullException: BandToCheck must not be a NULL reference.
Remarks
- This method performs a linear search; therefore, the average execution time is proportional to count. That is, this method is an O(n) operation, where n is count.
- This method determines equality by calling Band.equals(CompareBand, True).
Public Function count() As Integer
Gets the number of Band objects actually contained in the Bands object.Public Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Returns an enumerator that can iterate through the collection of band objects of this Bands object.Implements
Public Function inverted() As Bands
Returns a Bands object which contains the Band objects in the opposite series than this Bands object.Return Value
- a Bands object which contains the Band objects in the opposite series than this Bands object.
Remarks
- The Band objects are not cloned. That is, manipulating a band object in the returned collection also causes changes to its counterpart in the original collection.
Public Sub sort()
Sorts the band objects in the internal collection of the Bands object.Remarks
- Sorting uses the compareTo method of the Band class.
- The internal collection of this object is changed by a call to sort().
Public Shadows Function toString() As String
Returns a comma separated list of the Band objects contained in the Bands object.Return Value
- a comma separated list of the textual descriptions of the Band objects contained in the Bands object.
Remarks
- The calculation is passed through to "toString("S")"
Public Shadows Function toString(ByVal Sorted As Boolean) As String
Returns a comma separated list of the Band objects contained in the Bands object. If Sorted is true, the collection is sorted first.Return Value
- a comma separated list of the textual descriptions of the Band objects contained in the Bands object, which may be sorted..
Parameter
- Sorted: denotes if the Band objects in the internal collection are to be sorted.
Remarks
- Sorting changes the underlying collection of the Bands class.
- Calling toString(True) is equal to calling sort() followed by calling toString().
Public Shadows Function toString(ByVal format As String) As String
Returns a comma separated list of the Band objects contained in the Bands object.Return Value
- a comma separated list of the textual descriptions of the Band objects contained in the Bands object.
Parameter
- format: a short description of the format.
- "S": standard (lenient) description. Makes use of the original description.
- "E": exact description. All items are recalculated with strict adherence to the ISCN manual.
- "EX": exact description without chromosome number. Corresponds to "E", but does not show the chromosome number; this option is used for aberration descriptions in the ISCN which require a separation of chromosomes from their bands.
The following values are defined:
Remarks
- If the format is unknown, "S" formatting will be used by default.
- Calls toString(format) on each Band object.
Public Shadows Function toString(ByVal format As String, ByVal Sorted As Boolean) As String
Returns a comma separated list of the Band objects contained in the Bands object. If Sorted is true, the collection is sorted first.Return Value
- a comma separated list of the textual descriptions of the Band objects contained in the Bands object, which may be sorted.
Parameter
- format: a short description of the format.
- "S": standard (lenient) description. Makes use of the original description.
- "E": exact description. All items are recalculated with strict adherence to the ISCN manual.
- "EX": exact description without chromosome number. Corresponds to "E", but does not show the chromosome number; this option is used for aberration descriptions in the ISCN which require a separation of chromosomes from their bands.
- Sorted: denotes if the Band objects in the internal collection are to be sorted.
The following values are defined:
Remarks
- If the format is unknown, "S" formatting will be used by default.
- Calls toString(format) on each Band object.
- Sorting changes the underlying collection of the Bands class.
- Calling toString(format, true) is equal to calling sort() followed by calling toString(format).