Model initial draft

This commit is contained in:
Imbus 2024-06-03 19:31:45 +02:00
parent 81e22d094b
commit a56a3be9ef
2 changed files with 5 additions and 5 deletions

View file

@ -12,11 +12,11 @@ public class BombCell implements Cell {
public BombCell() {} public BombCell() {}
public double cellValue(Environment e) { public double cellValue(Environment e) {
throw XLException.RECURSIVECELL_ERROR; throw XLException.ERROR_RECURSIVE;
} }
public String displayValue() { public String displayValue() {
throw XLException.RECURSIVECELL_ERROR; throw XLException.ERROR_RECURSIVE;
} }
} }

View file

@ -150,7 +150,7 @@ public class XLModel extends Observable implements Environment {
} }
} }
} catch (IOException e) { } catch (IOException e) {
throw XLException.CREATECELL_ERROR; throw XLException.ERROR_CREATECELL;
} }
} }
} }
@ -186,13 +186,13 @@ public class XLModel extends Observable implements Environment {
public double value(String name) { public double value(String name) {
// Check if the cell is referencing itself // Check if the cell is referencing itself
if (currentAddress.equals(name)) { if (currentAddress.equals(name)) {
throw XLException.RECURSIVECELL_ERROR; throw XLException.ERROR_RECURSIVE;
} }
// Check if the cell is empty // Check if the cell is empty
if (map.containsKey(name)) { if (map.containsKey(name)) {
return map.get(name).cellValue(this); return map.get(name).cellValue(this);
} else { } else {
throw XLException.EMPTY_ERROR; throw XLException.ERROR_EMPTY_REF;
} }
} }