From 6ccf7ee500da92b158eee91faec605b74be0b59b Mon Sep 17 00:00:00 2001 From: [mandjemb] Date: Tue, 11 Jun 2019 08:55:27 +0200 Subject: [PATCH] cycle --- src/kernel/function/Function.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/kernel/function/Function.java b/src/kernel/function/Function.java index cf1c27a..cb84d97 100644 --- a/src/kernel/function/Function.java +++ b/src/kernel/function/Function.java @@ -4,6 +4,7 @@ import kernel.Cell; import kernel.Formula; import java.util.ArrayList; +import java.util.Iterator; abstract public class Function extends Formula { @@ -16,6 +17,21 @@ abstract public class Function extends Formula { abstract public Double eval(); public Boolean createCycle(Cell cell) { - return this.listCells.contains(cell); + + boolean cycle=false; + if (!this.listCells.contains(cell)){ + Iterator it=listCells.iterator(); + while (it.hasNext() &&!cycle){ + if (it.next().containFormula()){ + cycle=it.next().getFormula().createCycle(cell); + } + } + return cycle; + + } + else + return true; + + } } -- libgit2 0.21.2