Class Account
java.lang.Object
org.episteme.social.economics.money.Account
- All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Property
Represents a bank account for storing money and financial assets.
An account can hold monetary balances and financial shares, with support for multiple owners and bank affiliation.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Account with a name and currency.Account(Bank bank, Set<EconomicAgent> owners, Identification identification, String name, Money amount) Creates a new Account with full details.Account(Bank bank, Set<EconomicAgent> owners, Identification id, String name, Money amount, Map<Share, Integer> shares) Creates a new Account with shares. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOwner(EconomicAgent owner) Adds an owner to the account.voidAdds shares to the account.voidDeposits an amount into the account.booleangetBank()Returns the bank holding this account.Returns the account currency.getId()Returns the unique identifier of this entity.Returns an unmodifiable set of account owners.Returns an unmodifiable map of share holdings.Returns the traits map for this entity.getValue()Returns the current account balance.inthashCode()booleanisEmpty()Checks if the account is empty (no money and no shares).voidremoveOwner(EconomicAgent owner) Removes an owner from the account.voidremoveShare(Share share, int quantity) Removes shares from the account.voidsetOwners(Set<EconomicAgent> owners) Replaces all owners.voidReplaces all share holdings.toString()voidWithdraws an amount from the account.Methods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, getTrait, setName, setTrait
-
Constructor Details
-
Account
-
Account
public Account(Bank bank, Set<EconomicAgent> owners, Identification identification, String name, Money amount) Creates a new Account with full details.- Parameters:
bank- the bank holding this accountowners- the owners of this accountidentification- the account IDname- the account nameamount- initial balance
-
Account
public Account(Bank bank, Set<EconomicAgent> owners, Identification id, String name, Money amount, Map<Share, Integer> shares) Creates a new Account with shares.- Parameters:
bank- the bank holding this accountowners- the owners of this accountname- the account nameamount- initial balanceshares- initial share holdingsidentification- the account ID
-
-
Method Details
-
getId
Description copied from interface:IdentifiedReturns the unique identifier of this entity.- Specified by:
getIdin interfaceIdentified<Identification>- Returns:
- the identifier
-
getTraits
Description copied from interface:ComprehensiveIdentificationReturns the traits map for this entity.- Specified by:
getTraitsin interfaceCommented- Specified by:
getTraitsin interfaceComprehensiveIdentification- Returns:
- the traits map
-
getBank
Returns the bank holding this account.- Returns:
- the bank, or null for cash collections
-
getOwners
Returns an unmodifiable set of account owners. -
addOwner
Adds an owner to the account.- Parameters:
owner- the owner to add
-
removeOwner
Removes an owner from the account.- Parameters:
owner- the owner to remove- Throws:
IllegalArgumentException- if trying to remove the last owner
-
setOwners
Replaces all owners.- Parameters:
owners- the new set of owners
-
getIdentification
-
getValue
-
getCurrency
-
deposit
Deposits an amount into the account.- Parameters:
amount- the amount to add
-
withdraw
Withdraws an amount from the account.- Parameters:
amount- the amount to subtract
-
isEmpty
public boolean isEmpty()Checks if the account is empty (no money and no shares).- Returns:
- true if empty
-
equals
-
hashCode
-
toString
-