diff --git a/src/main/java/org/ntlab/acanthus_server/models/Accounts.java b/src/main/java/org/ntlab/acanthus_server/models/Accounts.java index e4eda11..2a8976e 100644 --- a/src/main/java/org/ntlab/acanthus_server/models/Accounts.java +++ b/src/main/java/org/ntlab/acanthus_server/models/Accounts.java @@ -11,9 +11,9 @@ * */ public class Accounts { - private static Accounts _theInstance = null; + private static Accounts theInstance = null; - private HashMap _accountHashMap = new HashMap<>(); + private HashMap accountHashMap = new HashMap<>(); //----------------------------------------------------------------- // インスタンス生成禁止 @@ -24,8 +24,8 @@ // シングルトン取得 //----------------------------------------------------------------- public static Accounts getInstance() { - if (_theInstance == null) _theInstance = new Accounts(); - return _theInstance; + if (theInstance == null) theInstance = new Accounts(); + return theInstance; } //----------------------------------------------------------------- @@ -33,14 +33,14 @@ // Uidからアカウントを返す //----------------------------------------------------------------- public Account getAccountByUid(int uid) { - return _accountHashMap.get(uid); + return accountHashMap.get(uid); } //----------------------------------------------------------------- // e-Mailからアカウントを返す //----------------------------------------------------------------- public Account getAccountByEMail(String email) { - for (var account : _accountHashMap.values()) { + for (var account : accountHashMap.values()) { if (account.getEmail().equals(email)) return account; } return null; @@ -48,13 +48,15 @@ //----------------------------------------------------------------- //accountを全て返す public Collection getAllAccounts(){ - return _accountHashMap.values(); + return accountHashMap.values(); } + //----------------------------------------------------------------- //accountを追加する - public int resistAccount(String name, String email, String password){ + public int registAccount(String name, String email, String password){ var newAccount = new Account(name, email, password); var uid = new Random().nextInt(); - _accountHashMap.put(uid,newAccount); + + accountHashMap.put(uid,newAccount); return uid; }