package Logica; import java.time.Month; import java.time.Year; import java.util.Vector; public class Gestion{ private Vector gestiones; private float suma; private static float total; private Month mes; private Year anio; //private boolean isPositivo; private String nombre; public Gestion() { this.gestiones=new Vector(); this.suma = 0; Gestion.total = 0; } public Gestion(String nombre) { this.gestiones = new Vector(); this.suma = 0; Gestion.total = 0; this.nombre = nombre; } public String getNombre() { return this.nombre; } public void aniadirGasto(Transaccion transaccion) { this.gestiones.add(transaccion); this.suma += transaccion.getDinero(); if(transaccion.isPositivo()) { Gestion.total += transaccion.getDinero(); }else { Gestion.total -= transaccion.getDinero(); } } public float getSuma() { return this.suma; } public static float getTotal() { return Gestion.total; } public Vector getElementos(){ return this.gestiones; } public void alterarVisibilidad(int elemento) { if(this.gestiones.get(elemento).alterarVisivilidad()) { this.suma += this.gestiones.get(elemento).getDinero(); if(this.gestiones.get(elemento).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()) { Gestion.total -= this.gestiones.get(elemento).getDinero(); }else { Gestion.total += this.gestiones.get(elemento).getDinero(); } } } }