//==============================================================================
//The Society of Actuaries (SOA) makes this computer model and its computer
//code available to its members for educational purposes. The model and its
//code may be modified and redistributed without prior authorization from the
//SOA. The SOA distributes this computer model and its computer code in the
//hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
//implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
//PURPOSE.
//==============================================================================

package agents;

import implementation.SimulationUserPanel;

import java.util.ListIterator;

import repast.simphony.context.Context;
import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.parameter.Parameter;
import repast.simphony.ui.probe.ProbeID;
import resources.AgentID;
import resources.Constants;
import resources.Constants.PlanTag;
import agents.Agent;

@SuppressWarnings("unused")
public class ProviderNetwork extends Agent
{
//==============================================================================
// Attribute variables
// These variables do not change during the agent's life (unless the user
// changes an attribute parameter during a simulation).
//------------------------------------------------------------------------------
    private double minimumAlphaIncreasePercent;

//==============================================================================


//==============================================================================
// Memory variables
// These variables can change during an agent's life.
// There are two types of memory variables:
// 1. Currently updated variables:  Variables that the agent updates during the
//    period to which they apply.
// 2. Previously updated variables:  Variables that the agent updates during the
//    period prior to the period in which they apply.
//------------------------------------------------------------------------------
    //1. Currently updated memory variables
    // Variables from p1_SubmitClaims()
    private double currentClaims_Plan1;
    private double currentClaims_Plan2;
    private double currentCopayments_Plan1;
    private double currentCopayments_Plan2;
    private double currentTotalIncome_Plan1;
    private double currentTotalIncome_Plan2;
    private int currentNegotiationRound;

    // 2. Previously updated memory variables
    private double nextCurrentTreatmentCostAlpha;


//==============================================================================


//==============================================================================
// Other variables
// These are other variables used in the class.
// They are not available through "getter" methods.
//------------------------------------------------------------------------------
    private Context<Object> simulationContext;
    private double tickCount;

//==============================================================================


//==============================================================================
// Method:  ProviderNetwork() constructor
//------------------------------------------------------------------------------

    public ProviderNetwork(Context<Object> pContext, AgentID pProviderNetworkID)
    {

        setAgentID(pProviderNetworkID);
        simulationContext = pContext;

        init_InitializeVariables_Constructor();

    }//end ProviderNetwork()

//==============================================================================


//==============================================================================
// Methods: Initialization methods for the agent. These are used in
//          the agent's constructor method or at the beginning of each
//          simulation period.
//==============================================================================

//==============================================================================
// Method:  init_InitializeVariables_Constructor()
// The constructor does the following:
// 1. Initializes variables that remain constant throughout
//    an agent's life (unless the user changes parameters).
//    These are the agent's "attribute" variables.
// 2. Initializes the value of all other variables.
// This method gives a valid (non-null) value to all the agent's variables.
//------------------------------------------------------------------------------
    private void init_InitializeVariables_Constructor()
    {

        // 1. Initialize "attribute" variables.
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            minimumAlphaIncreasePercent = SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkA();
        }//end if
        else
        {
            minimumAlphaIncreasePercent = SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkB();
        }//end else

        // 2. Initialize the value of all other variables.
        currentClaims_Plan1 = 0.0;
        currentClaims_Plan2 = 0.0;
        currentCopayments_Plan1 = 0.0;
        currentCopayments_Plan2 = 0.0;
        currentTotalIncome_Plan1 = 0.0;
        currentTotalIncome_Plan2 = 0.0;
        currentNegotiationRound = 0;
        nextCurrentTreatmentCostAlpha = 0.0;

    }//end init_InitializeVariables_Constructor()
//------------------------------------------------------------------------------

