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