DualArray<T1, T2>

public class DualArray<T1, T2>
Maintains and synchronizes two arrays. Note: this is probably useless now that Tuples are part of the lang.spec.
T1
T2

Constructors

DualArray

#
public DualArray()
Create a new, empty multi-array.

DualArray

#
public DualArray(IEnumerable<T1> aItems, IEnumerable<T2> bItems)
Create a new multi-array from collections.
aItems (IEnumerable<T1>)Collection of T1 items.
bItems (IEnumerable<T2>)Collection of T2 items.

DualArray

#
public DualArray(int capacity)
Create a new multi-array with a specified capacity.
capacity (int)

DualArray

#
public DualArray(T1 a, T2 b)
Create a new, singular pair dual array.
a (T1)
b (T2)

Properties

A

#
public Accessor<T1> A { get; }
Get access to the internal T1 array.

AItems

#
public IEnumerable<T1> AItems { get; }
Enumerate over all T1 items.

B

#
public Accessor<T2> B { get; }
Get access to the internal T2 array.

BItems

#
public IEnumerable<T2> BItems { get; }
Enumerate over all T2 items.

Capacity

#
public int Capacity { get; }
Gets the capacity for each array.

Count

#
public int Count { get; }
Gets the number of items stored in each array.

Methods

Add

#
public void Add(T1 a, T2 b)
Add a pair to this multi array.
a (T1)A value.
b (T2)B value.

Clear

#
public void Clear()
Clear the array.

ContainsA

#
public bool ContainsA(T1 item)
Gets whether a value equal to item is already part of the T1 array.
item (T1)Item to check.
True if item is part of T1 array.

ContainsB

#
public bool ContainsB(T2 item)
Gets whether a value equal to item is already part of the T2 array.
item (T2)Item to check.
True if item is part of T2 array.

EnsureCapacity

#
public void EnsureCapacity(int capacity)
Ensure the capacity of this multi-array is at least the given amount.
capacity (int)Required capacity.

FindA

#
public int FindA(T1 item, int startIndex)
Find the first occurence of a T1 item.
item (T1)Item to find.
startIndex (int)First index to take into account.
First index of matching item or -1.

FindA

#
public int FindA(T1 item)
Find the first occurence of a T1 item.
item (T1)Item to find.
First index of matching item or -1.

FindB

#
public int FindB(T2 item, int startIndex)
Find the first occurence of a T2 item.
item (T2)Item to find.
startIndex (int)First index to take into account.
First index of matching item or -1.

FindB

#
public int FindB(T2 item)
Find the first occurence of a T2 item.
item (T2)Item to find.
First index of matching item or -1.

Insert

#
public void Insert(int index, T1 a, T2 b)
Insert a pair into this multi array.
index (int)
a (T1)
b (T2)

Remove

#
public void Remove(int index)
Remove the values at the given index.
index (int)Index to remove.

Replace

#
public void Replace(int index, T1 newA, T2 newB)
Replace the values at the given index.
index (int)Index of pair to replace.
newA (T1)New A value.
newB (T2)New B value.

ToAArray

#
public T1[] ToAArray()
Copy the internal T1 array into a new array.
T1 items.

ToBArray

#
public T2[] ToBArray()
Copy the internal T2 array into a new array.
T2 items.

TrimExcess

#
public void TrimExcess()
Release unused memory.