public void DeleteElement(int element, int hash) { int bucket = hash % m_hashBuckets.Size(); int list = m_hashBuckets.Get(bucket); if (list == -1) { throw new System.ArgumentException(); } int ptr = m_lists.GetFirst(list); int prev = -1; while (ptr != -1) { int e = m_lists.GetElement(ptr); int nextptr = m_lists.GetNext(ptr); if (e == element) { m_lists.DeleteElement(list, prev, ptr); if (m_lists.GetFirst(list) == -1) { m_lists.DeleteList(list); // do not keep empty lists m_hashBuckets.Set(bucket, -1); } } else { prev = ptr; } ptr = nextptr; } }
internal void ApplyClusterPositions_() { com.epl.geometry.Point2D cluster_pt = new com.epl.geometry.Point2D(); // move vertices to the clustered positions. for (int list = m_clusters.GetFirstList(); list != -1; list = m_clusters.GetNextList(list)) { int node = m_clusters.GetFirst(list); System.Diagnostics.Debug.Assert((node != -1)); int vertex = m_clusters.GetElement(node); m_shape.GetXY(vertex, cluster_pt); for (node = m_clusters.GetNext(node); node != -1; node = m_clusters.GetNext(node)) { int vertex_1 = m_clusters.GetElement(node); m_shape.SetXY(vertex_1, cluster_pt); } } }