Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyaDaleh committed Jul 7, 2023
1 parent b7f116f commit 59ab87e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private void processNewItems(List<ChartItemInterface> newItems,
newItemsDeductedFrom.add(chart.indexOf(itemToCheck));
}
Collections.sort(newItemsDeductedFrom);
if (triggerItems.containsAll(newItems)) {
if (new HashSet<>(triggerItems).containsAll(newItems)) {
log.info("Stopped tree update, because all items triggered an update on "
+ "themselves.");
return;
Expand All @@ -396,6 +396,8 @@ private void processNewItems(List<ChartItemInterface> newItems,
if (chart.contains(newItem)) {
int oldId = chart.indexOf(newItem);
List<Tree> oldTrees = new LinkedList<>(chart.get(oldId).getTrees());
Double oldValue;
Double newValue;
switch (replace) {
case '-':
if (!deductedFrom.get(oldId).contains(newItemsDeductedFrom)) {
Expand All @@ -405,9 +407,9 @@ private void processNewItems(List<ChartItemInterface> newItems,
addNewTrees(chart.get(oldId), newItem);
break;
case 'h':
Double oldValue = ((ProbabilisticChartItemInterface) chart.get(oldId))
oldValue = ((ProbabilisticChartItemInterface) chart.get(oldId))
.getProbability();
Double newValue =
newValue =
((ProbabilisticChartItemInterface) newItem).getProbability();
if (newValue > oldValue) {
chart.set(oldId, newItem);
Expand Down

0 comments on commit 59ab87e

Please sign in to comment.