MATSIM
AStarEuclideanFactory.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * AStarLandmarksFactory
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package org.matsim.core.router;
21 
22 import java.util.HashMap;
23 import java.util.Map;
24 
31 
36 
37  private final Map<Network, PreProcessEuclidean> preProcessData = new HashMap<>();
38  private final double overdoFactor;
39 
41  this(1);
42  }
43 
44  public AStarEuclideanFactory(double overdoFactor) {
45  this.overdoFactor = overdoFactor;
46  }
47 
48  @Override
49  public synchronized LeastCostPathCalculator createPathCalculator(final Network network,
50  final TravelDisutility travelCosts, final TravelTime travelTimes) {
51  PreProcessEuclidean preProcessEuclidean = this.preProcessData.get(network);
52  if (preProcessEuclidean == null) {
53  preProcessEuclidean = new PreProcessEuclidean(travelCosts);
54  preProcessEuclidean.run(network);
55  this.preProcessData.put(network, preProcessEuclidean);
56  }
57 
58  return new AStarEuclidean(network, preProcessEuclidean, travelCosts, travelTimes, overdoFactor);
59  }
60 }
final Map< Network, PreProcessEuclidean > preProcessData
synchronized LeastCostPathCalculator createPathCalculator(final Network network, final TravelDisutility travelCosts, final TravelTime travelTimes)