@Override public void endTag( final String name, final String content, final Stack<String> context) { if ( name.equals( MODULE ) || name.equals( PARAMETER_SET ) ) { final ConfigGroup head = moduleStack.removeFirst(); if ( !moduleStack.isEmpty() ) moduleStack.getFirst().addParameterSet( head ); } } }
public void addModeParams(final ModeParams params) { final ModeParams previous = this.getModes().get( params.getMode() ); if ( previous != null ) { log.info("mode parameters for mode " + previous.getMode() + " were just overwritten.") ; final boolean removed = removeParameterSet( previous ); if ( !removed ) throw new RuntimeException( "problem replacing mode params " ); } super.addParameterSet( params ); }
public void addScoringParameters(final ScoringParameterSet params) { final ScoringParameterSet previous = this.getScoringParameters(params.getSubpopulation()); if (previous != null) { log.info("scoring parameters for subpopulation " + previous.getSubpopulation() + " were just replaced."); final boolean removed = removeParameterSet(previous); if (!removed) throw new RuntimeException("problem replacing scoring params "); } super.addParameterSet(params); }
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 ); }
@Override public void addParameterSet(final ConfigGroup set) { if ( set.getName().equals( ModeRoutingParams.SET_TYPE ) && !this.acceptModeParamsWithoutClearing ) { clearParameterSetsForType( set.getName() ); this.acceptModeParamsWithoutClearing = true; } ModeRoutingParams pars = (ModeRoutingParams) set ; // for the time being pushing the "global" factor into the local ones if they are not initialized by // themselves. Necessary for some tests; maybe we should eventually disable them. kai, feb'15 if ( pars.getBeelineDistanceFactor()== null ) { pars.setBeelineDistanceFactor( this.beelineDistanceFactor ); } super.addParameterSet( set ); }
private Config createTestConfig() { final Config c = ConfigUtils.createConfig(); final ConfigGroup module = new ConfigGroup( "thisAintNoFlat" ); module.addParam( "someParam" , "someValue" ); module.addParam( "anotherParam" , "anotherValue" ); final ConfigGroup paramSet1 = module.createParameterSet( "oneType" ); module.addParameterSet( paramSet1 ); paramSet1.addParam( "something" , "gloups" ); final ConfigGroup paramSet2 = module.createParameterSet( "oneType" ); module.addParameterSet( paramSet2 ); paramSet2.addParam( "something" , "gloups" ); paramSet2.addParam( "something_else" , "glips" ); final ConfigGroup paramSet3 = module.createParameterSet( "anotherType" ); module.addParameterSet( paramSet3 ); paramSet3.addParam( "niark" , "niourk" ); c.addModule( module ); return c; } }