Aniadida barra y funcionalidades extra
This commit is contained in:
@@ -10,9 +10,10 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.time.Month;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
public class Meses {
|
||||
private ArrayList<Mes> meses;
|
||||
private ArrayList<Mes> meses;
|
||||
private int mesActual=0;
|
||||
public Meses() {
|
||||
this.meses = new ArrayList<Mes>();
|
||||
@@ -109,16 +110,33 @@ private ArrayList<Mes> meses;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<String> salidaTodo(){
|
||||
Vector<String> ret = new Vector<String>();
|
||||
for(Mes mes:this.meses) {
|
||||
ret.add(mes.toString());
|
||||
for(Gestion gestion:mes.getGestiones()) {
|
||||
ret.add(" "+gestion.toString());
|
||||
for(Transaccion transaccion:gestion.getElementos()) {
|
||||
ret.add(" "+transaccion.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Mes implements Serializable{
|
||||
private int anio;
|
||||
private Month mes;
|
||||
float total;
|
||||
int nGestiones;
|
||||
ArrayList<Gestion> gestiones;
|
||||
Mes(ArrayList<Gestion> gestiones, int anio, Month mes){
|
||||
this.gestiones = gestiones;
|
||||
this.anio=anio;
|
||||
this.mes=mes;
|
||||
this.anio = anio;
|
||||
this.mes = mes;
|
||||
this.nGestiones = this.gestiones.size();
|
||||
}
|
||||
|
||||
void aniadirTransaccion(Transaccion transaccion, String nombre, boolean isPositivo) {
|
||||
@@ -129,6 +147,7 @@ class Mes implements Serializable{
|
||||
}
|
||||
}
|
||||
gestiones.add(new Gestion(nombre, isPositivo));
|
||||
this.nGestiones++;
|
||||
gestiones.get(this.gestiones.size()-1).aniadirGasto(transaccion);
|
||||
return;
|
||||
}
|
||||
@@ -146,10 +165,16 @@ class Mes implements Serializable{
|
||||
}
|
||||
|
||||
float getTotal() {
|
||||
float ret = 0;
|
||||
this.total = 0;
|
||||
for(Gestion gestion:this.gestiones) {
|
||||
ret += gestion.getTotal();
|
||||
this.total += gestion.getTotal();
|
||||
}
|
||||
return this.total;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String ret = "";
|
||||
ret += this.mes.toString() + "/" + this.anio + ":" + this.getTotal();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user