Tanis.Collections.Heap.Add C# (CSharp) Method

Add() public method

IList implementation. Adds the object at the right place.
The Heap is set to use object's IComparable interface, and the specifed object does not implement this interface.
public Add ( object O ) : int
O object The object to add.
return int
		public int Add(object O)
		{
			int Return = -1;
			if (ObjectIsCompliant(O))
			{
				int Index = IndexOf(O);
				int NewIndex = Index>=0 ? Index : -Index-1;
				if (NewIndex>=Count) FList.Add(O);
				else FList.Insert(NewIndex, O);
				Return = NewIndex;
			}
			return Return;
		}