@Override public boolean removePlan(final Plan plan) { boolean result = this.getPlans().remove(plan); if ((this.getSelectedPlan() == plan) && result) { this.setSelectedPlan(new RandomPlanSelector<Plan, Person>().selectPlan(this)); } return result; }
private void removePlans(final HasPlansAndId<PL, AG> person, final int maxNumberOfPlans) { while (person.getPlans().size() > maxNumberOfPlans) { PL plan = this.removalPlanSelector.selectPlan(person); person.removePlan(plan); if (plan == person.getSelectedPlan()) { final PL newPlanToSelect = new RandomPlanSelector<PL, AG>().selectPlan(person) ; if ( newPlanToSelect == null ) { throw new IllegalStateException( "could not find a plan to select for person "+person ); } person.setSelectedPlan( newPlanToSelect ); } } }
T otherPlan = new RandomPlanSelector<T, I>().selectPlan(person);
otherPlan = new RandomPlanSelector<Plan, Person>().selectPlan((person)); } while (otherPlan == currentPlan);
Plan plan = selector.selectPlan(person); if (plan == plan1) cnt1++; if (plan == plan2) cnt2++;