Foley.Utilities.Collections
Class LinkedSet

A Doubly-Linked Set implementation extending the abstract Foley.Utilities.Collections.SetBase class.

Field Summary
Foley.Utilities.Collections.LinkedList list

Constructor Summary
LinkedSet()
         Initializes a new instance of the Foley.Utilities.Collections.LinkedSet class that is empty.
LinkedSet(System.Collections.ICollection collection)
         Initializes a new instance of the Foley.Utilities.Collections.LinkedSet class that contains elements copied from the specified collection.

Property Summary
int Count
         Gets the number of elements contained in the Foley.Utilities.Collections.LinkedSet.
bool IsEmpty
         Gets a boolean value indicating whether the Foley.Utilities.Collections.LinkedSet is empty or not.
object SyncRoot
         Gets an System.Object that can be used to synchronize access to the Foley.Utilities.Collections.LinkedSet.

Properties inherited from class Foley.Utilities.Collections.Collection2Base
IsFixedSize, IsReadOnly, IsSynchronized

Method Summary
bool Add(System.Collections.ICollection collection)
         Adds the elements of an System.Collections.ICollection to the end of the Foley.Utilities.Collections.LinkedSet.
bool Add(object value)
         Adds an System.Object to the end of the Foley.Utilities.Collections.LinkedSet.
void Clear()
         Removes all elements from the Foley.Utilities.Collections.LinkedSet.
object Clone()
         Creates a shallow copy of the Foley.Utilities.Collections.LinkedSet.
Foley.Utilities.Collections.LinkedSet Clone(bool attemptDeepCopy)
         Attempts to make a deep copy of the Foley.Utilities.Collections.LinkedSet.
bool Contains(System.Collections.ICollection collection)
         Determines whether all the elements in the specified collection are contained in the Foley.Utilities.Collections.LinkedSet.
bool Contains(object value)
         Determines whether an System.Object is in the Foley.Utilities.Collections.LinkedSet.
void CopyTo(System.Array array, int index)
         Copies the entire Foley.Utilities.Collections.LinkedSet to a compatible one-dimensional System.Array, starting at the specified index of the target array.
System.Collections.IEnumerator GetEnumerator()
         Returns an enumerator for the entire Foley.Utilities.Collections.LinkedSet.
bool Remove(System.Collections.ICollection collection)
         Removes the occurrence of each element of the specified System.Collections.ICollection from the Foley.Utilities.Collections.LinkedSet.
bool Remove(object value)
         Removes the occurrence of the specific System.Object from the Foley.Utilities.Collections.LinkedSet.
bool Retain(System.Collections.ICollection collection)
         Retains the occurrence of each element of the specified System.Collections.ICollection from the Foley.Utilities.Collections.LinkedSet.

Methods inherited from class Foley.Utilities.Collections.Collection2Base
IsContainedIn

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

list

private Foley.Utilities.Collections.LinkedList list

Constructor Detail

LinkedSet

public LinkedSet()

Initializes a new instance of the Foley.Utilities.Collections.LinkedSet class that is empty.


LinkedSet

public LinkedSet(System.Collections.ICollection collection)

Initializes a new instance of the Foley.Utilities.Collections.LinkedSet class that contains elements copied from the specified collection.

Parameters:
collection - The System.Collections.ICollection whose elements are copied to the new list.
Property Detail

Count

public int Count

Gets the number of elements contained in the Foley.Utilities.Collections.LinkedSet.

Value:
The number of elements actually contained in the Foley.Utilities.Collections.LinkedSet.

IsEmpty

public bool IsEmpty

Gets a boolean value indicating whether the Foley.Utilities.Collections.LinkedSet is empty or not.

Value:
true if the Foley.Utilities.Collections.LinkedSet contains no elements; otherwise, false.

SyncRoot

public object SyncRoot

Gets an System.Object that can be used to synchronize access to the Foley.Utilities.Collections.LinkedSet.

Value:
An System.Object that can be used to synchronize access to the Foley.Utilities.Collections.LinkedSet.
Method Detail

Add

public bool Add(System.Collections.ICollection collection)

Adds the elements of an System.Collections.ICollection to the end of the Foley.Utilities.Collections.LinkedSet.

Parameters:
collection - The System.Collections.ICollection whose elements should be added to the end of the Foley.Utilities.Collections.LinkedSet.
Returns:
true if the Foley.Utilities.Collections.LinkedSet is modified; otherwise false.
Throws:
System.ArgumentNullException - The collection is a null reference (Nothing in Visual Basic).

Add

public bool Add(object value)

Adds an System.Object to the end of the Foley.Utilities.Collections.LinkedSet.

Parameters:
value - The System.Object to be added to the end of the Foley.Utilities.Collections.LinkedSet
Returns:
true if the Foley.Utilities.Collections.LinkedSet is modified; otherwise false.

Clear

public void Clear()

Removes all elements from the Foley.Utilities.Collections.LinkedSet.


Clone

