use of net.parostroj.timetable.model.FreightConnectionFilter.FilterResult in project grafikon by jub77.
the class BaseConnectionStrategy method getFreightToNodesImpl.
private void getFreightToNodesImpl(Node start, TimeInterval fromInterval, List<TrainConnection> path, List<FreightConnectionPath> result, Set<FNConnection> used, FreightConnectionFilter filter, FilterContext context) {
FilterResult filterResult;
Iterator<TimeInterval> intervals = fromInterval.getTrain().iterator();
Iterators.find(intervals, interval -> interval == fromInterval);
intervals = Iterators.filter(intervals, interval -> interval.isNodeOwner() && (interval.isFreightTo() || interval.isFreightConnection()));
while (intervals.hasNext()) {
TimeInterval i = intervals.next();
if (i.isFreight()) {
FreightConnectionPath newDst = FreightFactory.createFreightNodeConnection(start, i.getOwnerAsNode(), i.isRegionCenterTransfer(), createNewPath(path, fromInterval, i));
filterResult = filter.accepted(context, newDst, 0);
if (filterResult == FilterResult.STOP_EXCLUDE) {
break;
}
if (filterResult != FilterResult.IGNORE) {
result.add(newDst);
}
if (filterResult == FilterResult.STOP_INCLUDE) {
break;
}
}
for (FNConnection conn : freightNet.getTrainsFrom(i)) {
if (!used.contains(conn)) {
used.add(conn);
List<TrainConnection> newPath = createNewPath(path, fromInterval, conn.getFrom());
this.getFreightToNodesImpl(start, conn.getTo(), newPath, result, used, conn.getFreightDstFilter(filter, false), context);
}
}
}
}
Aggregations