Bank{ public Party findParty(PartyId findMeId, boolean display){{ /* This function will look for a party based on ID. input: findMeId - the PartyId of the party we are looking for display - If true, the party will be displayed to the screen output: the Party object with PartyId */ Party currP = null; //current party in the enumeration BusinessUnit currBU; //current Business Unit in the enumeration boolean found = false; //flag to know when to stop looking java.util.Enumeration p_en; //party enumeration java.util.Enumeration bul_en = this.get_businessunit_list().elements(); //search business units while (bul_en.hasMoreElements() && !found) { currBU = (BusinessUnit) bul_en.nextElement(); p_en = currBU.get_party_list().elements(); //search parties while (p_en.hasMoreElements() && !found) { currP = (Party) p_en.nextElement(); found = currP.get_partyid().get_partyId() == findMeId.get_partyId(); } } if (!found) { System.out.println("Party " + findMeId.get_partyId() + " could not be found"); currP = null; } else if (display) currP.viewParty(); return currP; }} }//end Bank BusinessUnit_List{ public BusinessUnit findBusinessUnit(Index findMe, boolean display){{ /* This function will look for a business unit based on index. input: findMe - the index of the unit we are looking for display - If true, the unit will be displayed to the screen output: the existing BusinessUnit object at Index */ BusinessUnit currBU = null; //current Business Unit in the enumeration boolean found = false; //flag to know when to stop looking java.util.Enumeration en = this.elements(); //search business units while (en.hasMoreElements() && !found) { currBU = (BusinessUnit) en.nextElement(); found = currBU.get_index().get_index() == findMe.get_index(); } if (!found) { System.out.println("Business Unit " + findMe.get_index() + " could not be found"); currBU = null; } else if (display) currBU.viewUnit(); return currBU; }} } //end Business Unit List Contract_List { public Contract findContract(Index here, boolean display){{ /* finds a contract in this list input: here - the index of the contract we're looking for display - if true, the contract is displayed to the screen output: the existing Contract object or null */ Contract currContract = null; //current Contract in the enumeration boolean found = false; //flag to know when to stop looking java.util.Enumeration en = this.elements(); //search contract list while (en.hasMoreElements() && !found) { currContract = (Contract) en.nextElement(); found = currContract.get_index().get_index() == here.get_index(); } if (!found){ System.out.println("Contract at " + here.get_index() + " could not be found"); currContract = null; } else if (display) currContract.viewContract(); return currContract; }} }//end Contract_List Portfolio_List{ public Portfolio findPortfolio(Index here, boolean display){{ /* finds a portfolio in this list input: here - the index of the portfolio we're looking for display - if true, the portfolio is displayed to the screen output: the existing Portfolio object or null */ Portfolio currPortfolio = null; //current Portfolio in the enumeration boolean found = false; //flag to know when to stop looking java.util.Enumeration en = this.elements(); //search contract list while (en.hasMoreElements() && !found) { currPortfolio = (Portfolio) en.nextElement(); found = currPortfolio.get_index().get_index() == here.get_index(); } if (!found){ System.out.println("Portfolio at " + here.get_index() + " could not be found"); currPortfolio = null; } else if (display) currPortfolio.viewPortfolio(); return currPortfolio; }} }//end Portfolio_List Account_List{ public Account findAccount(AccountID here, boolean display){{ /* finds an account in this list input: here - the accountID of the account we're looking for display - if true, the account is displayed to the screen output: the existing Account object or null */ Account currAccount = null; //current Account in the enumeration boolean found = false; //flag to know when to stop looking java.util.Enumeration en = this.elements(); //search contract list while (en.hasMoreElements() && !found) { currAccount = (Account) en.nextElement(); found = currAccount.get_accountid().get_account_id() == here.get_account_id(); } if (!found){ System.out.println("Account at " + here.get_account_id() + " could not be found"); currAccount = null; } else if (display) currAccount.viewAccount(); return currAccount; }} }//end Account_List