//---------------------------------------------------------------------- //Add To Registry //---------------------------------------------------------------------- public static void AddToRegistry(PhysicsObject obj1, ForceIntegratorParams obj2, ForceIntegrator.Type type) { List<KeyValuePair<PhysicsObject, ForceIntegratorParams>> directory; if (registry.ContainsKey(type)) { if (registry.TryGetValue(type, out directory)) { directory.Add(new KeyValuePair<PhysicsObject, ForceIntegratorParams>(obj1, obj2)); return; } } directory = new List<KeyValuePair<PhysicsObject, ForceIntegratorParams>>(); directory.Add(new KeyValuePair<PhysicsObject, ForceIntegratorParams>(obj1, obj2)); registry.Add(type, directory); }
//---------------------------------------------------------------------- //Remove From Registry //---------------------------------------------------------------------- public static void RemoveFromRegistry(PhysicsObject obj1, ForceIntegratorParams obj2, ForceIntegrator.Type type) { List<KeyValuePair<PhysicsObject, ForceIntegratorParams>> directory; KeyValuePair<PhysicsObject, ForceIntegratorParams> pair = (new KeyValuePair<PhysicsObject, ForceIntegratorParams>(obj1, obj2)); if (registry.ContainsKey(type)) { if (registry.TryGetValue(type, out directory)) { if (directory.Contains(pair)) { directory.Remove(pair); } } } }