Skip to content

Commit 5af4e93

Browse files
committed
created a TimerPeriods class to keep track of a bunch of time periods and calculate whether a given date is within any of the time periods.
1 parent afdc939 commit 5af4e93

File tree

2 files changed

+334
-58
lines changed

2 files changed

+334
-58
lines changed

src/org/argmap/client/ModeVersions.java

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.util.List;
99
import java.util.Map;
1010

11-
import org.apache.tools.ant.types.Commandline.Marker;
1211
import org.argmap.client.ArgMapService.NodeChangesMaps;
1312
import org.argmap.client.ArgMapService.NodeChangesMapsAndRootChanges;
1413
import org.argmap.client.ArgMapService.NodeWithChanges;
@@ -500,63 +499,6 @@ private void loadChangesIntoNodeAndMap(ViewNodeVer viewNode,
500499
}
501500
}
502501

503-
private class TimePeriods {
504-
/*
505-
* maybe using markers is simpler after all. simply walk down the line
506-
* until newStart > currentMarker. Insert newStart before currentMarker.
507-
*
508-
* Then walk down line until newEnd > currentMarker. If newEnd <
509-
* currentMarker delete current marker. if newEnd > currentMarker and
510-
* currentMarker is and 'end' don't do anything else. If newEnd >
511-
* currentMarker and currentmarker is a 'start' insert newEnd before
512-
* currentMarker. Done.
513-
*
514-
* to test for inclusion walk down line until test > currentMarker. If
515-
* current marker is start return true; else return false.
516-
*
517-
* to copy, make markers immutable and simply copy the list.
518-
*/
519-
520-
private class Period {
521-
public Period(Date start, Date end) {
522-
this.start = start;
523-
this.end = end;
524-
}
525-
526-
public Date start;
527-
public Date end;
528-
}
529-
530-
private List<Period> periods = new ArrayList<Period>();
531-
532-
public void addPeriod(Date start, Date end) {
533-
for (int i = 0; i < periods.size(); i++) {
534-
if (start.after(periods.get(i).start)) {
535-
Period current = periods.get(i);
536-
Period previous = periods.get(i -1);
537-
if (start.before(previous.end)) {
538-
//this means new period overlaps with latter part of previous
539-
540-
if( end.before(previous.end)){
541-
//this means entire period is contained within previous
542-
//period and nothing needs to be done
543-
} else if (end.after(current.start))
544-
} else {
545-
//this means that new period overlaps with no part of previous period
546-
}
547-
}
548-
}
549-
}
550-
551-
public boolean inPeriod(Date date) {
552-
return false;
553-
}
554-
555-
public TimePeriods copy() {
556-
return null;
557-
}
558-
}
559-
560502
public void recursiveHideLinkedSubtreesDuringUnlinkedPeriods(
561503
ViewNodeVer viewPNodeVer, List list) {
562504
// hide all changes of this node that occur within a period in list

0 commit comments

Comments
 (0)