public class AssertableCell extends CellExtension
Constructor and Description |
---|
AssertableCell(Cell cell)
Creates a assertable cell extension for the given cell.
|
Modifier and Type | Method and Description |
---|---|
void |
addAssertableCellListener(AssertableCellListener listener)
Registers the given listener on the cell.
|
Assertion.Result |
assertAny()
Asserts the current value of the cell using any (or both) assertion(s) associated with the cell.
|
Assertion.Result |
assertAny(Value value)
Asserts the specified value using any (or both) assertion(s) associated with the cell.
|
Assertion.ComparisonResult |
assertAssertions()
Checks wether the assertions associated with the cell agree with each other and
that no division by zero can occur using values within this assertion.
|
Assertion.Result |
assertSG()
Asserts the current value of the cell using the system generated assertion associated with the cell.
|
Assertion.Result |
assertSG(Value value)
Asserts the specified value using the system generated assertion associated with the cell.
|
Assertion.Result |
assertUS()
Asserts the current value of the cell using the user supplied assertion associated with the cell.
|
Assertion.Result |
assertUS(Value value)
Asserts the specified value using the user supplied assertion associated with the cell.
|
void |
contentChanged(Cell cell)
Invoked when the content of a cell has been changed.
|
protected void |
fireAssertionsChanged()
Notifies all registered listeners that the cell's assertions changed.
|
void |
generateAssertion()
Invoked to indicate that the content of the cell in the spreadsheet was
modified and that assertions that depend on that data must be updated.
|
Assertion |
getPriorityAssertion()
Get the most significant assertion of the cell.
|
SGAssertion |
getSGAssertion()
Get the cell's system generated assertion.
|
USAssertion |
getUSAssertion()
Get the cell's user supplied assertion.
|
boolean |
hasAssertionError()
Checks wether there are any errors or inconsitencies in the cell related
to assertions.
|
boolean |
isAsserted()
Returns whether the cell has an assertion.
|
boolean |
isSGAsserted()
Checks if the cell has a system generated assertion associated with it.
|
boolean |
isUSAsserted()
Checks if the cell has a user supplied assertion associated with it.
|
void |
removeAssertableCellListener(AssertableCellListener listener)
Removes the given listener from the cell.
|
void |
setUSAssertion(USAssertion assertion)
Sets the user-specified assertion for the cell.
|
addCellListener, cellCleared, cellCopied, clear, compareTo, copyFrom, dependentsChanged, getAddress, getCellListeners, getContent, getDelegate, getDependents, getExtension, getFormula, getName, getPrecedents, getSpreadsheet, getValue, moveFrom, removeCellListener, setContent, toString, valueChanged
AssertableCell(Cell cell)
cell
- the cell to extendpublic void contentChanged(Cell cell)
CellListener
contentChanged
in interface CellListener
contentChanged
in class CellExtension
cell
- the cell that was modifiedpublic USAssertion getUSAssertion()
null
if no user
supplied assertion exists.public SGAssertion getSGAssertion()
null
if no
system generated assertion exist.public Assertion getPriorityAssertion()
null
otherwise.public boolean isAsserted()
public boolean isUSAsserted()
true
if the cell has a user supplied assertion associated with it, false
otherwise.public boolean isSGAsserted()
true
if the cell has a system generated assertion associated with it, false
otherwise.public void setUSAssertion(USAssertion assertion)
assertion
- the user-specified assertionpublic void generateAssertion()
public Assertion.Result assertUS()
Assertion.Result.OK
is returned.Assertion.validate(Value)
public Assertion.Result assertUS(Value value)
Assertion.Result.OK
is returned.Assertion.validate(Value)
public Assertion.Result assertSG()
Assertion.Result.OK
is returned.Assertion.validate(Value)
public Assertion.Result assertSG(Value value)
Assertion.Result.OK
is returned.Assertion.validate(Value)
public Assertion.Result assertAny(Value value)
Assertion.Result.OK
will be returned.Assertion.validate(Value)
public Assertion.Result assertAny()
Assertion.Result.OK
will be returned.Assertion.validate(Value)
public Assertion.ComparisonResult assertAssertions()
Assertion.ComparisonResult.OK
if both the SGA and USA are specified for the cell and are equal or
if none or only one of them is specified, AND the system generated assertion did not fail to
generate because it would include a division by zero error.
Assertion.ComparisonResult.NON_EQUAL
if the SGA and USA are both specified and do not agree with each other.
Assertion.ComparisonResult.DIV_BY_ZERO
if the SGA failed to be generated because it would lead to
a division by zero error, either because of errenous assertions in precedents or an errenous
formula in the cell.
public boolean hasAssertionError()
false
if there are no errors that can be found in the cell using
assertion related functions, true
otherwise.public void addAssertableCellListener(AssertableCellListener listener)
listener
- the listener to be addedpublic void removeAssertableCellListener(AssertableCellListener listener)
listener
- the listener to be removedprotected void fireAssertionsChanged()