public object Clone()

Creates a shallow copy of the Foley.Utilities.Collections.LinkedSet.

If you need a deep copy to be attempted use the Foley.Utilities.Collections.LinkedSet.Clone(System.Boolean) method.

Returns:
A shallow copy of the Foley.Utilities.Collections.LinkedSet.

Clone

public Foley.Utilities.Collections.LinkedSet Clone(bool attemptDeepCopy)

Attempts to make a deep copy of the Foley.Utilities.Collections.LinkedSet.

Attempts to make a deep copy if attemptDeepCopy is true. It will attempt this by checking if an System.Object is an System.ICloneable, and then defer the process to its Clone method. At the first System.Object that is not an System.ICloneable a SystemException will be thrown.

If a true deep copy is important, please check the API documentation for the elements that are contained in the list to verify how their Clone method is implemented.

Parameters:
attemptDeepCopy - If true will attempt to make a deep copy, if false it will just return a shallow copy
Returns:
The newly cloned Foley.Utilities.Collections.LinkedSet.
Throws:
System.SystemException - If and System.Object in the list is not an System.ICloneable.
System.SystemException - At the first System.Object that is not an System.ICloneable when attemptDeepCopy is true.

Contains

public bool Contains(System.Collections.ICollection collection)

Determines whether all the elements in the specified collection are contained in the Foley.Utilities.Collections.LinkedSet.

Parameters:
collection - The System.Collections.ICollection whose elements are to be added to the end of the Foley.Utilities.Collections.LinkedSet.
Returns:
true if all the elements of the System.Collections.ICollection are found in the Foley.Utilities.Collections.LinkedSet; otherwise, false.
Throws:
System.ArgumentNullException - The collection is a null reference (Nothing in Visual Basic).

Contains

public bool Contains(object value)

Determines whether an System.Object is in the Foley.Utilities.Collections.LinkedSet.

This method determines equality by calling System.Object.Equals(System.Object).

Parameters:
value - The System.Object to locate in the Foley.Utilities.Collections.LinkedSet. The System.Object to locate can be a null reference (Nothing in Visual Basic).
Returns:
true if value is found in the Foley.Utilities.Collections.LinkedSet; otherwise, false.

CopyTo

public void CopyTo(System.Array array,
                   int index)

Copies the entire Foley.Utilities.Collections.LinkedSet to a compatible one-dimensional System.Array, starting at the specified index of the target array.

Parameters:
array - The one-dimensional System.Array that is the destination of the elements copied from the Foley.Utilities.Collections.LinkedSet. The System.Array must have zero-based indexing.
index - The zero-based index in array at which copying begins.
Throws:
System.ArgumentNullException - The array is a null reference (Nothing in Visual Basic).
System.ArgumentOutOfRangeException - The index is less than zero.
System.ArgumentException - The array is multidimensional. -or- The index is equal to or greater than the length of array. -or- The number of elements in the Foley.Utilities.Collections.LinkedSet is greater than the available space from index to the end of the destination array.

GetEnumerator

public System.Collections.IEnumerator GetEnumerator()

Returns an enumerator for the entire Foley.Utilities.Collections.LinkedSet.

Returns:
An System.Collections.IEnumerator for the entire Foley.Utilities.Collections.LinkedSet.

Remove

public bool Remove(System.Collections.ICollection collection)

Removes the occurrence of each element of the specified System.Collections.ICollection from the Foley.Utilities.Collections.LinkedSet.

Parameters:
collection - The System.Collections.ICollection used to determine what elements to remove from the Foley.Utilities.Collections.LinkedSet.
Returns:
true if the Foley.Utilities.Collections.LinkedSet is modified; otherwise false.
Throws:
System.NotSupportedException -

The Foley.Utilities.Collections.LinkedSet is read-only.

-or-

The Foley.Utilities.Collections.LinkedSet has a fixed size.

System.ArgumentNullException - The collection is a null reference (Nothing in Visual Basic).

Remove

public bool Remove(object value)

Removes the occurrence of the specific System.Object from the Foley.Utilities.Collections.LinkedSet.

Parameters:
value - The System.Object to remove from the Foley.Utilities.Collections.LinkedSet.
Returns:
true if the Foley.Utilities.Collections.LinkedSet is modified; otherwise false.

Retain

public bool Retain(System.Collections.ICollection collection)

Retains the occurrence of each element of the specified System.Collections.ICollection from the Foley.Utilities.Collections.LinkedSet.

Parameters:
collection - The System.Collections.ICollection used to determine what elements to be retained in the Foley.Utilities.Collections.LinkedSet.
Returns:
true if the Foley.Utilities.Collections.LinkedSet is modified; otherwise false.
Throws:
System.NotSupportedException -

The Foley.Utilities.Collections.LinkedSet is read-only.

-or-

The Foley.Utilities.Collections.LinkedSet has a fixed size.

System.ArgumentNullException - The collection is a null reference (Nothing in Visual Basic).