TreeNode 1.5.2
A library to manipulate phylogenetic trees
|
Represents a collection of TreeNode objects. If the full representations of the TreeNode objects reside in memory, this offers the best performance at the expense of memory usage. Alternatively, the trees may be read on demand from a stream in binary format. In this case, accessing any of the trees will require the tree to be parsed. This reduces memory usage, but worsens performance. The internal storage model of the collection is transparent to consumers (except for the difference in performance/memory usage). More...
Public Member Functions | |
void | Add (TreeNode item) |
Adds an element to the collection. This is stored in memory, even if the internal storage model of the collection is a Stream. More... | |
void | AddRange (IEnumerable< TreeNode > items) |
Adds multiple elements to the collection. These are stored in memory, even if the internal storage model of the collection is a Stream. More... | |
IEnumerator< TreeNode > | GetEnumerator () |
Get an IEnumerator over the collection. More... | |
int | IndexOf (TreeNode item) |
Finds the index of the first occurrence of an element in the collection. More... | |
void | Insert (int index, TreeNode item) |
Inserts an element in the collection at the specified index. More... | |
void | RemoveAt (int index) |
Removes from the collection the element at the specified index. More... | |
void | Clear () |
Removes all elements from the collection. If the internal storage model is a Stream, it is disposed and the internal storage model is converted to a List<TreeNode>. More... | |
bool | Contains (TreeNode item) |
Determines whether the collection contains the specified element. More... | |
void | CopyTo (TreeNode[] array, int arrayIndex) |
Copies the collection to an array. More... | |
bool | Remove (TreeNode item) |
Removes the specified element from the collection. More... | |
TreeCollection (List< TreeNode > internalStorage) | |
Constructs a TreeCollection object from a List<TreeNode>. More... | |
TreeCollection (Stream binaryTreeStream) | |
Constructs a TreeCollection object from a stream of trees in binary format. More... | |
void | Dispose () |
Disposes the TreeCollection, the underlying Stream and StreamReader, and deletes the TemporaryFile (if applicable). More... | |
Properties | |
Stream | UnderlyingStream = null [get] |
A stream containing the tree data in binary format, if this is the chosen storage model. This can be either a MemoryStream or a FileStream. More... | |
string | TemporaryFile = null [get, set] |
If the trees are stored on disk in a temporary file, you should assign this property to the full path of the file. The file will be deleted when the TreeCollection is Dispose()d. More... | |
int | Count [get] |
The number of trees in the collection. More... | |
bool | IsReadOnly [get] |
Determine whether the collection is read-only. This is always false in the current implementation. More... | |
TreeNode | this[int index] [get, set] |
Obtains an element from the collection. More... | |
Represents a collection of TreeNode objects. If the full representations of the TreeNode objects reside in memory, this offers the best performance at the expense of memory usage. Alternatively, the trees may be read on demand from a stream in binary format. In this case, accessing any of the trees will require the tree to be parsed. This reduces memory usage, but worsens performance. The internal storage model of the collection is transparent to consumers (except for the difference in performance/memory usage).
Definition at line 16 of file TreeCollection.cs.
PhyloTree.TreeCollection.TreeCollection | ( | List< TreeNode > | internalStorage | ) |
Constructs a TreeCollection object from a List<TreeNode>.
internalStorage | The List<TreeNode> containing the trees to store in the collection. Note that this list is not copied, but used as-is. |
Definition at line 429 of file TreeCollection.cs.
PhyloTree.TreeCollection.TreeCollection | ( | Stream | binaryTreeStream | ) |
Constructs a TreeCollection object from a stream of trees in binary format.
binaryTreeStream | The stream of trees in binary format to use. The stream will be disposed when the TreeCollection is disposed. It should not be disposed earlier by external code. |
Definition at line 439 of file TreeCollection.cs.
void PhyloTree.TreeCollection.Add | ( | TreeNode | item | ) |
Adds an element to the collection. This is stored in memory, even if the internal storage model of the collection is a Stream.
item | The element to add. |
Definition at line 161 of file TreeCollection.cs.
void PhyloTree.TreeCollection.AddRange | ( | IEnumerable< TreeNode > | items | ) |
Adds multiple elements to the collection. These are stored in memory, even if the internal storage model of the collection is a Stream.
items | The elements to add. |
Definition at line 174 of file TreeCollection.cs.
void PhyloTree.TreeCollection.Clear | ( | ) |
Removes all elements from the collection. If the internal storage model is a Stream, it is disposed and the internal storage model is converted to a List<TreeNode>.
Definition at line 329 of file TreeCollection.cs.
bool PhyloTree.TreeCollection.Contains | ( | TreeNode | item | ) |
Determines whether the collection contains the specified element.
item | The element to search for. |
true
if the collection contains the specified element, false
otherwise.Definition at line 356 of file TreeCollection.cs.
void PhyloTree.TreeCollection.CopyTo | ( | TreeNode[] | array, |
int | arrayIndex | ||
) |
Copies the collection to an array.
array | The array in which to copy the collection. |
arrayIndex | The index at which to start the copy. |
Definition at line 383 of file TreeCollection.cs.
void PhyloTree.TreeCollection.Dispose | ( | ) |
Disposes the TreeCollection, the underlying Stream and StreamReader, and deletes the TemporaryFile (if applicable).
Definition at line 513 of file TreeCollection.cs.
IEnumerator< TreeNode > PhyloTree.TreeCollection.GetEnumerator | ( | ) |
Get an IEnumerator over the collection.
Definition at line 191 of file TreeCollection.cs.
int PhyloTree.TreeCollection.IndexOf | ( | TreeNode | item | ) |
Finds the index of the first occurrence of an element in the collection.
item | The item to search for. |
Definition at line 244 of file TreeCollection.cs.
void PhyloTree.TreeCollection.Insert | ( | int | index, |
TreeNode | item | ||
) |
Inserts an element in the collection at the specified index.
index | The index at which to insert the element. |
item | The element to insert. |
Definition at line 271 of file TreeCollection.cs.
bool PhyloTree.TreeCollection.Remove | ( | TreeNode | item | ) |
Removes the specified element from the collection.
item | The element to remove. |
true
if the removal was successful (i.e. the list contained the element in the first place), false
otherwise.Definition at line 404 of file TreeCollection.cs.
void PhyloTree.TreeCollection.RemoveAt | ( | int | index | ) |
Removes from the collection the element at the specified index.
index |
Definition at line 298 of file TreeCollection.cs.
|
get |
The number of trees in the collection.
Definition at line 87 of file TreeCollection.cs.
|
get |
Determine whether the collection is read-only. This is always false
in the current implementation.
Definition at line 105 of file TreeCollection.cs.
|
getset |
If the trees are stored on disk in a temporary file, you should assign this property to the full path of the file. The file will be deleted when the TreeCollection is Dispose()d.
Definition at line 82 of file TreeCollection.cs.
|
getset |
Obtains an element from the collection.
index | The index of the element to extract. |
Definition at line 112 of file TreeCollection.cs.
|
get |
A stream containing the tree data in binary format, if this is the chosen storage model. This can be either a MemoryStream or a FileStream.
Definition at line 26 of file TreeCollection.cs.