From: PJ Fanning Date: Wed, 22 May 2019 22:59:12 +0000 (+0000) Subject: remove some tab indents X-Git-Tag: REL_4_1_1~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d5671ac5ea9a4b724019fb1d83aa3736751e4a5;p=poi.git remove some tab indents git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859758 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/ss/formula/functions/Rank.java b/src/java/org/apache/poi/ss/formula/functions/Rank.java index 225250eccc..97d0700e15 100644 --- a/src/java/org/apache/poi/ss/formula/functions/Rank.java +++ b/src/java/org/apache/poi/ss/formula/functions/Rank.java @@ -45,116 +45,116 @@ import org.apache.poi.ss.formula.eval.ValueEval; */ public class Rank extends Var2or3ArgFunction { - @Override - public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { - try { - ValueEval ve = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex); - double result = OperandResolver.coerceValueToDouble(ve); - if (Double.isNaN(result) || Double.isInfinite(result)) { - throw new EvaluationException(ErrorEval.NUM_ERROR); - } - - if (arg1 instanceof RefListEval) { - return eval(result, ((RefListEval)arg1), true); - } - - final AreaEval aeRange = convertRangeArg(arg1); - - return eval(result, aeRange, true); - } catch (EvaluationException e) { - return e.getErrorEval(); - } - } - - @Override - public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) { - try { - ValueEval ve = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex); - final double result = OperandResolver.coerceValueToDouble(ve); - if (Double.isNaN(result) || Double.isInfinite(result)) { - throw new EvaluationException(ErrorEval.NUM_ERROR); - } - - ve = OperandResolver.getSingleValue(arg2, srcRowIndex, srcColumnIndex); - int order_value = OperandResolver.coerceValueToInt(ve); - final boolean order; - if (order_value==0) { - order = true; - } else if(order_value==1) { - order = false; - } else { - throw new EvaluationException(ErrorEval.NUM_ERROR); - } - - if (arg1 instanceof RefListEval) { - return eval(result, ((RefListEval)arg1), order); - } - - final AreaEval aeRange = convertRangeArg(arg1); - return eval(result, aeRange, order); - } catch (EvaluationException e) { - return e.getErrorEval(); - } - } - - private static ValueEval eval(double arg0, AreaEval aeRange, boolean descending_order) { - int rank = 1; - int height=aeRange.getHeight(); - int width= aeRange.getWidth(); - for (int r=0; rarg0 || !descending_order && valuearg0 || !descending_order && valuearg0 || !descending_order && valuearg0 || !descending_order && value sheetOffsets = pph.getSlideLocationsLookup(); - for (Integer id : sheetIDs) { - Integer offset = sheetOffsets.get(id); - - System.out.println(" Knows about sheet " + id); - System.out.println(" That sheet lives at " + offset); - - Record atPos = findRecordAtPos(offset.intValue()); - System.out.println(" The record at that pos is of type " + atPos.getRecordType()); - System.out.println(" The record at that pos has class " + atPos.getClass().getName()); - - if (!(atPos instanceof PositionDependentRecord)) { - System.out.println(" ** The record class isn't position aware! **"); - } - } - } - - // Increase the position by the on disk size - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - r.writeOut(baos); - pos += baos.size(); - } - - ss.close(); - - System.out.println(); - } - - - // Finds the record at a given position - public static Record findRecordAtPos(int pos) { - long type = LittleEndian.getUShort(fileContents, pos+2); - long rlen = LittleEndian.getUInt(fileContents, pos+4); - - return Record.createRecordForType(type,fileContents,pos,(int)rlen+8); - } + private static byte[] fileContents; + + public static void main(String[] args) throws IOException { + if (args.length < 1) { + System.err.println("Need to give a filename"); + System.exit(1); + } + + + // Create the slideshow object, for normal working with + HSLFSlideShowImpl hss = new HSLFSlideShowImpl(args[0]); + HSLFSlideShow ss = new HSLFSlideShow(hss); + + // Grab the base contents + fileContents = hss.getUnderlyingBytes(); + Record[] records = hss.getRecords(); + Record[] latestRecords = ss.getMostRecentCoreRecords(); + + // Grab any records that interest us + Document document = null; + for (Record latestRecord : latestRecords) { + if (latestRecord instanceof Document) { + document = (Document) latestRecord; + } + } + + System.out.println(); + + + // Look for SlidePersistAtoms, and report what they have to + // say about possible slide IDs + SlideListWithText[] slwts = document.getSlideListWithTexts(); + for (SlideListWithText slwt : slwts) { + Record[] cr = slwt.getChildRecords(); + for (Record record : cr) { + if (record instanceof SlidePersistAtom) { + SlidePersistAtom spa = (SlidePersistAtom) record; + System.out.println("SlidePersistAtom knows about slide:"); + System.out.println("\t" + spa.getRefID()); + System.out.println("\t" + spa.getSlideIdentifier()); + } + } + } + + System.out.println(); + + // Look for latest core records that are slides or notes + for (int i=0; i sheetOffsets = pph.getSlideLocationsLookup(); + for (Integer id : sheetIDs) { + Integer offset = sheetOffsets.get(id); + + System.out.println(" Knows about sheet " + id); + System.out.println(" That sheet lives at " + offset); + + Record atPos = findRecordAtPos(offset.intValue()); + System.out.println(" The record at that pos is of type " + atPos.getRecordType()); + System.out.println(" The record at that pos has class " + atPos.getClass().getName()); + + if (!(atPos instanceof PositionDependentRecord)) { + System.out.println(" ** The record class isn't position aware! **"); + } + } + } + + // Increase the position by the on disk size + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + r.writeOut(baos); + pos += baos.size(); + } + + ss.close(); + + System.out.println(); + } + + + // Finds the record at a given position + public static Record findRecordAtPos(int pos) { + long type = LittleEndian.getUShort(fileContents, pos+2); + long rlen = LittleEndian.getUInt(fileContents, pos+4); + + return Record.createRecordForType(type,fileContents,pos,(int)rlen+8); + } }