public Map<String, ActivityParams> getActivityParamsPerType() { final Map<String, ActivityParams> map = new LinkedHashMap<>(); for (ActivityParams pars : getActivityParams()) { map.put(pars.getActivityType(), pars); } return map; }
@Override protected void checkParameterSet(final ConfigGroup module) { switch (module.getName()) { case ActivityParams.SET_TYPE: if (!(module instanceof ActivityParams)) { throw new RuntimeException("wrong class for " + module); } final String t = ((ActivityParams) module).getActivityType(); if (getActivityParams(t) != null) { throw new IllegalStateException("already a parameter set for activity type " + t); } break; case ModeParams.SET_TYPE: if (!(module instanceof ModeParams)) { throw new RuntimeException("wrong class for " + module); } final String m = ((ModeParams) module).getMode(); if (getModes().get(m) != null) { throw new IllegalStateException("already a parameter set for mode " + m); } break; default: throw new IllegalArgumentException(module.getName()); } }
public void addActivityParams(final ActivityParams params) { final ActivityParams previous = this.getActivityParams(params.getActivityType()); if (previous != null) { if (previous.getActivityType().equals(PtConstants.TRANSIT_ACTIVITY_TYPE)) { log.error("ERROR: Activity parameters for activity type " + previous.getActivityType() + " were just overwritten. This happens most " + "likely because you defined them in the config file and the Controler overwrites them. Or the other way " + "round. pt interaction has problems, but doing what you are doing here will just cause " + "other (less visible) problem. Please take the effort to discuss with the core team " + "what needs to be done. kai, nov'12"); } else { log.info("activity parameters for activity type " + previous.getActivityType() + " were just overwritten."); } final boolean removed = removeParameterSet(previous); if (!removed) throw new RuntimeException("problem replacing activity params "); } super.addParameterSet(params); }
for (ActivityParams actType : this.getActivityParams()) { if (actType.isScoringThisActivityAtAll()) {
for (ActivityParams params : scoringParameterSet.getActivityParams()) { ActivityUtilityParameters.Builder factory = new ActivityUtilityParameters.Builder(params) ; utilParams.put(params.getActivityType(), factory ) ;
public ActivityParams getActivityParams(final String actType) { if (getScoringParameters(null) != null) return getScoringParameters(null).getActivityParams(actType); else if (getScoringParameters(DEFAULT_SUBPOPULATION) != null) return getScoringParameters(DEFAULT_SUBPOPULATION).getActivityParams(actType); else throw new RuntimeException("Default subpopulation is not defined"); }
public Collection<ActivityParams> getActivityParams() { if (getScoringParameters(null) != null) return getScoringParameters(null).getActivityParams(); else if (getScoringParameters(DEFAULT_SUBPOPULATION) != null) return getScoringParameters(DEFAULT_SUBPOPULATION).getActivityParams(); else throw new RuntimeException("Default subpopulation is not defined"); }