de.upb.swtpra05.group03.companycontrol
Class AccountDataControl

java.lang.Object
  extended byde.upb.swtpra05.group03.companycontrol.AccountDataControl
All Implemented Interfaces:
Accounting

class AccountDataControl
extends java.lang.Object
implements Accounting

The Control Class which maintains the Account Data of the current Company.

Version:
$Revision: 1.3 $

Field Summary
private  AccountDataField actual
          Actual Entry
private  int actualdatastored
          Actual Amount of Data stored.
private  AccountDataField first
          First Entry
private  int firstBalance
          The first Balance added
private  AccountDataField last
          Last Entry
private  int lastBalance
          The last Balance added
private  int lastDate
          The Date when the last Balance was added
private  int maxdatastored
          Amount of the Data that is allowed to be stored max.
private  boolean sticky
          Lets the Actual Pointer stay where it is or moves to the last Account Information added.
 
Constructor Summary
(package private) AccountDataControl(int maxstored)
          Constructor.
 
Method Summary
 void addAccountBalance(int account, int time)
          Adds a new AccountBalance to the Storage
 int getAnzahl()
          Returns the actual Amount of Data stored.
 int getFirstBalance()
          returns first Balance added
 AccountBalances getlastAccounts(int howmany)
          Returns the last Account Balances stored before the actual Pointer.
 int getLastBalance()
          returns the last Balance added
private  int[] getmaxminoflastAccounts(int howmany)
          Calculates the Maximum and the Minimum of the last Balances
 void goleft(int amount)
          Lets the Actual Pointer move left so Account Balances which are stored early may be displayed
 void goright(int amount)
          Lets the Actual Pointer move right so Account Balances which are stored later may be displayed
 void reset()
          Resets all Data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastBalance

private int lastBalance
The last Balance added


lastDate

private int lastDate
The Date when the last Balance was added


firstBalance

private int firstBalance
The first Balance added


first

private AccountDataField first
First Entry


actual

private AccountDataField actual
Actual Entry


last

private AccountDataField last
Last Entry


sticky

private boolean sticky
Lets the Actual Pointer stay where it is or moves to the last Account Information added.


maxdatastored

private int maxdatastored
Amount of the Data that is allowed to be stored max.


actualdatastored

private int actualdatastored
Actual Amount of Data stored.

Constructor Detail

AccountDataControl

AccountDataControl(int maxstored)
Constructor.

Parameters:
maxstored - defines how many Balances will be stored
Method Detail

getAnzahl

public int getAnzahl()
Returns the actual Amount of Data stored.

Returns:
int

goleft

public void goleft(int amount)
Lets the Actual Pointer move left so Account Balances which are stored early may be displayed

Parameters:
amount - how far shall the pointer be moved?

goright

public void goright(int amount)
Lets the Actual Pointer move right so Account Balances which are stored later may be displayed

Parameters:
amount - how far shall the pointer be moved?

addAccountBalance

public void addAccountBalance(int account,
                              int time)
Adds a new AccountBalance to the Storage

Specified by:
addAccountBalance in interface Accounting
Parameters:
account - Balance to add
time - the actual time

reset

public void reset()
Resets all Data

Specified by:
reset in interface Accounting

getFirstBalance

public int getFirstBalance()
returns first Balance added

Returns:
int

getLastBalance

public int getLastBalance()
returns the last Balance added

Returns:
int

getlastAccounts

public AccountBalances getlastAccounts(int howmany)
Returns the last Account Balances stored before the actual Pointer.

Parameters:
howmany - defines the Amount of Balances that should be returned.
Returns:
AccountBalances The Class wich will store the desired Balances

getmaxminoflastAccounts

private int[] getmaxminoflastAccounts(int howmany)
Calculates the Maximum and the Minimum of the last Balances

Parameters:
howmany - max/min of howmay Balances from here to the past?
Returns:
int[] array of integer. at position 0 is the maximum. at position 1 the minimum