Reorgnizando la diferenciacion entre lo que suma y resta al total del
mes
This commit is contained in:
@@ -9,20 +9,15 @@ public class Gestion{
|
||||
private static float total;
|
||||
private Month mes;
|
||||
private Year anio;
|
||||
//private boolean isPositivo;
|
||||
private boolean isPositivo;
|
||||
private String nombre;
|
||||
|
||||
public Gestion() {
|
||||
this.gestiones=new Vector<Transaccion>();
|
||||
this.suma = 0;
|
||||
Gestion.total = 0;
|
||||
}
|
||||
|
||||
public Gestion(String nombre) {
|
||||
public Gestion(String nombre, boolean isPositivo) {
|
||||
this.gestiones = new Vector<Transaccion>();
|
||||
this.suma = 0;
|
||||
Gestion.total = 0;
|
||||
this.nombre = nombre;
|
||||
this.isPositivo = isPositivo;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
@@ -32,7 +27,7 @@ public class Gestion{
|
||||
public void aniadirGasto(Transaccion transaccion) {
|
||||
this.gestiones.add(transaccion);
|
||||
this.suma += transaccion.getDinero();
|
||||
if(transaccion.isPositivo()) {
|
||||
if(this.isPositivo) {
|
||||
Gestion.total += transaccion.getDinero();
|
||||
}else {
|
||||
Gestion.total -= transaccion.getDinero();
|
||||
@@ -54,14 +49,14 @@ public class Gestion{
|
||||
public void alterarVisibilidad(int elemento) {
|
||||
if(this.gestiones.get(elemento).alterarVisivilidad()) {
|
||||
this.suma += this.gestiones.get(elemento).getDinero();
|
||||
if(this.gestiones.get(elemento).isPositivo()) {
|
||||
if(this.isPositivo) {
|
||||
Gestion.total += this.gestiones.get(elemento).getDinero();
|
||||
}else {
|
||||
Gestion.total -= this.gestiones.get(elemento).getDinero();
|
||||
}
|
||||
}else {
|
||||
this.suma -= this.gestiones.get(elemento).getDinero();
|
||||
if(this.gestiones.get(elemento).isPositivo()) {
|
||||
if(this.isPositivo) {
|
||||
Gestion.total -= this.gestiones.get(elemento).getDinero();
|
||||
}else {
|
||||
Gestion.total += this.gestiones.get(elemento).getDinero();
|
||||
|
||||
Reference in New Issue
Block a user