unhookOldEnvironments(evaluators);
hookNewEnvironment(evaluators, this);
_unhooked = false;
- _evaluators = evaluators;
+ _evaluators = evaluators.clone();
_evaluatorsByName = evaluatorsByName;
}
private final int _encodedTokenLen;
private Formula(byte[] byteEncoding, int encodedTokenLen) {
- _byteEncoding = byteEncoding;
+ _byteEncoding = byteEncoding.clone();
_encodedTokenLen = encodedTokenLen;
// if (false) { // set to true to eagerly check Ptg decoding
// LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
/**
* Stores the cached result of a formula evaluation, along with the set of sensitive input cells
- *
- * @author Josh Micich
*/
final class FormulaCellCacheEntry extends CellCacheEntry {
public void setSensitiveInputCells(CellCacheEntry[] sensitiveInputCells) {
// need to tell all cells that were previously used, but no longer are,
// that they are not consumed by this cell any more
- changeConsumingCells(sensitiveInputCells == null ? CellCacheEntry.EMPTY_ARRAY : sensitiveInputCells);
- _sensitiveInputCells = sensitiveInputCells;
+ if (sensitiveInputCells == null) {
+ _sensitiveInputCells = null;
+ changeConsumingCells(CellCacheEntry.EMPTY_ARRAY);
+ } else {
+ _sensitiveInputCells = sensitiveInputCells.clone();
+ changeConsumingCells(_sensitiveInputCells);
+ }
}
public void clearFormulaEntry() {
* Represents a syntactic element from a formula by encapsulating the corresponding <tt>Ptg</tt>
* token. Each <tt>ParseNode</tt> may have child <tt>ParseNode</tt>s in the case when the wrapped
* <tt>Ptg</tt> is non-atomic.
- *
- * @author Josh Micich
*/
final class ParseNode {
throw new IllegalArgumentException("token must not be null");
}
_token = token;
- _children = children;
+ _children = children.clone();
_isIf = isIf(token);
int tokenCount = 1;
for (int i = 0; i < children.length; i++) {