From: Stefan F. <ste...@us...> - 2011-08-17 05:27:37
|
rails/algorithms/NetworkVertex.java | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) New commits: commit 1c25df567ee6d094b10b6026cbb924931733f622 Author: Stefan Frey <ste...@we...> Date: Wed Aug 17 06:47:24 2011 +0200 NetworkVertex uses new functions in Stop class diff --git a/rails/algorithms/NetworkVertex.java b/rails/algorithms/NetworkVertex.java index 05ae58c..cbe5394 100644 --- a/rails/algorithms/NetworkVertex.java +++ b/rails/algorithms/NetworkVertex.java @@ -226,33 +226,23 @@ public final class NetworkVertex implements Comparable<NetworkVertex> { log.info("Init of vertex " + this); // check if it has to be removed because it is run-to only - if (company != null) { // if company == null, then no vertex gets removed - if (hex.isRunToAllowed() == Stop.RunTo.NO || hex.isRunToAllowed() == Stop.RunTo.TOKENONLY && !city.hasTokenOf(company)) - { + // if company == null, then no vertex gets removed + if (company != null && !city.isRunToAllowedFor(company)) { return false; - } } // check if it is a major or minor - if (station.getType().equals(Station.CITY) || station.getType().equals(Station.OFF_MAP_AREA)) { + if (city.getScoreType() == Stop.Score.MAJOR) { setStationType(StationType.MAJOR); - } else if (station.getType().equals(Station.TOWN) || station.getType().equals(Station.PORT) - || station.getType().equals(Station.HALT)) { + } else if (city.getScoreType() == Stop.Score.MINOR) { setStationType(StationType.MINOR); } // check if it is a sink if (company == null) { // if company == null, then all sinks are deactivated sink = false; - } else if (station.getType().equals(Station.OFF_MAP_AREA) || ( - // or station is city - station.getType().equals(Station.CITY) - // and is either fully tokened and has token slots or only tokens allow run through - && ( city.getSlots() != 0 && !city.hasTokenSlotsLeft() || hex.isRunThroughAllowed() == Stop.RunThrough.TOKENONLY) - // and city does not have a token - && !city.hasTokenOf(company)) - ) { - sink = true; + } else { + sink = !city.isRunThroughAllowedFor(company); } // define locationName @@ -278,11 +268,7 @@ public final class NetworkVertex implements Comparable<NetworkVertex> { if (virtual || type == VertexType.SIDE) return; // define value - if (hex.hasValuesPerPhase()) { - value = hex.getCurrentValueForPhase(phase); - } else { - value = station.getValue(); - } + value = city.getValueForPhase(phase); } |