PR1-Spreadsheet/Axel/src/de/hs_mannheim/informatik/spreadsheet/Cell.java

39 lines
885 B
Java
Raw Normal View History

2023-12-12 15:00:07 +01:00
package de.hs_mannheim.informatik.spreadsheet;
/**
* Part of a simplified spreadsheet system for the PR1 programming lab at Hochschule Mannheim.
* A cell needs to be able to hold a formula and a value
*
* @author Oliver Hummel
*/
public class Cell {
private String formula = "";
private String value = "";
public String getFormula() {
return formula;
}
public void setFormula(String formula) {
if (!formula.isEmpty())
this.formula = formula.toUpperCase().substring(1); // removes '=' at the beginning
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String toString() {
return String.format("%4s", value);
}
public boolean isEmpty() {
return value.isEmpty();
}
}