Merge pull request #112 from PaulLuchyn/master
Fixed bug with GC overhead
This commit is contained in:
commit
e13b31248c
4 changed files with 49 additions and 18 deletions
|
|
@ -231,6 +231,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
|
||||||
new DateTime(new GregorianCalendar(minimumYear, MINIMUM_MONTH, MINIMUM_DAY).getTime());
|
new DateTime(new GregorianCalendar(minimumYear, MINIMUM_MONTH, MINIMUM_DAY).getTime());
|
||||||
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yy");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yy");
|
||||||
|
|
||||||
// Need to call dateFormat.set2DigitYearStart to force parser not to parse date to previous century
|
// Need to call dateFormat.set2DigitYearStart to force parser not to parse date to previous century
|
||||||
simpleDateFormat.set2DigitYearStart(
|
simpleDateFormat.set2DigitYearStart(
|
||||||
new GregorianCalendar(CALENDAR_START_YEAR, MINIMUM_MONTH, MINIMUM_DAY).getTime());
|
new GregorianCalendar(CALENDAR_START_YEAR, MINIMUM_MONTH, MINIMUM_DAY).getTime());
|
||||||
|
|
@ -250,6 +251,7 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
|
||||||
DateTime correct = new DateTime(value);
|
DateTime correct = new DateTime(value);
|
||||||
String year = Integer.valueOf(correct.getYear()).toString().substring(2);
|
String year = Integer.valueOf(correct.getYear()).toString().substring(2);
|
||||||
|
|
||||||
|
// TODO Resolve deprecated methods
|
||||||
date = simpleDateFormat
|
date = simpleDateFormat
|
||||||
.parse(((Date) value).getMonth() + "/" + ((Date) value).getDate() + "/" + year);
|
.parse(((Date) value).getMonth() + "/" + ((Date) value).getDate() + "/" + year);
|
||||||
|
|
||||||
|
|
@ -260,7 +262,8 @@ public class LeftTasksTreeRow extends GenericForwardComposer {
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
date = simpleDateFormat.parse((String) value);
|
date = simpleDateFormat.parse((String) value);
|
||||||
} catch (ParseException ignored) {}
|
} catch (ParseException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime dateTimeInTextbox = new DateTime(date);
|
DateTime dateTimeInTextbox = new DateTime(date);
|
||||||
|
|
|
||||||
|
|
@ -418,10 +418,22 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements ICritical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is designed for performing topological sorting of nodes.
|
||||||
|
* Topological sorting is used to make graph nodes not to be mixed, because
|
||||||
|
* parent and child nodes ({@link TaskPoint}) must be placed in the correct order.
|
||||||
|
* Also during topological sorting nodes are placed on appropriate levels.
|
||||||
|
* Topological sorting can be done using different algorithms, but here is used Khan's algorithm.
|
||||||
|
*/
|
||||||
class TopologicalSorter {
|
class TopologicalSorter {
|
||||||
|
|
||||||
private Map<TaskPoint, Integer> taskPointsByDepthCached = null;
|
private Map<TaskPoint, Integer> taskPointsByDepthCached = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to place each node on appropriate level.
|
||||||
|
*
|
||||||
|
* @return map of TaskPoints with appropriate levels
|
||||||
|
*/
|
||||||
private Map<TaskPoint, Integer> taskPointsByDepth() {
|
private Map<TaskPoint, Integer> taskPointsByDepth() {
|
||||||
if ( taskPointsByDepthCached != null ) {
|
if ( taskPointsByDepthCached != null ) {
|
||||||
return taskPointsByDepthCached;
|
return taskPointsByDepthCached;
|
||||||
|
|
@ -430,27 +442,47 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements ICritical
|
||||||
Map<TaskPoint, Integer> result = new HashMap<>();
|
Map<TaskPoint, Integer> result = new HashMap<>();
|
||||||
Map<TaskPoint, Set<TaskPoint>> visitedBy = new HashMap<>();
|
Map<TaskPoint, Set<TaskPoint>> visitedBy = new HashMap<>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Here are stored taskpoints that we have visited.
|
||||||
|
* This need to be done because we need to check have we visited this taskpoint, or not.
|
||||||
|
* Described above need to be done to avoid loop between taskpoints.
|
||||||
|
*/
|
||||||
|
Set<TaskPoint> visitedTaskPoints = new HashSet ();
|
||||||
|
|
||||||
Queue<TaskPoint> withoutIncoming = getInitial(withoutVisibleIncomingDependencies(getTopLevelTasks()));
|
Queue<TaskPoint> withoutIncoming = getInitial(withoutVisibleIncomingDependencies(getTopLevelTasks()));
|
||||||
for (TaskPoint each : withoutIncoming) {
|
for (TaskPoint each : withoutIncoming) {
|
||||||
initializeIfNeededForKey(result, each, 0);
|
initializeIfNeededForKey(result, each, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!withoutIncoming.isEmpty()) {
|
while (!withoutIncoming.isEmpty()) {
|
||||||
|
|
||||||
TaskPoint current = withoutIncoming.poll();
|
TaskPoint current = withoutIncoming.poll();
|
||||||
|
|
||||||
|
visitedTaskPoints.add(current); // Marking taskpoint as visited
|
||||||
|
|
||||||
|
// Taking all child elements
|
||||||
for (TaskPoint each : current.getImmediateSuccessors()) {
|
for (TaskPoint each : current.getImmediateSuccessors()) {
|
||||||
|
|
||||||
initializeIfNeededForKey(visitedBy, each, new HashSet<TaskPoint>());
|
if (!visitedTaskPoints.contains(each)) {
|
||||||
Set<TaskPoint> visitors = visitedBy.get(each);
|
|
||||||
visitors.add(current);
|
|
||||||
Set<TaskPoint> predecessorsRequired = each.getImmediatePredecessors();
|
|
||||||
|
|
||||||
if ( visitors.containsAll(predecessorsRequired) ) {
|
initializeIfNeededForKey(visitedBy, each, new HashSet<TaskPoint>());
|
||||||
initializeIfNeededForKey(result, each, result.get(current) + 1);
|
|
||||||
withoutIncoming.offer(each);
|
Set<TaskPoint> visitors = visitedBy.get(each);
|
||||||
|
visitors.add(current);
|
||||||
|
|
||||||
|
// Taking parent elements
|
||||||
|
Set<TaskPoint> predecessorsRequired = each.getImmediatePredecessors();
|
||||||
|
|
||||||
|
if ( visitors.containsAll(predecessorsRequired) ) {
|
||||||
|
|
||||||
|
initializeIfNeededForKey(result, each, result.get(current) + 1);
|
||||||
|
|
||||||
|
withoutIncoming.offer(each);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return taskPointsByDepthCached = Collections.unmodifiableMap(result);
|
return taskPointsByDepthCached = Collections.unmodifiableMap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -497,10 +497,6 @@ public abstract class Task implements ITaskFundamentalProperties {
|
||||||
return LocalDate.fromDateFields(getBeginDate().toDayRoundedDate());
|
return LocalDate.fromDateFields(getBeginDate().toDayRoundedDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getEndDateAsLocalDate() {
|
|
||||||
return LocalDate.fromDateFields(getEndDate().toDayRoundedDate());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isManualAnyAllocation() {
|
public boolean isManualAnyAllocation() {
|
||||||
return fundamentalProperties.isManualAnyAllocation();
|
return fundamentalProperties.isManualAnyAllocation();
|
||||||
|
|
|
||||||
|
|
@ -246,17 +246,17 @@ msgstr ""
|
||||||
msgid "Show critical path"
|
msgid "Show critical path"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:240
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:271
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:247
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:278
|
||||||
msgid "The date you entered is invalid"
|
msgid "The date you entered is invalid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:241
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:272
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:248
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:279
|
||||||
msgid "Please enter date not before"
|
msgid "Please enter date not before"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:242
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:273
|
||||||
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:249
|
#: ganttzk/src/main/java/org/zkoss/ganttz/LeftTasksTreeRow.java:280
|
||||||
msgid "and no later than"
|
msgid "and no later than"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
Loading…
Add table
Reference in a new issue