@Override public void setType(String type) { this.delegate.setType(type); }
private void startPlan(final Attributes atts) { String sel = atts.getValue("selected"); boolean selected; if (sel.equals("yes")) { selected = true; } else if (sel.equals("no")) { selected = false; } else { throw new NumberFormatException("Attribute 'selected' of Element 'Plan' is neither 'yes' nor 'no'."); } this.routeDescription = null; this.currplan = PersonUtils.createAndAddPlan(this.currperson, selected); String scoreString = atts.getValue("score"); if (scoreString != null) { double score = Double.parseDouble(scoreString); this.currplan.setScore(score); } String type = atts.getValue(ATTR_TYPE); this.currplan.setType(type); }
private void startPlan(final Attributes atts) { String sel = atts.getValue(ATTR_PLAN_SELECTED); boolean selected; if (VALUE_YES.equals(sel)) { selected = true; } else if (VALUE_NO.equals(sel)) { selected = false; } else { throw new IllegalArgumentException( "Attribute 'selected' of Element 'Plan' is neither 'yes' nor 'no'."); } this.routeDescription = null; this.currplan = PersonUtils.createAndAddPlan(this.currperson, selected); String scoreString = atts.getValue(ATTR_PLAN_SCORE); if (scoreString != null) { double score = Double.parseDouble(scoreString); this.currplan.setScore(score); } String type = atts.getValue(ATTR_PLAN_TYPE); if (type != null) { this.currplan.setType(type); } }
private void startPlan(final Attributes atts) { String sel = atts.getValue(ATTR_PLAN_SELECTED); boolean selected; if (VALUE_YES.equals(sel)) { selected = true; } else if (VALUE_NO.equals(sel)) { selected = false; } else { throw new IllegalArgumentException( "Attribute 'selected' of Element 'Plan' is neither 'yes' nor 'no'."); } this.routeDescription = null; this.currplan = PersonUtils.createAndAddPlan(this.currperson, selected); String scoreString = atts.getValue(ATTR_PLAN_SCORE); if (scoreString != null) { double score = Double.parseDouble(scoreString); this.currplan.setScore(score); } String type = atts.getValue(ATTR_PLAN_TYPE); if (type != null) { this.currplan.setType(type); } }
/** loads a copy of an existing plan, but keeps the person reference * * @param in a plan who's data will be loaded into this plan * @param out **/ public static void copyFromTo(final Plan in, Plan out) { out.getPlanElements().clear(); out.setScore(in.getScore()); out.setType(in.getType()); for (PlanElement pe : in.getPlanElements()) { if (pe instanceof Activity) { out.getPlanElements().add(createActivity((Activity) pe)); } else if (pe instanceof Leg) { out.getPlanElements().add( createLeg( (Leg) pe ) ) ; } else { throw new IllegalArgumentException("unrecognized plan element type discovered"); } } AttributesUtils.copyAttributesFromTo(in, out ); }