public BaseRef(AreaEval ae) { _refEval = null; _areaEval = ae; _firstRowIndex = ae.getFirstRow(); _firstColumnIndex = ae.getFirstColumn(); _height = ae.getLastRow() - ae.getFirstRow() + 1; _width = ae.getLastColumn() - ae.getFirstColumn() + 1; }
/** * @return simple rectangular {@link AreaEval} which fully encloses both areas * <tt>aeA</tt> and <tt>aeB</tt> */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int top = Math.min(aeAfr, aeB.getFirstRow()); int bottom = Math.max(aeA.getLastRow(), aeB.getLastRow()); int left = Math.min(aeAfc, aeB.getFirstColumn()); int right = Math.max(aeA.getLastColumn(), aeB.getLastColumn()); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { int rnum; if (arg0 instanceof AreaEval) { rnum = ((AreaEval) arg0).getFirstRow(); } else if (arg0 instanceof RefEval) { rnum = ((RefEval) arg0).getRow(); } else { // anything else is not valid argument return ErrorEval.VALUE_INVALID; } return new NumberEval(rnum + 1); } public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
/** * @return simple rectangular {@link AreaEval} which represents the intersection of areas * <tt>aeA</tt> and <tt>aeB</tt>. If the two areas do not intersect, the result is <code>null</code>. */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int aeBlc = aeB.getLastColumn(); if (aeAfc > aeBlc) { return null; } int aeBfc = aeB.getFirstColumn(); if (aeBfc > aeA.getLastColumn()) { return null; } int aeBlr = aeB.getLastRow(); if (aeAfr > aeBlr) { return null; } int aeBfr = aeB.getFirstRow(); int aeAlr = aeA.getLastRow(); if (aeBfr > aeAlr) { return null; } int top = Math.max(aeAfr, aeBfr); int bottom = Math.min(aeAlr, aeBlr); int left = Math.max(aeAfc, aeBfc); int right = Math.min(aeA.getLastColumn(), aeBlc); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
/** * Resolve a ValueEval that's in an AreaEval. * * @param db AreaEval from which the cell to resolve is retrieved. * @param dbRow Relative row in the AreaEval. * @param dbCol Relative column in the AreaEval. * @return A ValueEval that is a NumberEval, StringEval, BoolEval, BlankEval or ErrorEval. */ private static ValueEval resolveReference(AreaEval db, int dbRow, int dbCol) { try { return OperandResolver.getSingleValue(db.getValue(dbRow, dbCol), db.getFirstRow()+dbRow, db.getFirstColumn()+dbCol); } catch (EvaluationException e) { return e.getErrorEval(); } } }
return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), ((AreaEval) arg0).getFirstRow() + height - 1, ((AreaEval) arg0).getFirstColumn() + width - 1, vals);
h1 = ae.getHeight(); a1FirstCol = ae.getFirstColumn(); a1FirstRow = ae.getFirstRow(); } else if (arg0 instanceof RefEval){ RefEval ref = (RefEval)arg0; h2 = ae.getHeight(); a2FirstCol = ae.getFirstColumn(); a2FirstRow = ae.getFirstRow(); } else if (arg1 instanceof RefEval){ RefEval ref = (RefEval)arg1;
return vals[0]; else { return new CacheAreaEval(((AreaEval) arg0).getFirstRow(), ((AreaEval) arg0).getFirstColumn(), ((AreaEval) arg0).getFirstRow() + height - 1, ((AreaEval) arg0).getFirstColumn() + width - 1, vals);
throw EvaluationException.invalidValue(); return ae.getAbsoluteValue(ae.getFirstRow(), srcCellCol);
public BaseRef(AreaEval ae) { _refEval = null; _areaEval = ae; _firstRowIndex = ae.getFirstRow(); _firstColumnIndex = ae.getFirstColumn(); _height = ae.getLastRow() - ae.getFirstRow() + 1; _width = ae.getLastColumn() - ae.getFirstColumn() + 1; }
public BaseRef(AreaEval ae) { _refEval = null; _areaEval = ae; _firstRowIndex = ae.getFirstRow(); _firstColumnIndex = ae.getFirstColumn(); _height = ae.getLastRow() - ae.getFirstRow() + 1; _width = ae.getLastColumn() - ae.getFirstColumn() + 1; }
public BaseRef(AreaEval ae) { _refEval = null; _areaEval = ae; _firstRowIndex = ae.getFirstRow(); _firstColumnIndex = ae.getFirstColumn(); _height = ae.getLastRow() - ae.getFirstRow() + 1; _width = ae.getLastColumn() - ae.getFirstColumn() + 1; }
/** * @return simple rectangular {@link AreaEval} which fully encloses both areas * <tt>aeA</tt> and <tt>aeB</tt> */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int top = Math.min(aeAfr, aeB.getFirstRow()); int bottom = Math.max(aeA.getLastRow(), aeB.getLastRow()); int left = Math.min(aeAfc, aeB.getFirstColumn()); int right = Math.max(aeA.getLastColumn(), aeB.getLastColumn()); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
/** * @return simple rectangular {@link AreaEval} which fully encloses both areas * <tt>aeA</tt> and <tt>aeB</tt> */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int top = Math.min(aeAfr, aeB.getFirstRow()); int bottom = Math.max(aeA.getLastRow(), aeB.getLastRow()); int left = Math.min(aeAfc, aeB.getFirstColumn()); int right = Math.max(aeA.getLastColumn(), aeB.getLastColumn()); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
/** * @return simple rectangular {@link AreaEval} which fully encloses both areas * <tt>aeA</tt> and <tt>aeB</tt> */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int top = Math.min(aeAfr, aeB.getFirstRow()); int bottom = Math.max(aeA.getLastRow(), aeB.getLastRow()); int left = Math.min(aeAfc, aeB.getFirstColumn()); int right = Math.max(aeA.getLastColumn(), aeB.getLastColumn()); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { int rnum; if (arg0 instanceof AreaEval) { rnum = ((AreaEval) arg0).getFirstRow(); } else if (arg0 instanceof RefEval) { rnum = ((RefEval) arg0).getRow(); } else { // anything else is not valid argument return ErrorEval.VALUE_INVALID; } return new NumberEval(rnum + 1); } public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { int rnum; if (arg0 instanceof AreaEval) { rnum = ((AreaEval) arg0).getFirstRow(); } else if (arg0 instanceof RefEval) { rnum = ((RefEval) arg0).getRow(); } else { // anything else is not valid argument return ErrorEval.VALUE_INVALID; } return new NumberEval(rnum + 1); } public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) { int rnum; if (arg0 instanceof AreaEval) { rnum = ((AreaEval) arg0).getFirstRow(); } else if (arg0 instanceof RefEval) { rnum = ((RefEval) arg0).getRow(); } else { // anything else is not valid argument return ErrorEval.VALUE_INVALID; } return new NumberEval(rnum + 1); } public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
/** * @return simple rectangular {@link AreaEval} which represents the intersection of areas * <tt>aeA</tt> and <tt>aeB</tt>. If the two areas do not intersect, the result is <code>null</code>. */ private static AreaEval resolveRange(AreaEval aeA, AreaEval aeB) { int aeAfr = aeA.getFirstRow(); int aeAfc = aeA.getFirstColumn(); int aeBlc = aeB.getLastColumn(); if (aeAfc > aeBlc) { return null; } int aeBfc = aeB.getFirstColumn(); if (aeBfc > aeA.getLastColumn()) { return null; } int aeBlr = aeB.getLastRow(); if (aeAfr > aeBlr) { return null; } int aeBfr = aeB.getFirstRow(); int aeAlr = aeA.getLastRow(); if (aeBfr > aeAlr) { return null; } int top = Math.max(aeAfr, aeBfr); int bottom = Math.min(aeAlr, aeBlr); int left = Math.max(aeAfc, aeBfc); int right = Math.min(aeA.getLastColumn(), aeBlc); return aeA.offset(top-aeAfr, bottom-aeAfr, left-aeAfc, right-aeAfc); }
/** * Resolve a ValueEval that's in an AreaEval. * * @param db AreaEval from which the cell to resolve is retrieved. * @param dbRow Relative row in the AreaEval. * @param dbCol Relative column in the AreaEval. * @return A ValueEval that is a NumberEval, StringEval, BoolEval, BlankEval or ErrorEval. */ private static ValueEval resolveReference(AreaEval db, int dbRow, int dbCol) { try { return OperandResolver.getSingleValue(db.getValue(dbRow, dbCol), db.getFirstRow()+dbRow, db.getFirstColumn()+dbCol); } catch (EvaluationException e) { return e.getErrorEval(); } } }