/// <summary> /// Default constructor /// </summary> /// <param name="r">records</param> /// <param name="start">start</param> public Gathering(RecordZone <T> r, T start) { this.records = r; this.opened = new List <T>(r.Records); this.closed = new List <T>(); this.Gather(start); }
/// <summary> /// Activate record zone /// </summary> /// <param name="sender">origin</param> /// <param name="e">args</param> private void Owner_Fetch(object sender, EventArgs e) { RecordZone <Weight> recordZone = sender as RecordZone <Weight>; int h = this[hashCodeName]; foreach (Weight w in recordZone.Records) { if (w == this) { h = w.GetHashCode(); break; } } if (!recordZone.Exists(h)) { recordZone.Add(h, this); } else { Weight recorded = recordZone.Ask(h); if (recorded != this) { throw new InvalidCastException(String.Format("Weight {0} is not equals to Weight {1}", recorded.ToString(), this.ToString())); } else { this.ownerObject = recorded.ownerObject; this[hashCodeName] = h; } } }