package org.poopki.duckdns.user_db.Array; import java.util.HashMap; import java.util.Map; import java.util.UUID; public class AccountArray { private static Map m_AccountArray = new HashMap(); public int transfer(UUID Src, UUID Des, Long Amount){ // 송금 method Account m_Src = m_AccountArray.get(Src); Account m_Des = m_AccountArray.get(Des); if(m_Src.withdraw(Amount)){ //인출 성공시 입금 if(m_Des.credit(Amount)) { return 1; } else{ m_Src.credit(Amount); return 2; } } else { return 3; } } public int getAccountInfo(UUID uuid) { // DB backup시 account 정보 접근 method Account m_Account = m_AccountArray.get(uuid); return m_Account.getBalance(); } public void putAccountInfo(UUID uuid, int Amount) { //AccountArray 생성 m_AccountArray.put(uuid, new Account(Amount)); } public boolean setAccountInfo(UUID uuid, Long Amount) { Account m_Account = m_AccountArray.get(uuid); return m_Account.setBalance(Amount); } }