com.carlosbcruz.account.dynamicmodel
Class AccountUserAccount

java.lang.Object
  extended by com.carlosbcruz.account.dynamicmodel.AccountUserAccount

public class AccountUserAccount
extends java.lang.Object

Represents an User Account. An user com.carlosbcruz.account.control has a set of transactions.

Author:
Carlos Fernando Bella Cruz - pessoal@carlosbcruz.com

Constructor Summary
AccountUserAccount(java.lang.String accountId)
           
 
Method Summary
 void addAccountModelListener(AccountModelListener listener)
          Add a listener to the com.carlosbcruz.account.control model
 void addTransaction(AccountTransaction transaction)
          Insert a transaction at the end
 java.lang.String getAccountId()
          Returns the com.carlosbcruz.account.control Id.
 int getNumberOfAllTransactions()
          Inform the total of transactions existent
 int getNumberOfTransactions(int year)
          Returns the number of transactions for a specif year.
 int getNumberOfYears()
          Inform the number of different years existent
 int getPositionOfFirstTransactions(int year)
          Returns the position of the first transactions for a specif year.
 AccountTransaction getTransaction(int position)
          Return the transaction for a specifc position
 AccountTransaction getTransaction(int year, int position)
          Seek for the a specific transaction ina relative position into the specified year
 int getYearByPosition(int position)
          Inform the correspondig year by position.
 void removeAccountModelListener(AccountModelListener listener)
          Remove a listener to the com.carlosbcruz.account.control model
 void setAccountId(java.lang.String accountId)
          Sets the com.carlosbcruz.account.control Id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountUserAccount

public AccountUserAccount(java.lang.String accountId)
Parameters:
accountId - The accountId to set
Method Detail

getAccountId

public java.lang.String getAccountId()
Returns the com.carlosbcruz.account.control Id.

Returns:
The com.carlosbcruz.account.control id

setAccountId

public void setAccountId(java.lang.String accountId)
Sets the com.carlosbcruz.account.control Id.

Parameters:
accountId - The accountId to set

getNumberOfAllTransactions

public int getNumberOfAllTransactions()
Inform the total of transactions existent

Returns:
The total of transactions

getTransaction

public AccountTransaction getTransaction(int position)
Return the transaction for a specifc position

Parameters:
position - The informed position
Returns:
The required transaction

getNumberOfTransactions

public int getNumberOfTransactions(int year)
Returns the number of transactions for a specif year.

Parameters:
year - target year
Returns:
number of transactions

getPositionOfFirstTransactions

public int getPositionOfFirstTransactions(int year)
Returns the position of the first transactions for a specif year.

Parameters:
year - target year
Returns:
transactions position

getTransaction

public AccountTransaction getTransaction(int year,
                                         int position)
Seek for the a specific transaction ina relative position into the specified year

Parameters:
year - target year
position - position inside the year. Zero reffers to the first one.
Returns:
The required transaction

getNumberOfYears

public int getNumberOfYears()
Inform the number of different years existent

Returns:
The number of different years

getYearByPosition

public int getYearByPosition(int position)
Inform the correspondig year by position. The first position is zero

Parameters:
position - Position of the year
Returns:
The year

addTransaction

public void addTransaction(AccountTransaction transaction)
Insert a transaction at the end

Parameters:
transaction - The transaction to be inserted

addAccountModelListener

public void addAccountModelListener(AccountModelListener listener)
Add a listener to the com.carlosbcruz.account.control model

Parameters:
listener - instance that will listen to model change events.

removeAccountModelListener

public void removeAccountModelListener(AccountModelListener listener)
Remove a listener to the com.carlosbcruz.account.control model

Parameters:
listener - instance that will listen to model change events.