/** Get a PTG for an integer from its string representation.
* return Int or Number Ptg based on size of input
* @param number
- * @return
*/
private Ptg getNumberPtgFromString(String number) {
try {
/** Returns the ProtectRecord.
* If one is not contained in the sheet, then one is created.
- * @return
*/
public ProtectRecord getProtect()
{
*
* @param hssfShape
* @param shapeId
- * @return
*/
private EscherContainerRecord createSpContainer( HSSFSimpleShape hssfShape, int shapeId )
{
*
* @param hssfShape
* @param shapeId
- * @return
*/
private EscherContainerRecord createSpContainer( HSSFTextbox hssfShape, int shapeId )
{
* allow you to show the data of one sheet when another is seen "selected"
* in the tabs (at the bottom).
* @see org.apache.poi.hssf.usermodel.HSSFSheet#setSelected(boolean)
- * @return
*/
public short getSelectedTab() {
return workbook.getWindowOne().getSelectedTab();
/**
* sets the first tab that is displayed in the list of tabs
* in excel.
- * @return
*/
public short getDisplayedTab() {
return workbook.getWindowOne().getDisplayedTab();
* Creates the appropriate chunk at the given location.
* @param data
* @param offset
- * @return
*/
public Chunk createChunk(byte[] data, int offset) {
// Create the header
/**
* Fetch the rich text runs (runs of text with the same styling) that
* are contained within this block of text
- * @return
*/
public RichTextRun[] getRichTextRuns() {
return _rtRuns;
* Get the name of the font at the given ID, or null if there is
* no font at that ID.
* @param id
- * @return
*/
public String getFontWithId(int id) {
if(id >= fonts.size()) {
/**
* returns the 0-based index of the first row in
* this area.
- * @return
*/
public int getFirstRow();
/**
* returns the 0-based index of the last row in
* this area.
- * @return
*/
public int getLastRow();
/**
* returns the 0-based index of the first col in
* this area.
- * @return
*/
public short getFirstColumn();
/**
* returns the 0-based index of the last col in
* this area.
- * @return
*/
public short getLastColumn();
* returns true if the Area's start and end row indexes
* are same. This result of this method should agree
* with getFirstRow() == getLastRow().
- * @return
*/
public boolean isRow();
* returns true if the Area's start and end col indexes
* are same. This result of this method should agree
* with getFirstColumn() == getLastColumn().
- * @return
*/
public boolean isColumn();
* The array of values in this area. Although the area
* maybe 1D (ie. isRow() or isColumn() returns true) or 2D
* the returned array is 1D.
- * @return
*/
public ValueEval[] getValues();
* bre returned.
* @param row
* @param col
- * @return
*/
public ValueEval getValueAt(int row, short col);
* this area.
* @param row
* @param col
- * @return
*/
public boolean contains(int row, short col);
/**
* returns true if the specified col is in range
* @param col
- * @return
*/
public boolean containsColumn(short col);
/**
* returns true if the specified row is in range
* @param row
- * @return
*/
public boolean containsRow(int row);
}
* the RefEval representing
* A1 will return as the getInnerValueEval() the
* object of concrete type StringEval
- * @return
*/
public ValueEval getInnerValueEval();
/**
* returns the column index.
- * @return
*/
public short getColumn();
/**
* returns the row index.
- * @return
*/
public short getRow();
* B1 has the value "test", then the RefEval
* representing A1 will return isEvaluated()
* equal to true.
- * @return
*/
public boolean isEvaluated();
* @param eval
* @param srcRow
* @param srcCol
- * @return
*/
protected ValueEval singleOperandEvaluate(Eval eval, int srcRow, short srcCol) {
ValueEval retval;
* The params can be either NumberEval, BoolEval, StringEval, or
* RefEval
* @param eval
- * @return
*/
public ValueEval attemptXlateToNumeric(ValueEval eval) {
ValueEval retval = null;
* instance. If flag is set, a zero
* valued numbereval is returned, else BlankEval.INSTANCE
* is returned.
- * @return
*/
private ValueEval xlateBlankEval(int flag) {
return ((flags & flag) > 0)
/**
* uses the relevant flags to decode the supplied RefVal
* @param eval
- * @return
*/
private ValueEval xlateRefEval(RefEval reval) {
ValueEval retval = null;
/**
* uses the relevant flags to decode the StringEval
* @param eval
- * @return
*/
private ValueEval xlateStringEval(StringEval eval) {
ValueEval retval = null;
/**
* uses the relevant flags to decode the StringEval
* @param eval
- * @return
*/
private ValueEval xlateRefStringEval(StringEval eval) {
ValueEval retval = null;
* @param y pmt per period
* @param f future value
* @param t type (true=pmt at end of period, false=pmt at begining of period)
- * @return
*/
public static double fv(double r, double n, double y, double p, boolean t) {
double retval = 0;
* @param y
* @param f
* @param t
- * @return
*/
public static double pv(double r, double n, double y, double f, boolean t) {
double retval = 0;
* value should be negative.
* @param r
* @param cfs cashflow amounts
- * @return
*/
public static double npv(double r, double[] cfs) {
double npv = 0;
* @param p
* @param f
* @param t
- * @return
*/
public static double pmt(double r, double n, double p, double f, boolean t) {
double retval = 0;
* @param p
* @param f
* @param t
- * @return
*/
public static double nper(double r, double y, double p, double f, boolean t) {
double retval = 0;
* Note: AreaEvals are not handled, if arg is an AreaEval,
* the returned value is ErrorEval.VALUE_INVALID
* @param ve
- * @return
*/
protected ValueEval attemptXlateToText(ValueEval ve) {
ValueEval retval;
/**
* recursively evaluate any RefEvals
* @param reval
- * @return
*/
protected ValueEval xlateRefEval(RefEval reval) {
ValueEval retval = (ValueEval) reval.getInnerValueEval();
* <p>If n is NaN, returned value is NaN.
* @param n
* @param p
- * @return
*/
public static double round(double n, int p) {
double retval;
* <p>If n is NaN, returned value is NaN.
* @param n
* @param p
- * @return
*/
public static double roundUp(double n, int p) {
double retval;
* <p>If n is NaN, returned value is NaN.
* @param n
* @param p
- * @return
*/
public static double roundDown(double n, int p) {
double retval;
* <p> If d is NaN, then 1 will be returned. It is the responsibility
* of caller to check for d isNaN if some other value is desired.
* @param d
- * @return
*/
public static short sign(double d) {
return (short) ((d == 0)
/**
* average of all values
* @param values
- * @return
*/
public static double average(double[] values) {
double ave = 0;
/**
* sum of all values
* @param values
- * @return
*/
public static double sum(double[] values) {
double sum = 0;
/**
* sum of squares of all values
* @param values
- * @return
*/
public static double sumsq(double[] values) {
double sumsq = 0;
/**
* product of all values
* @param values
- * @return
*/
public static double product(double[] values) {
double product = 0;
* min of all values. If supplied array is zero length,
* Double.POSITIVE_INFINITY is returned.
* @param values
- * @return
*/
public static double min(double[] values) {
double min = Double.POSITIVE_INFINITY;
* min of all values. If supplied array is zero length,
* Double.NEGATIVE_INFINITY is returned.
* @param values
- * @return
*/
public static double max(double[] values) {
double max = Double.NEGATIVE_INFINITY;
* In all such cases, Double.NaN is returned.
* @param n
* @param s
- * @return
*/
public static double floor(double n, double s) {
double f;
* In all such cases, Double.NaN is returned.
* @param n
* @param s
- * @return
*/
public static double ceiling(double n, double s) {
double c;
* than Double.MAX_VALUE; Double.POSITIVE_INFINITY is returned.
* If n < 0, Double.NaN is returned.
* @param n
- * @return
*/
public static double factorial(int n) {
double d = 1;
* If d == 0, result is NaN
* @param n
* @param d
- * @return
*/
public static double mod(double n, double d) {
double result = 0;
/**
* inverse hyperbolic cosine
* @param d
- * @return
*/
public static double acosh(double d) {
return Math.log(Math.sqrt(Math.pow(d, 2) - 1) + d);
/**
* inverse hyperbolic sine
* @param d
- * @return
*/
public static double asinh(double d) {
double d2 = d*d;
/**
* inverse hyperbolic tangent
* @param d
- * @return
*/
public static double atanh(double d) {
return Math.log((1 + d)/(1 - d)) / 2;
/**
* hyperbolic cosine
* @param d
- * @return
*/
public static double cosh(double d) {
double ePowX = Math.pow(Math.E, d);
/**
* hyperbolic sine
* @param d
- * @return
*/
public static double sinh(double d) {
double ePowX = Math.pow(Math.E, d);
/**
* hyperbolic tangent
* @param d
- * @return
*/
public static double tanh(double d) {
double ePowX = Math.pow(Math.E, d);
* all the subarrays are of equal length. If the subarrays are
* not of equal length, the return value can be unpredictable.
* @param arrays
- * @return
*/
public static double sumproduct(double[][] arrays) {
double d = 0;
* subarrays are not of equal length, the return value can be
* unpredictable.
* @param arrays
- * @return
*/
public static double sumx2my2(double[] xarr, double[] yarr) {
double d = 0;
* subarrays are not of equal length, the return value can be
* unpredictable.
* @param arrays
- * @return
*/
public static double sumx2py2(double[] xarr, double[] yarr) {
double d = 0;
* subarrays are not of equal length, the return value can be
* unpredictable.
* @param arrays
- * @return
*/
public static double sumxmy2(double[] xarr, double[] yarr) {
double d = 0;
* If either of the parameters is negative, Double.NaN is returned.
* @param n
* @param k
- * @return
*/
public static double nChooseK(int n, int k) {
double d = 1;
/**
* Maximum number of operands accepted by this function.
* Subclasses may override to change default value.
- * @return
*/
protected int getMaxNumOperands() {
return DEFAULT_MAX_NUM_OPERANDS;
* @param operands
* @param srcRow
* @param srcCol
- * @return
*/
protected double[] getNumberArray(Eval[] operands, int srcRow, short srcCol) {
double[] retval = new double[30];
* @param operand
* @param srcRow
* @param srcCol
- * @return
*/
protected double[] getNumberArray(Eval operand, int srcRow, short srcCol) {
double[] retval;
* @param arr
* @param pos
* @param d
- * @return
*/
private static double[] putInArray(double[] arr, int pos, double d) {
double[] tarr = arr;
/**
* returns the mean of deviations from mean.
* @param v
- * @return
*/
public static double avedev(double[] v) {
double r = 0;
* is Double.NaN. Else returns the value that occurs most times
* and if there is a tie, returns the first such value.
* @param v
- * @return
*/
public static double mode(double[] v) {
double r = Double.NaN;
* will result in return value Double.NaN
* @param v
* @param k
- * @return
*/
public static double kthLargest(double[] v, int k) {
double r = Double.NaN;
* will result in return value Double.NaN
* @param v
* @param k
- * @return
*/
public static double kthSmallest(double[] v, int k) {
double r = Double.NaN;
* Note: AreaEvals are not handled, if arg is an AreaEval,
* the returned value is ErrorEval.VALUE_INVALID
* @param ve
- * @return
*/
protected ValueEval attemptXlateToText(ValueEval ve) {
ValueEval retval;
* @param operands
* @param srcRow
* @param srcCol
- * @return
*/
protected double[][] getNumberArray(Eval[] xops, Eval[] yops, int srcRow, short srcCol) {
double[][] retval = new double[2][30];
* evaluateInCell() when the call should not modify the contents of the
* original cell.
* @param cell
- * @return
*/
public CellValue evaluate(HSSFCell cell) {
CellValue retval = null;
/**
* Returns a CellValue wrapper around the supplied ValueEval instance.
* @param eval
- * @return
*/
protected static CellValue getCellValueForEval(ValueEval eval) {
CellValue retval = null;
* @param formula
* @param sheet
* @param workbook
- * @return
*/
protected static ValueEval internalEvaluate(HSSFCell srcCell, HSSFRow srcRow, HSSFSheet sheet, HSSFWorkbook workbook) {
int srcRowNum = srcRow.getRowNum();
* returns the OperationEval concrete impl instance corresponding
* to the suplied operationPtg
* @param ptg
- * @return
*/
protected static Eval getOperationEvalForPtg(OperationPtg ptg) {
Eval retval = null;
* passed here!
*
* @param ptg
- * @return
*/
protected static Eval getEvalForPtg(Ptg ptg) {
Eval retval = null;
* @param cell
* @param sheet
* @param workbook
- * @return
*/
protected static ValueEval getEvalForCell(HSSFCell cell, HSSFRow row, HSSFSheet sheet, HSSFWorkbook workbook) {
ValueEval retval = BlankEval.INSTANCE;
* Method compareTo
*
* @param o
- *
- * @return
*/
public int compareTo(Object o)