public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {if(args.length < 1 || args.length > 5) {return ErrorEval.VALUE_INVALID;}try {BaseRef baseRef = evaluateBaseRef(args[0]);int rowOffset = (args[1] instanceof MissingArgEval) ? 0 : evaluateIntArg(args[1], srcCellRow, srcCellCol);int columnOffset = (args[2] instanceof MissingArgEval) ? 0 : evaluateIntArg(args[2], srcCellRow, srcCellCol);int height = baseRef.getHeight();int width = baseRef.getWidth();switch(args.length) {case 5:if(!(args[4] instanceof MissingArgEval)) {width = evaluateIntArg(args[4], srcCellRow, srcCellCol);}case 4:if(!(args[3] instanceof MissingArgEval)) {height = evaluateIntArg(args[3], srcCellRow, srcCellCol);}break;default:break;}if(height == 0 || width == 0) {return ErrorEval.REF_INVALID;}LinearOffsetRange rowOffsetRange = new LinearOffsetRange(rowOffset, height);LinearOffsetRange colOffsetRange = new LinearOffsetRange(columnOffset, width);return createOffset(baseRef, rowOffsetRange, colOffsetRange);} catch (EvaluationException e) {return e.getErrorEval();}}