Rimozione lista conti correnti inutile
This commit is contained in:
@@ -4,9 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package mybank;
|
package mybank;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Verde
|
* @author Verde
|
||||||
@@ -17,7 +14,6 @@ public class ContoCorrente {
|
|||||||
private int numeroContoCorrente;
|
private int numeroContoCorrente;
|
||||||
|
|
||||||
private static int totaleNumeriCorrenti;
|
private static int totaleNumeriCorrenti;
|
||||||
private static ArrayList<Integer> numeriContiCorrenti = new ArrayList<>();
|
|
||||||
|
|
||||||
public ContoCorrente() {
|
public ContoCorrente() {
|
||||||
}
|
}
|
||||||
@@ -26,22 +22,17 @@ public class ContoCorrente {
|
|||||||
this.intestatario = intestatario;
|
this.intestatario = intestatario;
|
||||||
this.saldo = saldo;
|
this.saldo = saldo;
|
||||||
this.numeroContoCorrente = totaleNumeriCorrenti++;
|
this.numeroContoCorrente = totaleNumeriCorrenti++;
|
||||||
numeriContiCorrenti.add(numeroContoCorrente);
|
|
||||||
ScriviLeggiFile.log("Apertura del conto con saldo iniziale di " + this.saldo, numeroContoCorrente);
|
ScriviLeggiFile.log("Apertura del conto con saldo iniziale di " + this.saldo, numeroContoCorrente);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getNumeriContiCorrenti() {
|
|
||||||
return numeriContiCorrenti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setNumeriContiCorrenti(List<Integer> numeriContiCorrenti) {
|
|
||||||
ContoCorrente.numeriContiCorrenti = (ArrayList<Integer>) numeriContiCorrenti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumeroContoCorrente() {
|
public int getNumeroContoCorrente() {
|
||||||
return numeroContoCorrente;
|
return numeroContoCorrente;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getTotaleNumeriCorrenti() {
|
||||||
|
return totaleNumeriCorrenti;
|
||||||
|
}
|
||||||
|
|
||||||
public Persona getIntestatario() {
|
public Persona getIntestatario() {
|
||||||
return intestatario;
|
return intestatario;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class MyBank {
|
|||||||
numeroContoCorrente = sc.nextInt();
|
numeroContoCorrente = sc.nextInt();
|
||||||
sc.nextLine();
|
sc.nextLine();
|
||||||
|
|
||||||
if (!ContoCorrente.getNumeriContiCorrenti().contains(numeroContoCorrente)) {
|
if (numeroContoCorrente < 0 || numeroContoCorrente >= ContoCorrente.getTotaleNumeriCorrenti()) {
|
||||||
System.out.println("Errore: il conto corrente specificato non esiste.");
|
System.out.println("Errore: il conto corrente specificato non esiste.");
|
||||||
pausa();
|
pausa();
|
||||||
error = true;
|
error = true;
|
||||||
|
|||||||
@@ -75,11 +75,6 @@ public class ScriviLeggiFile {
|
|||||||
}
|
}
|
||||||
conti.add(mapper.readerFor(ContoCorrente.class).readValue(sb.toString()));
|
conti.add(mapper.readerFor(ContoCorrente.class).readValue(sb.toString()));
|
||||||
|
|
||||||
ArrayList<Integer> numeriContiCorrenti = (ArrayList<Integer>) ContoCorrente
|
|
||||||
.getNumeriContiCorrenti();
|
|
||||||
numeriContiCorrenti.add(conti.getLast().getNumeroContoCorrente());
|
|
||||||
ContoCorrente.setNumeriContiCorrenti(numeriContiCorrenti);
|
|
||||||
|
|
||||||
} catch (IOException _) {
|
} catch (IOException _) {
|
||||||
System.out.println("Errore nella lettura del file di conto corrente.");
|
System.out.println("Errore nella lettura del file di conto corrente.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user