import java.lang.*; import java.io.*; import edu.neu.ccs.demeter.dj.*; import java.util.*; import edu.neu.ccs.demeter.*; abstract class Party { protected Agreement agreement; public Agreement get_agreement() { return agreement; } public void set_agreement(Agreement new_agreement) { agreement = new_agreement; } protected PartyId partyid; public PartyId get_partyid() { return partyid; } public void set_partyid(PartyId new_partyid) { partyid = new_partyid; } public Party() { super(); } public Party(Agreement agreement, PartyId partyid) { super(); set_agreement(agreement); set_partyid(partyid); } private static char promptKind() { /* This function will return a string specifying what kind of party the user wants return char is guaranteed to be i c or q output: the char 'c' 'i' or 'q' */ char option = ' '; //find out what kind of party (individual or corporate) while (option != 'i' && option != 'c' && option != 'q') option = Main.promptChar("Is this an individual or a corporate account? (i/c/q to quit)"); return option; } public static Party promptParty(String prompt, boolean newParty) { /* This function will find a party described by user input. input: prompt - a string to prompt the user newParty - if true, a new Party will be created output: a new party if newParty, otherwise an existing party or null */ Party returnParty; //party to be returned char partyType; //char represents type of party we are adding //find out what subclass of party to add partyType = promptKind(); System.out.println(prompt); //get the party from the user if (partyType == 'i') returnParty = Individual.prompt("", newParty); else if (partyType == 'c') returnParty = CorporateBody.prompt("", newParty); else returnParty = null; return returnParty; } protected void updateAgreement() { get_agreement().modify(); } void viewParty() { PrintVisitor v0 = new PrintVisitor(); v0.start(); __trav_viewParty(v0); v0.finish(); } void universal_trv0_bef(UniversalVisitor _v_) { ((UniversalVisitor) _v_).before(this); } void universal_trv0_aft(UniversalVisitor _v_) { ((UniversalVisitor) _v_).after(this); } void universal_trv0(UniversalVisitor _v_) { ((UniversalVisitor) _v_).before_agreement(this, agreement); agreement.universal_trv0(_v_); ((UniversalVisitor) _v_).after_agreement(this, agreement); ((UniversalVisitor) _v_).before_partyid(this, partyid); partyid.universal_trv0(_v_); ((UniversalVisitor) _v_).after_partyid(this, partyid); } void everything_Bank_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } void everything_Bank_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } void everything_Bank_trv(PrintVisitor __v0) { ((UniversalVisitor) __v0).before_agreement(this, agreement); agreement.everything_Bank_trv(__v0); ((UniversalVisitor) __v0).after_agreement(this, agreement); ((UniversalVisitor) __v0).before_partyid(this, partyid); partyid.everything_Bank_trv(__v0); ((UniversalVisitor) __v0).after_partyid(this, partyid); } void __trav_print_Bank_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } void __trav_print_Bank_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } void __trav_print_Bank_trv(PrintVisitor __v0) { ((UniversalVisitor) __v0).before_agreement(this, agreement); agreement.__trav_print_Bank_trv(__v0); ((UniversalVisitor) __v0).after_agreement(this, agreement); ((UniversalVisitor) __v0).before_partyid(this, partyid); partyid.__trav_print_Bank_trv(__v0); ((UniversalVisitor) __v0).after_partyid(this, partyid); } void __trav_display_Bank_trv_bef(DisplayVisitor __v0) { ((UniversalVisitor) __v0).before(this); } void __trav_display_Bank_trv_aft(DisplayVisitor __v0) { ((UniversalVisitor) __v0).after(this); } void __trav_display_Bank_trv(DisplayVisitor __v0) { ((DisplayVisitor) __v0).before_agreement(this, agreement); agreement.__trav_display_Bank_trv(__v0); ((UniversalVisitor) __v0).after_agreement(this, agreement); ((DisplayVisitor) __v0).before_partyid(this, partyid); partyid.__trav_display_Bank_trv(__v0); ((UniversalVisitor) __v0).after_partyid(this, partyid); } public void __trav_viewParty(PrintVisitor __v0) { __trav_viewParty_Party_trv(__v0); } void __trav_viewParty_Party_trv_bef(PrintVisitor __v0) { ((UniversalVisitor) __v0).before(this); } void __trav_viewParty_Party_trv_aft(PrintVisitor __v0) { ((UniversalVisitor) __v0).after(this); } void __trav_viewParty_Party_trv(PrintVisitor __v0) { ((UniversalVisitor) __v0).before_partyid(this, partyid); partyid.__trav_viewParty_Party_trv(__v0); ((UniversalVisitor) __v0).after_partyid(this, partyid); } }