//==============================================================================
// Method:  init_InitializeVariables_BOP() (beginning of period)
// This method does the following:
// 1. Updates attribute variables. If the user changes an attribute parameter
//    during a simulation, these may change.
// 2. Updates the prior period values of all variables (after the first period).
// 3. Provides "current" values for certain variables that the agent
//    does not set at the beginning of the period with a separate behavior.
//    This is done for those variables will be needed by behaviors of this agent
//    or by other agents during the period.
// 4. Re-initialize all CURRENT (NOT PRIOR) variables (except those that would cause
//    display or chart problems (flickering, etc.).
// 5. removes agents that have died.
//------------------------------------------------------------------------------
    public void init_InitializeVariables_BOP()
    {

        // 1. Update attribute variables.
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            minimumAlphaIncreasePercent = SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkA();
        }//end if
        else
        {
            minimumAlphaIncreasePercent = SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkB();
        }//end else

        // 2. Update prior period values of all variables (after the first period).
        // None

        // 3. Provide "current" values for certain variables that the agent does not set at the
        //    beginning of the period with a separate behavior.
        // None
        // Note that the Network Provider does not set currentTreatmentCostAlpha.
        // The Health Insurance Company does.

        // 4. Re-initialize all CURRENT (NOT PRIOR) variables (except those that would cause
        //    display or chart problems (flickering, etc.).
        currentClaims_Plan1 = 0.0;
        currentClaims_Plan2 = 0.0;
        currentCopayments_Plan1 = 0.0;
        currentCopayments_Plan2 = 0.0;
        currentTotalIncome_Plan1 = 0.0;
        currentTotalIncome_Plan2 = 0.0;
        currentNegotiationRound = 0;
        nextCurrentTreatmentCostAlpha = 0.0;

        // 5. Remove agents that have died
        // None


    }//end init_InitializeVariables_BOP()
//------------------------------------------------------------------------------

//==============================================================================


//==============================================================================
// Methods:  "Input" methods for the agent. These are described in the
// detailed description of the model. Each method is preceded by "i#".
//==============================================================================

// None

//==============================================================================


//==============================================================================
// Methods:  "Process" methods for the agent. These are described in the
// detailed description of the model. Each method is preceded by "p#"
// to indicate its number according to the numbering scheme used in the
// detailed description.
//==============================================================================

//==============================================================================
// Method:  p1_SubmitClaims()
// Calculate the amount of claims submitted from the Provider Network for
// each plan for the period, using Rule 2 (Compute claims).
// This process also calculates co-payments received (Rule 3) and
// total income (Rule 3).
//------------------------------------------------------------------------------
    public void p1_SubmitClaims()
    {

        r2_ComputeClaims();
        r3_ComputeCopayments();
        r4_ComputeTotalIncome();

    }//end p1_SubmitClaims()
//------------------------------------------------------------------------------

//==============================================================================
// Method:  p2_ProvideNegotiationResponse()
// In response to the Health Insurance Company’s desired treatment cost alpha,
// if the desired alpha is less than (alpha_previous x “minimum alpha increase
// percent” – a parameter), the Provider Network sends a response calculated
// according to Rule 1 (Compute negotiation response).
// Otherwise, the network accepts the offer.
// The network iterates this process twice
//------------------------------------------------------------------------------
    public void p2_ProvideNegotiationResponse()
    {

        // Note that the "prior" treatment cost alpha is really the "current" value.
        double currentTreatmentCostAlphaOffer_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatmentCostAlphaOffer();
        double currentTreatmentCostAlphaOffer_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatmentCostAlphaOffer();
        double currentTreatmentCostAlphaResponse_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatemntCostAlphaResponse();
        double currentTreatmentCostAlphaResponse_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatemntCostAlphaResponse();
        double priorTreatmentCostAlpha_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatmentCostAlpha();
        double priorTreatmentCostAlpha_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatmentCostAlpha();

        tickCount = RunEnvironment.getInstance().getCurrentSchedule().getTickCount();

        if (tickCount >= 0.0) // Even though it does nothing, this statement is left for future use.
        {
            switch (currentNegotiationRound)
            {
                case Constants.FIRST:
                {
                    if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
                    {
                        if ( currentTreatmentCostAlphaOffer_A < priorTreatmentCostAlpha_A * (1 + minimumAlphaIncreasePercent))
                        {
                            r1_ComputeNegotiationResponse();
                            currentNegotiationRound = Constants.SECOND;
                        }//end if
                        else
                        {
                            nextCurrentTreatmentCostAlpha = currentTreatmentCostAlphaOffer_A;
                            currentNegotiationRound = Constants.SECOND;
                        }//end else 
                    }//end if

                    else
                    {
                        if ( currentTreatmentCostAlphaOffer_B < priorTreatmentCostAlpha_B * (1 + minimumAlphaIncreasePercent))
                        {
                            r1_ComputeNegotiationResponse();
                            currentNegotiationRound = Constants.SECOND;
                        }//end if
                        else
                        {
                            nextCurrentTreatmentCostAlpha = currentTreatmentCostAlphaOffer_B;
                            currentNegotiationRound = Constants.SECOND;
                        }//end else 
                    }//end else

                    break;
                }//end case

                case Constants.SECOND:
                {
                    if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
                    {
                        if ( currentTreatmentCostAlphaResponse_A < priorTreatmentCostAlpha_A *(1 + minimumAlphaIncreasePercent))
                        {
                            nextCurrentTreatmentCostAlpha = (priorTreatmentCostAlpha_A *(1 + minimumAlphaIncreasePercent) + currentTreatmentCostAlphaResponse_A)/2.0;
                            currentNegotiationRound = Constants.SECOND;
                        }//end if
                        else
                        {
                            nextCurrentTreatmentCostAlpha = currentTreatmentCostAlphaResponse_A;
                            currentNegotiationRound = Constants.SECOND;
                        }//end else 
                    }//end if

                    else
                    {
                        if ( currentTreatmentCostAlphaResponse_B < priorTreatmentCostAlpha_B * (1 + minimumAlphaIncreasePercent))
                        {
                            nextCurrentTreatmentCostAlpha = (priorTreatmentCostAlpha_B *(1 + minimumAlphaIncreasePercent) + currentTreatmentCostAlphaResponse_B)/2.0;
                            currentNegotiationRound = Constants.SECOND;
                        }//end if
                        else
                        {
                            nextCurrentTreatmentCostAlpha = currentTreatmentCostAlphaResponse_B;
                            currentNegotiationRound = Constants.SECOND;
                        }//end else 
                    }//end else

                    break;
                }//end case

                default:
                {
                // There should be no default
                    System.out.println("Error:  Unexpected switch default in Provider Network p2_ProvideNegotiationResponse()");
                }//end case

            }//end switch

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Test 
// This block tests this method.
// To run the test, remove comments from the code below.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//    System.out.println("Provider Network p2_ProvideNegotiationResponse() at " +
//            RunEnvironment.getInstance().getCurrentSchedule().getTickCount());
//
//    System.out.println("Provider Network ID:  " + this.getAgentID().getAgentIDString());
//    System.out.println("Provider Network name:  " + this.getAgentName());
//    System.out.println("currentNegotiationRound:  " + currentNegotiationRound);
//
//    System.out.println("minimumAlphaIncreasePercent:  " + minimumAlphaIncreasePercent);
//    System.out.println("nextCurrentTreatmentCostAlpha:  " + nextCurrentTreatmentCostAlpha);
//    System.out.println("--------------------------------------");
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        }//end if

    }//end p2_ProvideNegotiationResponse()
