コード例 #1
0
 /// <summary>
 /// Attempts to add a topology to a list of existing topologies.
 /// </summary>
 /// <param name="topologies">
 /// The existing topologies.
 /// </param>
 /// <param name="newTopol">
 /// The topologies to add.
 /// </param>
 /// <returns>
 /// True if the topology wasnt already in the list.
 /// </returns>
 /// <remarks>
 /// Ensures that the stored topology has had its minimal form applied.
 /// </remarks>
 static bool CheckAdd(List<Topology>[] topologies, Topology newTopol)
 {
     int index = topologies[newTopol.Size].BinarySearch(newTopol);
     if (index >= 0) {
         topologies[newTopol.Size][index].duplicates++;
         return false;
     }
     index = ~index;
     topologies[newTopol.Size].Insert(index, newTopol);
     newTopol.ReMin();
     return true;
 }