Comit saltando clase
This commit is contained in:
		
							parent
							
								
									7b52f06a51
								
							
						
					
					
						commit
						0ade46bde2
					
				| @ -5,14 +5,38 @@ import java.util.ArrayList; | |||||||
| 
 | 
 | ||||||
| public class Meses { | public class Meses { | ||||||
| private ArrayList<Mes> meses; | private ArrayList<Mes> meses; | ||||||
|  | 	private int mesActual=0; | ||||||
|  | 	 | ||||||
| 	public Meses() { | 	public Meses() { | ||||||
| 		this.meses=new ArrayList<Mes>(); | 		this.meses=new ArrayList<Mes>(); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public void aniadirTransaccion() { | 	public void aniadirTransaccion(Transaccion transaccion, String nombre) { | ||||||
| 		 | 		for(Mes mes:this.meses) { | ||||||
|  | 			if(transaccion.getDia().getMonth().equals(mes.getMes()) && | ||||||
|  | 					transaccion.getDia().getYear()==mes.getAnio()){ | ||||||
|  | 				mes.aniadirTransaccion(transaccion, nombre); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		this.meses.add(new Mes(new ArrayList<Gestion>())); | ||||||
|  | 		this.meses.get(this.meses.size()-1).aniadirTransaccion(transaccion, nombre); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	public void elegirMes(int anio, Month mes) { | ||||||
|  | 		for(int i=0;i<this.meses.size();i++) { | ||||||
|  | 			if(this.meses.get(i).getAnio()==anio && this.meses.get(i).getMes().equals(mes)) { | ||||||
|  | 				this.mesActual=0; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public ArrayList<Gestion> getGestionesActuales(){ | ||||||
|  | 		return this.meses.get(this.mesActual).getGestiones(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -24,4 +48,29 @@ class Mes{ | |||||||
| 	Mes(ArrayList<Gestion> gestiones){ | 	Mes(ArrayList<Gestion> gestiones){ | ||||||
| 		this.gestiones=gestiones; | 		this.gestiones=gestiones; | ||||||
| 	} | 	} | ||||||
|  | 	 | ||||||
|  | 	void aniadirTransaccion(Transaccion transaccion, String nombre) { | ||||||
|  | 		for(Gestion gestion:this.gestiones) { | ||||||
|  | 			if(gestion.getNombre().equals(nombre)) { | ||||||
|  | 				gestion.aniadirGasto(transaccion); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		gestiones.add(new Gestion(nombre)); | ||||||
|  | 		gestiones.get(this.gestiones.size()-1).aniadirGasto(transaccion); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	Month getMes() { | ||||||
|  | 		return this.mes; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	int getAnio() { | ||||||
|  | 		return this.anio; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	ArrayList<Gestion> getGestiones(){ | ||||||
|  | 		return this.gestiones; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user