//------------------------------------------------------------------------------


//==============================================================================


//==============================================================================
// Methods:  "Rule" methods for the agent. These are described in the
// detailed description of the model. Each method is preceded by "r#"
// to indicate its number according to the numbering scheme used in the
// detailed description.
//==============================================================================

//==============================================================================
// Method:  r1_ComputeNegotiationResponse()
// Calculate the fee level to offer the Health Insurance Company in response
// to its desired fee level. For the formula, see the model's description.
//------------------------------------------------------------------------------
    private void r1_ComputeNegotiationResponse()
    {
        // Note that the "prior" treatment cost alpha is really the "current" value.
        double priorTreatmentCostAlpha_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatmentCostAlpha();
        double priorTreatmentCostAlpha_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatmentCostAlpha();

        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            nextCurrentTreatmentCostAlpha = priorTreatmentCostAlpha_A * (1 + minimumAlphaIncreasePercent);
        }//end if
        
        else
        {
            nextCurrentTreatmentCostAlpha = priorTreatmentCostAlpha_B * (1 + minimumAlphaIncreasePercent);
        }//end else

    }//end r1_ComputeNegotiationResponse()
//------------------------------------------------------------------------------

//==============================================================================
// Method:  r2_ComputeClaims()
// Calculate the amount of co-payments received from Person agents covered
// under plans with co-payments, equal to the sum of alpha * (DS) ^ 2 times the
// “co-payment percentage” (parameters B3 and B6 of the parameter pane)
// for all Person agents treated under such plans.
//------------------------------------------------------------------------------
    private void r2_ComputeClaims()
    {
        ListIterator<Person> iterator = Environment.getPersonList().listIterator();

        double currentClaims_PlanA1 = 0;
        double currentClaims_PlanA2 = 0;
        double currentClaims_PlanB1 = 0;
        double currentClaims_PlanB2 = 0;
        
        double currentTreatmentCostAlpha_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatmentCostAlpha();
        double currentTreatmentCostAlpha_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatmentCostAlpha();

        while (iterator.hasNext())
        {
            Person person = iterator.next();
            switch (person.getCurrentPlanChosen())
            {
                case PlanA1:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentClaims_PlanA1 = currentClaims_PlanA1 + currentTreatmentCostAlpha_A * Math.pow(person.getCurrentDiseaseStatus(), 2);
                    }//end if
                    break;
                }//end case

                case PlanA2:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentClaims_PlanA2 = currentClaims_PlanA2 + currentTreatmentCostAlpha_A * Math.pow(person.getCurrentDiseaseStatus(), 2)
                                * (1 - Environment.getInsurancePlanList().get(Constants.PLAN_A2).getCopaymentPercentage());
                    }//end if
                    break;
                }//end case

                case PlanB1:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentClaims_PlanB1 = currentClaims_PlanB1 + currentTreatmentCostAlpha_B * Math.pow(person.getCurrentDiseaseStatus(), 2);
                    }//end if
                    break;
                }//end case

                case PlanB2:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentClaims_PlanB2 = currentClaims_PlanB2 + currentTreatmentCostAlpha_B * Math.pow(person.getCurrentDiseaseStatus(), 2)
                                * (1 - Environment.getInsurancePlanList().get(Constants.PLAN_B2).getCopaymentPercentage());
                    }//end if
                    break;
                }//end case

                case None:
                {
                    break;
                }//end case

                default:
                {
                // There should be no default
                    System.out.println("Error:  Unexpected switch default in Provider Network r2_ComputeClaims()");
                }//end case

            }//end switch

        }//end While


        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            currentClaims_Plan1 = currentClaims_PlanA1;
            currentClaims_Plan2 = currentClaims_PlanA2;

        }//end if

        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            currentClaims_Plan1 = currentClaims_PlanB1;
            currentClaims_Plan2 = currentClaims_PlanB2;

        }//end if

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Test 
// This block tests this method.
// To run the test, remove comments from the code below.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//    System.out.println("Provider Network r2_ComputeClaims() at " +
//            RunEnvironment.getInstance().getCurrentSchedule().getTickCount());
//
//    System.out.println("Provider Network ID:  " + getAgentID().getAgentIDString());
//    System.out.println("currentClaims_Plan1:  " + currentClaims_Plan1);
//    System.out.println("currentClaims_Plan2:  " + currentClaims_Plan2);
//    System.out.println("--------------------------------------");
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    }//end r2_ComputeClaims()
//------------------------------------------------------------------------------

