public override bool Equals(object otherSet)
{
bool rtnVal = false;
if ((otherSet is RLEBitset))
{
RLEBitset otherRLESet = (RLEBitset)otherSet; // cast to an RLEBitset - errors if cannot cast
if (this.length == otherRLESet.length &&
this.runArray.Count == otherRLESet.runArray.Count)
{
if (this.runArray.Count == 0)
{
rtnVal = true;
}
for (int i = 0; i < this.runArray.Count; i++)
{
if (this.runArray[i].StartIndex == otherRLESet.runArray[i].StartIndex &&
this.runArray[i].EndIndex == otherRLESet.runArray[i].EndIndex)
{
rtnVal = true;
}
else
{
rtnVal = false;
break;
}
}
}
}
return rtnVal;
}