Issue #1445 fix time range for accumulations

Former-commit-id: e7db0f009c [formerly 144ddacb07] [formerly bb557546bf [formerly 590d927da3f051ed033c41bc0c89108a25826759]]
Former-commit-id: bb557546bf
Former-commit-id: 403381dde1
This commit is contained in:
Ben Steffensmeier 2012-12-19 15:13:45 -06:00
parent a608ba1a88
commit 2a2f226b92

View file

@ -93,6 +93,9 @@ public class TimeRangeLevelNode extends AbstractAliasLevelNode {
Set<AbstractRequestableData> records = new HashSet<AbstractRequestableData>(); Set<AbstractRequestableData> records = new HashSet<AbstractRequestableData>();
for (TimeAndSpace ast : availability) { for (TimeAndSpace ast : availability) {
Set<TimeAndSpace> needed = calculateNeededAvailability(ast); Set<TimeAndSpace> needed = calculateNeededAvailability(ast);
if (needed.isEmpty()) {
continue;
}
Map<TimeAndSpace, MatchResult> matched = matcher.match(needed, Map<TimeAndSpace, MatchResult> matched = matcher.match(needed,
dataMap.keySet()); dataMap.keySet());
if (TimeAndSpaceMatcher.getAll1(matched).containsAll(needed)) { if (TimeAndSpaceMatcher.getAll1(matched).containsAll(needed)) {
@ -123,12 +126,13 @@ public class TimeRangeLevelNode extends AbstractAliasLevelNode {
Set<TimeAndSpace> goodAvail = new HashSet<TimeAndSpace>(); Set<TimeAndSpace> goodAvail = new HashSet<TimeAndSpace>();
for (TimeAndSpace ast : allAvail) { for (TimeAndSpace ast : allAvail) {
Set<TimeAndSpace> needed = calculateNeededAvailability(ast); Set<TimeAndSpace> needed = calculateNeededAvailability(ast);
Set<TimeAndSpace> matchedNeeded = TimeAndSpaceMatcher if (!needed.isEmpty()) {
.getAll1(matcher.match(needed, allAvail)); Set<TimeAndSpace> matchedNeeded = TimeAndSpaceMatcher
if (matchedNeeded.containsAll(needed)) { .getAll1(matcher.match(needed, allAvail));
goodAvail.add(ast); if (matchedNeeded.containsAll(needed)) {
goodAvail.add(ast);
}
} }
} }
return goodAvail; return goodAvail;
} }
@ -139,14 +143,10 @@ public class TimeRangeLevelNode extends AbstractAliasLevelNode {
AvailabilityContainer availabilityContainer) { AvailabilityContainer availabilityContainer) {
TimeAndSpaceMatcher matcher = new TimeAndSpaceMatcher(); TimeAndSpaceMatcher matcher = new TimeAndSpaceMatcher();
matcher.setIgnoreRange(true); matcher.setIgnoreRange(true);
Set<TimeAndSpace> sourceAvailability = new HashSet<TimeAndSpace>( Set<TimeAndSpace> sourceAvailability = new HashSet<TimeAndSpace>();
availability);
for (TimeAndSpace ast : availability) { for (TimeAndSpace ast : availability) {
Set<TimeAndSpace> needed = calculateNeededAvailability(ast); Set<TimeAndSpace> needed = calculateNeededAvailability(ast);
Set<TimeAndSpace> matchedAvail = TimeAndSpaceMatcher sourceAvailability.addAll(needed);
.getAll1(matcher.match(needed, availability));
sourceAvailability.addAll(matchedAvail);
} }
Map<AbstractRequestableNode, Set<TimeAndSpace>> result = new HashMap<AbstractRequestableNode, Set<TimeAndSpace>>(); Map<AbstractRequestableNode, Set<TimeAndSpace>> result = new HashMap<AbstractRequestableNode, Set<TimeAndSpace>>();
result.put(sourceNode, sourceAvailability); result.put(sourceNode, sourceAvailability);