001/* *********************************************************************** * 002 * project: org.matsim.* 003 * * 004 * *********************************************************************** * 005 * * 006 * copyright : (C) 2017 by the members listed in the COPYING, * 007 * LICENSE and WARRANTY file. * 008 * email : info at matsim dot org * 009 * * 010 * *********************************************************************** * 011 * * 012 * This program is free software; you can redistribute it and/or modify * 013 * it under the terms of the GNU General Public License as published by * 014 * the Free Software Foundation; either version 2 of the License, or * 015 * (at your option) any later version. * 016 * See also COPYING, LICENSE and WARRANTY file * 017 * * 018 * *********************************************************************** */ 019 020package org.matsim.contrib.accidents; 021 022import org.matsim.core.config.ConfigUtils; 023import org.matsim.core.controler.AbstractModule; 024 025import com.google.inject.Singleton; 026 027/** 028* @author ikaddoura 029*/ 030 031public final class AccidentsModule extends AbstractModule { 032 033 @Override 034 public void install() { 035 AccidentsConfigGroup accidentsConfigGroup = ConfigUtils.addOrGetModule( getConfig() , AccidentsConfigGroup.class ); 036 037 if ( accidentsConfigGroup.isEnableAccidentsModule()) { 038 039 this.bind(AccidentsContext.class).in( Singleton.class ) ; 040 041 this.bind(AnalysisEventHandler.class).in( Singleton.class ) ; 042 this.addEventHandlerBinding().to(AnalysisEventHandler.class) ; 043 044 this.addControlerListenerBinding().to(AccidentControlerListener.class); 045 } 046 047 } 048 049} 050