removed 2 errors

This commit is contained in:
SND\floAr_cp 2011-11-22 20:20:04 +00:00
parent 282729b0c0
commit 9d3713879d

View File

@ -83,7 +83,21 @@ namespace ANX.Framework
} }
set set
{ {
keys[index] = value; if (value == null)
throw new ArgumentNullException();
if (index >= keys.Count)
throw new IndexOutOfRangeException();
//if fitting add here
if (keys[index].Position == value.Position)
keys[index] = value;
else
{
//if not let it be sorted
keys.RemoveAt(index);
keys.Add(value);
}
} }
} }
#endregion #endregion
@ -127,7 +141,7 @@ namespace ANX.Framework
if (comp == 0) if (comp == 0)
{ {
//Item is equal to half point //Item is equal to half point
this.keys.Insert(half, item); this.keys.Insert(half+1, item);
return; return;
} }
else if (comp < 0) max = half; //Item is smaller else if (comp < 0) max = half; //Item is smaller
@ -170,7 +184,8 @@ namespace ANX.Framework
#region RemoveAt #region RemoveAt
public void RemoveAt(int index) public void RemoveAt(int index)
{ {
keys.RemoveAt(index); keys.RemoveAt(index);
} }
#endregion #endregion
@ -184,10 +199,11 @@ namespace ANX.Framework
#region Clone #region Clone
public CurveKeyCollection Clone() public CurveKeyCollection Clone()
{ {
return new CurveKeyCollection CurveKeyCollection result = new CurveKeyCollection();
{ foreach (CurveKey key in this.keys)
keys = new List<CurveKey>(keys), result.Add(key);
}; return result;
} }
#endregion #endregion