//==============================================================================
// Method:  r3_ComputeCopayments()
// Calculate the amount of co-payments received from Person agents covered
// under plans with co-payments, equal to the sum of alpha * (DS) ^ 2 times the
// “co-payment percentage” (parameters B3 and B6 of the parameter pane)
// for all Person agents treated under such plans.
//------------------------------------------------------------------------------
    private void r3_ComputeCopayments()
    {

        ListIterator<Person> iterator = Environment.getPersonList().listIterator();

        double currentCopayments_PlanA1 = 0;
        double currentCopayments_PlanA2 = 0;
        double currentCopayments_PlanB1 = 0;
        double currentCopayments_PlanB2 = 0;
        
        double currentTreatmentCostAlpha_A = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_A).getCurrentTreatmentCostAlpha();
        double currentTreatmentCostAlpha_B = Environment.getHealthInsuranceCompanyList().get(Constants.HEALTH_INSURANCE_COMPANY_B).getCurrentTreatmentCostAlpha();

        while (iterator.hasNext())
        {
            Person person = iterator.next();
            switch (person.getCurrentPlanChosen())
            {
                case PlanA2:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentCopayments_PlanA2 = currentCopayments_PlanA2 + currentTreatmentCostAlpha_A * Math.pow(person.getCurrentDiseaseStatus(), 2)
                                * (Environment.getInsurancePlanList().get(Constants.PLAN_A2).getCopaymentPercentage());
                    }//end if
                    break;
                }//end case

                case PlanB2:
                {
                    if (person.isCurrentTreatmentRequest() == true)
                    {
                        currentCopayments_PlanB2 = currentCopayments_PlanB2 + currentTreatmentCostAlpha_B * Math.pow(person.getCurrentDiseaseStatus(), 2)
                                * (Environment.getInsurancePlanList().get(Constants.PLAN_B2).getCopaymentPercentage());
                    }//end if
                    break;
                }//end case

                case PlanA1: case PlanB1: case None:
                {
                    break;
                }//end case

                default:
                {
                // There should be no default
                    System.out.println("Error:  Unexpected switch default in Provider Network r3_ComputeCopayments()");
                }//end case

            }//end switch

        }//end While

        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            currentCopayments_Plan1 = currentCopayments_PlanA1;
            currentCopayments_Plan2 = currentCopayments_PlanA2;

        }//end if

        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            currentCopayments_Plan1 = currentCopayments_PlanB1;
            currentCopayments_Plan2 = currentCopayments_PlanB2;

        }//end if

    }//end r3_ComputeCopayments()
