private void ChangeSize(int newSize) { Collision[] tab = new Collision[newSize]; for (int i = 0; i < m_size && i < newSize; i++) { tab[i] = m_data[i]; } m_data = tab; }
public void Insert(Collision item) { if (m_size >= m_data.Length) { ChangeSize(m_size * 2); } m_size++; if (m_size > m_maxSize) m_maxSize = m_size; int i = m_size - 1; while (i > 0 && m_data[(i - 1) / 2].CompareTo(item) > 0) { m_data[i] = m_data[(i - 1) / 2]; i = (i - 1) / 2; } m_data[i] = item; }