From 1783765ce04f5c11287a21a23956351f39fc95a7 Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Tue, 2 May 2006 19:56:20 +0000 Subject: [PATCH 1/1] Implemento Observable en Fraccion. --- src/Fraccion.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 (); } } -- 2.43.0