/// <summary> /// <see cref="Object.Equals(object)"/> /// </summary> public override bool Equals(object obj) { AtomicUnit U = obj as AtomicUnit; if (U == null) { return(false); } else { return(this.name.Equals(U.name)); } }
private void Add(LinkedList <KeyValuePair <AtomicUnit, int> > Factors, AtomicUnit AtomicUnit, int Exponent) { LinkedListNode <KeyValuePair <AtomicUnit, int> > Loop = Factors.First; string Name = AtomicUnit.Name; while (!(Loop is null) && Loop.Value.Key.Name != Name) { Loop = Loop.Next; } if (Loop is null) { Factors.AddLast(new KeyValuePair <AtomicUnit, int>(AtomicUnit, Exponent)); } else { Loop.Value = new KeyValuePair <AtomicUnit, int>(AtomicUnit, Loop.Value.Value + Exponent); } }