public override bool Equals(Object anObject) { if (EnCeros) { if (anObject is IMoneda) { return(((IMoneda)anObject).EnCeros); } } if (anObject is Monedero) { Monedero aMoneyBag = (Monedero)anObject; if (aMoneyBag.fMonies.Count != fMonies.Count) { return(false); } foreach (Moneda m in fMonies) { if (!aMoneyBag.Contains(m)) { return(false); } } return(true); } return(false); }
private void AppendBag(Monedero aBag) { foreach (Moneda m in aBag.fMonies) { AppendMoney(m); } }
public IMoneda Negar() { Monedero result = new Monedero(); foreach (Moneda m in fMonies) { result.AppendMoney((Moneda)m.Negar()); } return(result); }
public IMoneda Multiplicar(int factor) { Monedero result = new Monedero(); if (factor != 0) { foreach (Moneda m in fMonies) { result.AppendMoney((Moneda)m.Multiplicar(factor)); } } return(result); }
public IMoneda AgregarMonedero(Monedero s) { return(s.AgregarMoneda(this)); }
public IMoneda AgregarMonedero(Monedero s) { return((new Monedero(s, this)).Simplify()); }
public Monedero(Monedero m1, Monedero m2) { AppendBag(m1); AppendBag(m2); }
public Monedero(Moneda m, Monedero bag) { AppendMoney(m); AppendBag(bag); }