tmpmove = (Move)apps[i].getPlan().getParameter("move").getValue(); if(matchColor(board, tmpmove, same)) Move tmpmove = (Move)tmp.getPlan().getParameter("move").getValue(); if(matchJump(board, tmpmove, jump))
/** * After plan has finished the candidate will be removed from the APL. */ public void planFinished(IInternalPlan rplan) { MProcessableElement mpe = (MProcessableElement)element.getModelElement(); ExcludeMode exclude = mpe.getExcludeMode(); // always delete the rplan because the candidate can be reused Object cand = rplan.getCandidate(); if(cand instanceof CandidateInfoMPlan) ((CandidateInfoMPlan)cand).removePlan(); // Do nothing if APL exclude is never if(MProcessableElement.ExcludeMode.Never.equals(exclude)) return; if(isToExclude(rplan, exclude)) candidates.remove(rplan.getCandidate()); }
/** * Check if an rplan is to exclude wrt the exclude mode and plan result state. * @param rplan The tried plan. * @param exclude * @return True, if should be excluded. */ protected boolean isToExclude(IInternalPlan rplan, ExcludeMode exclude) { return exclude.equals(ExcludeMode.WhenTried) || (rplan.isPassed() && exclude.equals(ExcludeMode.WhenSucceeded)) || (rplan.isFailed() && exclude.equals(ExcludeMode.WhenFailed)) || (rplan.isAborted() && rplan.getException()!=null && exclude.equals(ExcludeMode.WhenFailed)); }
Object[] vals = rplan.getParameterSet(mparam.getName()).getValues(); for(Object val: vals) getParameter(targetpara).setValue(rplan.getParameter(mparam.getName()).getValue()); if(rplan.isFailed()) this.setException(rplan.getException());
for(int i=0; i<apps.length; i++) if(apps[i].getPlan().hasParameter("importance")) double tmpval = ((Double)apps[i].getPlan().getParameter("importance").getValue()).doubleValue(); if(tmpval>selval)
/** * Called when a plan has finished. */ public void planFinished(IInternalAccess ia, IInternalPlan rplan) { super.planFinished(ia, rplan); finished = true; if(rplan instanceof RPlan) { PlanLifecycleState state = ((RPlan)rplan).getLifecycleState(); if(state.equals(RPlan.PlanLifecycleState.FAILED)) { setException(rplan.getException()); } } notifyListeners(); }
/** * Remove tried candidates from the actual candidate collection. */ protected void removeTriedCandidates() { MProcessableElement mpe = (MProcessableElement)element.getModelElement(); ExcludeMode exclude = mpe.getExcludeMode(); if(candidates!=null && candidates.size()>0 && !ExcludeMode.Never.equals(exclude) && element.getTriedPlans()!=null) { List<Object> cands = new ArrayList<Object>(candidates); for(Object candidate: cands) { for(IInternalPlan plan: element.getTriedPlans()) { if(plan.getCandidate().equals(candidate)) { if(isToExclude(plan, exclude)) { candidates.remove(candidate); break; } } } } } }