13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12.12 Resources291if (dbC<strong>on</strong>n != null) {// We have a database c<strong>on</strong>necti<strong>on</strong>.} else {// We d<strong>on</strong>'t and we must create a top account.}return topAccount;}// Simple getter; returns the name.public StringgetName() { return name; }// Simple getter; returns the total pool of m<strong>on</strong>ey that this account represents.public SAM<strong>on</strong>eygetTotal() { return total; }// Simple getter; returns the balance.public SAM<strong>on</strong>eygetBalance() { return balance; }// Simple getter; returns the parent account.public AccountgetParent() { return parent; }// Simple getter; returns the owner of this account, as a User object.public UsergetOwner() { return owner; }// Census - how many children.public intsize() { return children.size(); }/*** Get to all the children, via an iterator.*/public IteratorgetAllSubs(){return children.values().iterator();}/*** Create a new subaccount (i.e., child)* given a name and an amount.* The child is c<strong>on</strong>nected to the parent, and* the parent's balance is reduced by the amount* allocated to the child.*/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!