Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use LMProfile instead of just Weighting for LMPreparationHandler (#1899)
- Loading branch information
Showing
16 changed files
with
176 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
core/src/main/java/com/graphhopper/routing/lm/LMProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to GraphHopper GmbH under one or more contributor | ||
* license agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
* | ||
* GraphHopper GmbH licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.graphhopper.routing.lm; | ||
|
||
import com.graphhopper.routing.weighting.AbstractWeighting; | ||
import com.graphhopper.routing.weighting.Weighting; | ||
|
||
import java.util.Objects; | ||
|
||
public class LMProfile { | ||
private final String profileName; | ||
private final Weighting weighting; | ||
|
||
public LMProfile(Weighting weighting) { | ||
this(AbstractWeighting.weightingToFileName(weighting), weighting); | ||
} | ||
|
||
public LMProfile(String profileName, Weighting weighting) { | ||
this.profileName = profileName; | ||
this.weighting = weighting; | ||
} | ||
|
||
public String getName() { | ||
return profileName; | ||
} | ||
|
||
public Weighting getWeighting() { | ||
return weighting; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return profileName; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
LMProfile lmProfile = (LMProfile) o; | ||
return Objects.equals(profileName, lmProfile.profileName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return profileName.hashCode(); | ||
} | ||
} |
Oops, something went wrong.