Blame view

src/kernel/function/Function.java 794 Bytes
2e8fbd04   Remi   global refactor
1
2
3
4
5
6
  package kernel.function;
  
  import kernel.Cell;
  import kernel.Formula;
  
  import java.util.ArrayList;
6ccf7ee5   [mandjemb]   cycle
7
  import java.util.Iterator;
2e8fbd04   Remi   global refactor
8
9
10
11
12
13
14
15
16
17
18
19
  
  abstract public class Function extends Formula {
  
      protected ArrayList<Cell> listCells = new ArrayList<>();
  
      abstract public String getDevelopedFormula();
  
      abstract public String toString();
  
      abstract public Double eval();
  
      public Boolean createCycle(Cell cell) {
6ccf7ee5   [mandjemb]   cycle
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
   
      	boolean cycle=false;
          if (!this.listCells.contains(cell)){
          	Iterator<Cell> it=listCells.iterator();
          	while (it.hasNext() &&!cycle){
          		if (it.next().containFormula()){
          			cycle=it.next().getFormula().createCycle(cell);
          		}
          	}
          	return cycle;
          	
          }
          else
          	return true;
      	
      	
2e8fbd04   Remi   global refactor
36
37
      }
  }