Commit 6ccf7ee500da92b158eee91faec605b74be0b59b

Authored by [mandjemb]
1 parent 2e8fbd04

cycle

Showing 1 changed file with 17 additions and 1 deletions   Show diff stats
src/kernel/function/Function.java
... ... @@ -4,6 +4,7 @@ import kernel.Cell;
4 4 import kernel.Formula;
5 5  
6 6 import java.util.ArrayList;
  7 +import java.util.Iterator;
7 8  
8 9 abstract public class Function extends Formula {
9 10  
... ... @@ -16,6 +17,21 @@ abstract public class Function extends Formula {
16 17 abstract public Double eval();
17 18  
18 19 public Boolean createCycle(Cell cell) {
19   - return this.listCells.contains(cell);
  20 +
  21 + boolean cycle=false;
  22 + if (!this.listCells.contains(cell)){
  23 + Iterator<Cell> it=listCells.iterator();
  24 + while (it.hasNext() &&!cycle){
  25 + if (it.next().containFormula()){
  26 + cycle=it.next().getFormula().createCycle(cell);
  27 + }
  28 + }
  29 + return cycle;
  30 +
  31 + }
  32 + else
  33 + return true;
  34 +
  35 +
20 36 }
21 37 }
... ...