39 lines
885 B
Java
39 lines
885 B
Java
|
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();
|
||
|
}
|
||
|
|
||
|
}
|