the_big_one/src/main/java/jesse/keeblarcraft/BankMgr/IndividualBank.java

68 lines
2.8 KiB
Java
Raw Normal View History

package jesse.keeblarcraft.BankMgr;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jesse.keeblarcraft.ConfigMgr.ConfigManager;
// Contains the information of an individual bank
//
// The bank will keep track of all accounts within its facilities. In addition to accounts, the bank
// maintains its own identifier which is unique and other misc things.
public class IndividualBank {
ConfigManager config = new ConfigManager();
private String routingNumber; // this is the banks unique identifier
private String numberOfAccounts; // Total number of accounts the bank has. This includes only active accounts
// Think FDIC but from the servers account (keeblarcraft insurance corporation)
// KBIC will ensure an amount of money based on its trustworthiness to a bank and the number of holders it has.
private Integer kbicInsuredAmount;
private Boolean kbicInsured;
// bankMoney is the total amount of money the bank possesses itself. The bank itself is personally responsible
// for backing the amount of money it claims it has and this is the balance that is withdrawn from for credits.
// A bank can have a sum of money that is less than the total amount of money of all its account holders
private Integer bankMoney;
// Key = ACCOUNT NUMBER
// Value = ACCOUNT
private HashMap<Integer, IndividualAccount> accountsList;
private HashMap<String, List<Integer>> accountsListFromName; // This is a list that just points to a list of account numbers by person. USEFUL
private List<String> lockedUsers; // A list of users who are locked out of the bank and are incapable of performing more actions within it
public IndividualBank(String routingNumber) {
accountsList = new HashMap<Integer, IndividualAccount>();
accountsListFromName = new HashMap<String, List<Integer>>();
// READ IN BANK CONFIG
// A modified config reader is needed here for when each IndividualAccount is read in - the name is taken from that and is attached to the
// 'accountsListFromName' structure. This makes it no worse than O(n) to fill these two structures in
}
public Boolean CreateAccount(String holderName, String accountType) {
if (accountType.toLowerCase() != "checking" || accountType.toLowerCase() != "savings") {
return false;
} // TODO: Replace String with enum type in future and remove this early return
Boolean success = false;
// Verify this isn't a blacklisted user
if (!lockedUsers.contains(holderName)) {
}
return success;
}
public Boolean HasAccount(String accountIdentifier) {
Boolean containsAccount = false;
if (accountsList.containsKey(accountIdentifier)) {
containsAccount = true;
}
return true;
}
}