//------------------------------------------------------------------------------

//==============================================================================
// Method:  r4_ComputeTotalIncome()
// Calculate the amount of claims (Rule R2) plus the amount of co-payments
// (Rule R3) for the current period, for each plan.
//------------------------------------------------------------------------------
    private void r4_ComputeTotalIncome()
    {

        currentTotalIncome_Plan1 = currentClaims_Plan1;
        currentTotalIncome_Plan2 = currentClaims_Plan2 + currentCopayments_Plan2;

    }//end r4_ComputeTotalIncome()
//------------------------------------------------------------------------------


//==============================================================================


//==============================================================================
// Methods:  General methods for the agent.
//==============================================================================


//==============================================================================


//==============================================================================
//Methods: "Probe" methods for the model user to probe the agent's data.
//Note:    As a simulation runs, the model user can probe an agent by
//         double-clicking on its icon in the display. For more information
//         about probes, see the Repast Simphony reference documentation.
//==============================================================================

// The "ProbeID" annotation provides the probe ID
    @ProbeID
    public String getName()
    {
        return getAgentName();
    }

    @Parameter (usageName="currentClaims_Plan1", displayName="A1. Current claims - Plan 1")
    public double getCurrentClaims_Plan1()
    {
        return currentClaims_Plan1;
    }

    @Parameter (usageName="currentCopayments_Plan1", displayName="A2. Current copayments - Plan 1")
    public double getCurrentCopayments_Plan1()
    {
        return currentCopayments_Plan1;
    }

    @Parameter (usageName="currentTotalIncome_Plan1", displayName="A3. Current total income - Plan 1")
    public double getCurrentTotalIncome_Plan1()
    {
        return currentTotalIncome_Plan1;
    }

    @Parameter (usageName="currentClaims_Plan2", displayName="B1. Current claims - Plan 2")
    public double getCurrentClaims_Plan2()
    {
        return currentClaims_Plan2;
    }

    @Parameter (usageName="currentCopayments_Plan2", displayName="B2. Current copayments - Plan 2")
    public double getCurrentCopayments_Plan2()
    {
        return currentCopayments_Plan2;
    }

    @Parameter (usageName="currentTotalIncome_Plan2", displayName="B3. Current total income - Plan 2")
    public double getCurrentTotalIncome_Plan2()
    {
        return currentTotalIncome_Plan2;
    }

    @Parameter (usageName="minimumAlphaIncreasePercent", displayName="C1. Minimum alpha increase percent")
    public double getMinimumAlphaIncreasePercent()
    {
        return minimumAlphaIncreasePercent;
    }

    @Parameter (usageName="nextCurrentTreatmentCostAlpha", displayName="C2. Next current treatment cost alpha")
    public double getNextCurrentTreatmentCostAlpha()
    {
        return nextCurrentTreatmentCostAlpha;
    }

//==============================================================================


//==============================================================================
// Methods:  "Analysis" methods to support simulation charts and graphs.
//==============================================================================


    public double analysisGetClaims_TotalA()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentClaims_Plan1 + currentClaims_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetClaims_TotalB()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentClaims_Plan1 + currentClaims_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetClaims_PlanA1()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentClaims_Plan1;
        }//end if
        else return 0.0;
    }

    public double analysisGetClaims_PlanA2()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentClaims_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetClaims_PlanB1()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentClaims_Plan1;
        }//end if
        else return 0.0;
    }

    public double analysisGetClaims_PlanB2()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentClaims_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetTotalIncome_TotalA()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentTotalIncome_Plan1 + currentTotalIncome_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetTotalIncome_TotalB()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentTotalIncome_Plan1 + currentTotalIncome_Plan2;
        }//end if
        else return 0.0;
    }


    public double analysisGetTotalIncome_PlanA1()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentTotalIncome_Plan1;
        }//end if
        else return 0.0;
    }

    public double analysisGetTotalIncome_PlanA2()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_A)
        {
            return currentTotalIncome_Plan2;
        }//end if
        else return 0.0;
    }

    public double analysisGetTotalIncome_PlanB1()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentTotalIncome_Plan1;
        }//end if
        else return 0.0;
    }

    public double analysisGetTotalIncome_PlanB2()
    {
        if (this.getAgentID().getAgentNumber() == Constants.PROVIDER_NETWORK_B)
        {
            return currentTotalIncome_Plan2;
        }//end if
        else return 0.0;
    }




//==============================================================================


//==============================================================================
// Methods:  getter and setter methods
//------------------------------------------------------------------------------


//==============================================================================

}//end ProviderNetwork class