From: Ricardo Markiewicz Date: Tue, 2 May 2006 19:56:20 +0000 (+0000) Subject: Implemento Observable en Fraccion. X-Git-Tag: darcs_import~6 X-Git-Url: https://git.llucax.com/z.facultad/75.62/c2tp1.git/commitdiff_plain/1783765ce04f5c11287a21a23956351f39fc95a7?hp=f9ae0eb22d1b5e8b12030d43c77c634c81743e73 Implemento Observable en Fraccion. --- diff --git a/src/Fraccion.java b/src/Fraccion.java index 8bd3ec4..33111f0 100644 --- a/src/Fraccion.java +++ b/src/Fraccion.java @@ -1,5 +1,6 @@ +import java.util.*; -public class Fraccion implements OperFrac, ComparaFrac { +public class Fraccion extends Observable implements OperFrac, ComparaFrac { private int num; private int den; @@ -14,10 +15,14 @@ public class Fraccion implements OperFrac, ComparaFrac { public void setNum(int n) { num = n; + setChanged (); + notifyObservers (); } public void setDen(int d) { den = d; + setChanged (); + notifyObservers (); } public Fraccion() { @@ -86,6 +91,8 @@ public class Fraccion implements OperFrac, ComparaFrac { int d = mcd(getNum(), getDen()); setNum(getNum() / d); setDen(getDen() / d); + setChanged (); + notifyObservers (); } }