Class Account

java.lang.Object
org.episteme.social.economics.money.Account
All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Property

public class Account extends Object implements Property, ComprehensiveIdentification
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 Details

    • Account

      public Account(String name, Currency currency)
      Creates a new Account with a name and currency.
      Parameters:
      name - the account name
      currency - the currency
    • 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 account
      owners - the owners of this account
      identification - the account ID
      name - the account name
      amount - 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 account
      owners - the owners of this account
      name - the account name
      amount - initial balance
      shares - initial share holdings
      identification - the account ID
  • Method Details

    • getId

      public Identification getId()
      Description copied from interface: Identified
      Returns the unique identifier of this entity.
      Specified by:
      getId in interface Identified<Identification>
      Returns:
      the identifier
    • getTraits

      public Map<String,Object> getTraits()
      Description copied from interface: ComprehensiveIdentification
      Returns the traits map for this entity.
      Specified by:
      getTraits in interface Commented
      Specified by:
      getTraits in interface ComprehensiveIdentification
      Returns:
      the traits map
    • getBank

      public Bank getBank()
      Returns the bank holding this account.
      Returns:
      the bank, or null for cash collections
    • getOwners

      public Set<EconomicAgent> getOwners()
      Returns an unmodifiable set of account owners.
      Specified by:
      getOwners in interface Property
      Returns:
      the owners
    • addOwner

      public void addOwner(EconomicAgent owner)
      Adds an owner to the account.
      Parameters:
      owner - the owner to add
    • removeOwner

      public void removeOwner(EconomicAgent owner)
      Removes an owner from the account.
      Parameters:
      owner - the owner to remove
      Throws:
      IllegalArgumentException - if trying to remove the last owner
    • setOwners

      public void setOwners(Set<EconomicAgent> owners)
      Replaces all owners.
      Parameters:
      owners - the new set of owners
    • getIdentification

      public Identification getIdentification()
    • getValue

      public Money getValue()
      Returns the current account balance.
      Specified by:
      getValue in interface Property
      Returns:
      the balance
    • getCurrency

      public Currency getCurrency()
      Returns the account currency.
      Returns:
      the currency
    • deposit

      public void deposit(Money amount)
      Deposits an amount into the account.
      Parameters:
      amount - the amount to add
    • withdraw

      public void withdraw(Money amount)
      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
    • getShares

      public Map<Share,Integer> getShares()
      Returns an unmodifiable map of share holdings.
      Returns:
      the shares
    • addShare

      public void addShare(Share share, int quantity)
      Adds shares to the account.
      Parameters:
      share - the share type
      quantity - the number of shares
    • removeShare

      public void removeShare(Share share, int quantity)
      Removes shares from the account.
      Parameters:
      share - the share type
      quantity - the number of shares to remove
    • setShares

      public void setShares(Map<Share,Integer> shares)
      Replaces all share holdings.
      Parameters:
      shares - the new shares map
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object