Return-Path: Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: (qmail 53261 invoked from network); 18 Aug 2009 02:42:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Aug 2009 02:42:14 -0000 Received: (qmail 66749 invoked by uid 500); 18 Aug 2009 02:42:33 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 66716 invoked by uid 500); 18 Aug 2009 02:42:33 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 66707 invoked by uid 99); 18 Aug 2009 02:42:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Aug 2009 02:42:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Aug 2009 02:42:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 229DD2388878; Tue, 18 Aug 2009 02:42:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r805262 [1/6] - in /poi/trunk/src: java/org/apache/poi/hssf/dev/ java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/record/formula/ java/org/apache/poi/hssf/record/formula/atp/ java/org/apache/poi/hssf... Date: Tue, 18 Aug 2009 02:41:50 -0000 To: commits@poi.apache.org From: josh@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090818024201.229DD2388878@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: josh Date: Tue Aug 18 02:41:45 2009 New Revision: 805262 URL: http://svn.apache.org/viewvc?rev=805262&view=rev Log: Fixed unused imports compiler warnings (and some others) Removed: poi/trunk/src/java/org/apache/poi/hssf/dev/EFHSSF.java Modified: poi/trunk/src/java/org/apache/poi/hssf/model/CommentShape.java poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleRecord.java poi/trunk/src/java/org/apache/poi/hssf/record/ContinueRecord.java poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java poi/trunk/src/java/org/apache/poi/hssf/record/SelectionRecord.java poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java poi/trunk/src/java/org/apache/poi/poifs/property/RootProperty.java poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java poi/trunk/src/java/org/apache/poi/poifs/storage/PropertyBlock.java poi/trunk/src/java/org/apache/poi/poifs/storage/SmallBlockTableReader.java poi/trunk/src/java/org/apache/poi/util/IntList.java poi/trunk/src/java/org/apache/poi/util/NullLogger.java poi/trunk/src/java/org/apache/poi/util/ShortList.java poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.java poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPictureData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPrintSetup.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/util/TestCTColComparator.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/StyleSheet.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/FileInformationBlock.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/CHPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/DOPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/FIBAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/PAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/SEPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/TAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/definitions/TCAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowRecordDumper.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/TextStyleListing.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/UserEditAndPersistListing.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextPainter.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextShape.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/AnimationInfoAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExAviMovie.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MainMaster.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEShapeAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RoundTripHFPlaceholder12.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextRulerAtom.java poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/DocumentProperties.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/DOPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableIterator.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestImagePainter.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestAnimationInfoAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlinkAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjListAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExOleObjStg.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextRulerAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSavedByTable.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestShapes.java poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java poi/trunk/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/AbstractPtgTestCase.java poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/eval/TestCircularReferences.java poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/NumericFunctionInvoker.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFFont.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFOptimiser.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestPOIFSProperties.java poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPropertySorter.java poi/trunk/src/testcases/org/apache/poi/poifs/storage/LocalRawDataBlockList.java poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java Modified: poi/trunk/src/java/org/apache/poi/hssf/model/CommentShape.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/CommentShape.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/model/CommentShape.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/model/CommentShape.java Tue Aug 18 02:41:45 2009 @@ -14,16 +14,23 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ + package org.apache.poi.hssf.model; -import org.apache.poi.hssf.record.*; +import java.util.Iterator; +import java.util.List; + +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherProperty; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.NoteRecord; +import org.apache.poi.hssf.record.NoteStructureSubRecord; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.SubRecord; import org.apache.poi.hssf.usermodel.HSSFComment; import org.apache.poi.hssf.usermodel.HSSFShape; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.ddf.*; - -import java.util.List; -import java.util.Iterator; /** * Represents a cell comment. @@ -32,9 +39,9 @@ * * @author Yegor Kozlov */ -public class CommentShape extends TextboxShape { +public final class CommentShape extends TextboxShape { - private NoteRecord note; + private NoteRecord _note; /** * Creates the low-level records for a comment. @@ -46,10 +53,10 @@ { super(hssfShape, shapeId); - note = createNoteRecord(hssfShape, shapeId); + _note = createNoteRecord(hssfShape, shapeId); ObjRecord obj = getObjRecord(); - List records = obj.getSubRecords(); + List records = obj.getSubRecords(); int cmoIdx = 0; for (int i = 0; i < records.size(); i++) { Object r = records.get(i); @@ -96,9 +103,9 @@ super.addStandardOptions(shape, opt); //remove unnecessary properties inherited from TextboxShape - java.util.List props = opt.getEscherProperties(); - for ( Iterator iterator = props.iterator(); iterator.hasNext(); ) { - EscherProperty prop = (EscherProperty) iterator.next(); + List props = opt.getEscherProperties(); + for (Iterator iterator = props.iterator(); iterator.hasNext(); ) { + EscherProperty prop = iterator.next(); switch (prop.getId()){ case EscherProperties.TEXT__TEXTLEFT: case EscherProperties.TEXT__TEXTRIGHT: @@ -127,7 +134,6 @@ */ public NoteRecord getNoteRecord() { - return note; + return _note; } - } Modified: poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java Tue Aug 18 02:41:45 2009 @@ -72,7 +72,6 @@ import org.apache.poi.hssf.record.SupBookRecord; import org.apache.poi.hssf.record.TabIdRecord; import org.apache.poi.hssf.record.UnicodeString; -import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.hssf.record.UseSelFSRecord; import org.apache.poi.hssf.record.WindowOneRecord; import org.apache.poi.hssf.record.WindowProtectRecord; @@ -271,19 +270,19 @@ case WindowOneRecord.sid: if (log.check( POILogger.DEBUG )) log.log(DEBUG, "found WindowOneRecord at " + k); - retval.windowOne = (WindowOneRecord) rec; + retval.windowOne = (WindowOneRecord) rec; break; - case WriteAccessRecord.sid: + case WriteAccessRecord.sid: if (log.check( POILogger.DEBUG )) log.log(DEBUG, "found WriteAccess at " + k); retval.writeAccess = (WriteAccessRecord) rec; break; - case WriteProtectRecord.sid: + case WriteProtectRecord.sid: if (log.check( POILogger.DEBUG )) log.log(DEBUG, "found WriteProtect at " + k); retval.writeProtect = (WriteProtectRecord) rec; break; - case FileSharingRecord.sid: + case FileSharingRecord.sid: if (log.check( POILogger.DEBUG )) log.log(DEBUG, "found FileSharing at " + k); retval.fileShare = (FileSharingRecord) rec; @@ -296,7 +295,7 @@ // retval.records.supbookpos = retval.records.bspos + 1; // retval.records.namepos = retval.records.supbookpos + 1; // } - + // Look for other interesting values that // follow the EOFRecord for ( ; k < recs.size(); k++) { @@ -307,7 +306,7 @@ break; } } - + if (retval.windowOne == null) { retval.windowOne = createWindowOne(); } @@ -388,7 +387,7 @@ retval.records.setBspos(records.size() - 1); } records.add( retval.createCountry() ); - for ( int k = 0; k < nBoundSheets; k++ ) { + for ( int k = 0; k < nBoundSheets; k++ ) { retval.getOrCreateLinkTable().checkExternSheet(k); } retval.sst = new SSTRecord(); @@ -452,7 +451,7 @@ return retval; } - + /** * Retrieves the index of the given font */ @@ -468,7 +467,7 @@ return i; } } - throw new IllegalArgumentException("Could not find that font!"); + throw new IllegalArgumentException("Could not find that font!"); } /** @@ -487,10 +486,10 @@ numfonts++; return rec; } - + /** * Removes the given font record from the - * file's list. This will make all + * file's list. This will make all * subsequent font indicies drop by one, * so you'll need to update those yourself! */ @@ -553,7 +552,7 @@ } /** - * Determines whether a workbook contains the provided sheet name. For the purpose of + * Determines whether a workbook contains the provided sheet name. For the purpose of * comparison, long names are truncated to 31 chars. * * @param name the name to test (case insensitive match) @@ -580,18 +579,18 @@ } return false; } - + /** * sets the order of appearance for a given sheet. * * @param sheetname the name of the sheet to reorder * @param pos the position that we want to insert the sheet into (0 based) */ - + public void setSheetOrder(String sheetname, int pos ) { int sheetNumber = getSheetIndex(sheetname); //remove the sheet that needs to be reordered and place it in the spot we want - boundsheets.add(pos, boundsheets.remove(sheetNumber)); + boundsheets.add(pos, boundsheets.remove(sheetNumber)); } /** @@ -606,7 +605,7 @@ /** * Gets the hidden flag for a given sheet. - * Note that a sheet could instead be + * Note that a sheet could instead be * set to be very hidden, which is different * ({@link #isSheetVeryHidden(int)}) * @@ -619,8 +618,8 @@ /** * Gets the very hidden flag for a given sheet. - * This is different from the normal - * hidden flag + * This is different from the normal + * hidden flag * ({@link #isSheetHidden(int)}) * * @param sheetnum the sheet number (0 based) @@ -632,20 +631,20 @@ /** * Hide or unhide a sheet - * + * * @param sheetnum The sheet number * @param hidden True to mark the sheet as hidden, false otherwise */ public void setSheetHidden(int sheetnum, boolean hidden) { getBoundSheetRec(sheetnum).setHidden(hidden); } - + /** * Hide or unhide a sheet. * 0 = not hidden * 1 = hidden * 2 = very hidden. - * + * * @param sheetnum The sheet number * @param hidden 0 for not hidden, 1 for hidden, 2 for very hidden */ @@ -664,8 +663,8 @@ bsr.setHidden(h); bsr.setVeryHidden(vh); } - - + + /** * get the sheet's index * @param name sheet name @@ -713,18 +712,18 @@ boundsheets.remove(sheetIndex); fixTabIdRecord(); } - + // Within NameRecords, it's ok to have the formula // part point at deleted sheets. It's also ok to // have the ExternSheetNumber point at deleted - // sheets. + // sheets. // However, the sheet index must be adjusted, or // excel will break. (Sheet index is either 0 for // global, or 1 based index to sheet) int sheetNum1Based = sheetIndex + 1; for(int i=0; i Short.MAX_VALUE) { throw new IllegalArgumentException("Sheet number ["+sheetNumber+"]is not valid "); } - + NameRecord name = new NameRecord(builtInName, sheetNumber); - + while(linkTable.nameAlreadyExists(name)) { - throw new RuntimeException("Builtin (" + builtInName + throw new RuntimeException("Builtin (" + builtInName + ") already exists for sheet (" + sheetNumber + ")"); } addName(name); @@ -1853,7 +1852,7 @@ * @param nameIndex name index */ public void removeName(int nameIndex){ - + if (linkTable.getNumNames() > nameIndex) { int idx = findFirstRecordLocBySid(NameRecord.sid); records.remove(idx + nameIndex); @@ -1912,7 +1911,7 @@ return maxformatid; } - + /** * Returns the first occurance of a record matching a particular sid. @@ -1920,7 +1919,7 @@ public Record findFirstRecordBySid(short sid) { for (Iterator iterator = records.iterator(); iterator.hasNext(); ) { Record record = ( Record ) iterator.next(); - + if (record.getSid() == sid) { return record; } @@ -1966,7 +1965,7 @@ { return hyperlinks; } - + public List getRecords() { return records.getRecords(); } @@ -1980,7 +1979,7 @@ public boolean isUsing1904DateWindowing() { return uses1904datewindowing; } - + /** * Returns the custom palette in use for this workbook; if a custom palette record * does not exist, then it is created. @@ -2004,7 +2003,7 @@ } return palette; } - + /** * Finds the primary drawing group, if one already exists */ @@ -2060,7 +2059,7 @@ } /** - * Creates a primary drawing group record. If it already + * Creates a primary drawing group record. If it already * exists then it's modified. */ public void createDrawingGroup() { @@ -2124,7 +2123,7 @@ } } - + public WindowOneRecord getWindowOne() { return windowOne; } @@ -2172,8 +2171,8 @@ if (writeProtect == null) { writeProtect = new WriteProtectRecord(); int i = 0; - for (i = 0; - i < records.size() && !(records.get(i) instanceof BOFRecord); + for (i = 0; + i < records.size() && !(records.get(i) instanceof BOFRecord); i++) { } records.add(i+1, writeProtect); @@ -2185,8 +2184,8 @@ if (writeAccess == null) { writeAccess = createWriteAccess(); int i = 0; - for (i = 0; - i < records.size() && !(records.get(i) instanceof InterfaceEndRecord); + for (i = 0; + i < records.size() && !(records.get(i) instanceof InterfaceEndRecord); i++) { } records.add(i+1, writeAccess); @@ -2198,15 +2197,15 @@ if (fileShare == null) { fileShare = new FileSharingRecord(); int i = 0; - for (i = 0; - i < records.size() && !(records.get(i) instanceof WriteAccessRecord); + for (i = 0; + i < records.size() && !(records.get(i) instanceof WriteAccessRecord); i++) { } records.add(i+1, fileShare); } return fileShare; } - + /** * is the workbook protected with a password (not encrypted)? */ Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleRecord.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleRecord.java Tue Aug 18 02:41:45 2009 @@ -22,7 +22,6 @@ import org.apache.poi.hssf.record.cf.FontFormatting; import org.apache.poi.hssf.record.cf.PatternFormatting; import org.apache.poi.hssf.record.formula.Ptg; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.ss.formula.Formula; import org.apache.poi.ss.formula.FormulaType; @@ -32,7 +31,7 @@ /** * Conditional Formatting Rule Record (0x01B1).
- * + * * @author Dmitriy Kumshayev */ public final class CFRuleRecord extends StandardRecord { @@ -101,10 +100,10 @@ private BorderFormatting borderFormatting; private PatternFormatting patternFormatting; - + private Formula field_17_formula1; private Formula field_18_formula2; - + /** Creates new CFRuleRecord */ private CFRuleRecord(byte conditionType, byte comparisonOperation) { @@ -124,9 +123,9 @@ field_17_formula1=Formula.create(Ptg.EMPTY_PTG_ARRAY); field_18_formula2=Formula.create(Ptg.EMPTY_PTG_ARRAY); } - + private CFRuleRecord(byte conditionType, byte comparisonOperation, Ptg[] formula1, Ptg[] formula2) { - this(conditionType, comparisonOperation); + this(conditionType, comparisonOperation); field_17_formula1 = Formula.create(formula1); field_18_formula2 = Formula.create(formula2); } @@ -199,7 +198,7 @@ return null; } } - + public boolean containsAlignFormattingBlock() { return getOptionFlag(align); @@ -208,7 +207,7 @@ { setOptionFlag(false,align); } - + public boolean containsBorderFormattingBlock() { return getOptionFlag(bord); @@ -229,7 +228,7 @@ return null; } } - + public boolean containsPatternFormattingBlock() { return getOptionFlag(patt); @@ -250,7 +249,7 @@ return null; } } - + public boolean containsProtectionFormattingBlock() { return getOptionFlag(prot); @@ -259,7 +258,7 @@ { setOptionFlag(false,prot); } - + public void setComparisonOperation(byte operation) { field_2_comparison_operator = operation; @@ -269,7 +268,7 @@ { return field_2_comparison_operator; } - + /** * get the option flags @@ -279,7 +278,7 @@ public int getOptions() { return field_5_options; - } + } private boolean isModified(BitField field) { @@ -290,7 +289,7 @@ { field_5_options = field.setBoolean(field_5_options, !modified); } - + public boolean isLeftBorderModified() { return isModified(bordLeft); @@ -300,7 +299,7 @@ { setModified(modified,bordLeft); } - + public boolean isRightBorderModified() { return isModified(bordRight); @@ -310,7 +309,7 @@ { setModified(modified,bordRight); } - + public boolean isTopBorderModified() { return isModified(bordTop); @@ -320,7 +319,7 @@ { setModified(modified,bordTop); } - + public boolean isBottomBorderModified() { return isModified(bordBot); @@ -330,7 +329,7 @@ { setModified(modified,bordBot); } - + public boolean isTopLeftBottomRightBorderModified() { return isModified(bordTlBr); @@ -340,7 +339,7 @@ { setModified(modified,bordTlBr); } - + public boolean isBottomLeftTopRightBorderModified() { return isModified(bordBlTr); @@ -350,7 +349,7 @@ { setModified(modified,bordBlTr); } - + public boolean isPatternStyleModified() { return isModified(pattStyle); @@ -360,7 +359,7 @@ { setModified(modified,pattStyle); } - + public boolean isPatternColorModified() { return isModified(pattCol); @@ -370,7 +369,7 @@ { setModified(modified,pattCol); } - + public boolean isPatternBackgroundColorModified() { return isModified(pattBgCol); @@ -380,7 +379,7 @@ { setModified(modified,pattBgCol); } - + private boolean getOptionFlag(BitField field) { return field.isSet(field_5_options); @@ -390,12 +389,12 @@ { field_5_options = field.setBoolean(field_5_options, flag); } - + /** * get the stack of the 1st expression as a list * * @return list of tokens (casts stack to a list and returns it!) - * this method can return null is we are unable to create Ptgs from + * this method can return null is we are unable to create Ptgs from * existing excel file * callers should check for null! */ @@ -432,7 +431,7 @@ private static int getFormulaSize(Formula formula) { return formula.getEncodedTokenSize(); } - + /** * called by the class that is responsible for writing this sucker. * Subclasses should implement this so that their data is passed back in a @@ -441,30 +440,30 @@ * @param out the stream to write to */ public void serialize(LittleEndianOutput out) { - + int formula1Len=getFormulaSize(field_17_formula1); int formula2Len=getFormulaSize(field_18_formula2); - + out.writeByte(field_1_condition_type); out.writeByte(field_2_comparison_operator); out.writeShort(formula1Len); out.writeShort(formula2Len); out.writeInt(field_5_options); out.writeShort(field_6_not_used); - + if (containsFontFormattingBlock()) { byte[] fontFormattingRawRecord = fontFormatting.getRawRecord(); out.write(fontFormattingRawRecord); } - + if (containsBorderFormattingBlock()) { borderFormatting.serialize(out); } - + if (containsPatternFormattingBlock()) { patternFormatting.serialize(out); } - + field_17_formula1.serializeTokens(out); field_18_formula2.serializeTokens(out); } @@ -499,7 +498,7 @@ } return buffer.toString(); } - + public Object clone() { CFRuleRecord rec = new CFRuleRecord(field_1_condition_type, field_2_comparison_operator); rec.field_5_options = field_5_options; @@ -524,7 +523,7 @@ * this call will produce the wrong results if the formula contains any cell references * One approach might be to apply the inverse of SharedFormulaRecord.convertSharedFormulas(Stack, int, int) * Note - two extra parameters (rowIx & colIx) will be required. They probably come from one of the Region objects. - * + * * @return null if formula was null. */ private static Ptg[] parseFormula(String formula, HSSFSheet sheet) { Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ContinueRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ContinueRecord.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/ContinueRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/ContinueRecord.java Tue Aug 18 02:41:45 2009 @@ -18,7 +18,6 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianOutput; /** Modified: poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactory.java Tue Aug 18 02:41:45 2009 @@ -17,7 +17,6 @@ package org.apache.poi.hssf.record; -import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SelectionRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SelectionRecord.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/SelectionRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/SelectionRecord.java Tue Aug 18 02:41:45 2009 @@ -19,7 +19,6 @@ import org.apache.poi.hssf.util.CellRangeAddress8Bit; import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianOutput; /** @@ -59,7 +58,7 @@ field_3_col_active_cell = in.readShort(); field_4_active_cell_ref_index = in.readShort(); int field_5_num_refs = in.readUShort(); - + field_6_refs = new CellRangeAddress8Bit[field_5_num_refs]; for (int i = 0; i < field_6_refs.length; i++) { field_6_refs[i] = new CellRangeAddress8Bit(in); @@ -141,7 +140,7 @@ return sb.toString(); } protected int getDataSize() { - return 9 // 1 byte + 4 shorts + return 9 // 1 byte + 4 shorts + CellRangeAddress8Bit.getEncodedSize(field_6_refs.length); } public void serialize(LittleEndianOutput out) { Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/SubRecord.java Tue Aug 18 02:41:45 2009 @@ -17,7 +17,6 @@ package org.apache.poi.hssf.record; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import org.apache.poi.hssf.record.formula.Area3DPtg; @@ -26,7 +25,6 @@ import org.apache.poi.hssf.record.formula.Ref3DPtg; import org.apache.poi.hssf.record.formula.RefPtg; import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianByteArrayInputStream; import org.apache.poi.util.LittleEndianInput; import org.apache.poi.util.LittleEndianOutput; @@ -37,6 +35,7 @@ */ public abstract class SubRecord { protected SubRecord() { + // no fields to initialise } public static SubRecord createSubRecord(LittleEndianInput in) { @@ -78,8 +77,8 @@ public abstract void serialize(LittleEndianOutput out); public abstract Object clone(); - - + + private static final class UnknownSubRecord extends SubRecord { private final int _sid; @@ -118,7 +117,7 @@ private static final class LbsDataSubRecord extends SubRecord { public static final int sid = 0x0013; - + private int _unknownShort1; private int _unknownInt4; private Ptg _linkPtg; @@ -137,8 +136,8 @@ if (linkSize > 0) { int formulaSize = in.readUShort(); _unknownInt4 = in.readInt(); - - + + byte[] buf = new byte[formulaSize]; in.readFully(buf); _linkPtg = readRefPtg(buf); @@ -152,7 +151,7 @@ default: throw new RecordFormatException("Unexpected leftover bytes"); } - + } else { _unknownInt4 = 0; _linkPtg = null; @@ -165,11 +164,11 @@ _comboStyle = in.readUShort(); _lineCount = in.readUShort(); _unknownShort13 = in.readUShort(); - + } protected int getDataSize() { int result = 2; // 2 initial shorts - + // optional link formula if (_linkPtg != null) { result += 2; // encoded Ptg size Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java Tue Aug 18 02:41:45 2009 @@ -17,7 +17,6 @@ package org.apache.poi.hssf.record.formula; -import org.apache.poi.hssf.record.UnicodeString; import org.apache.poi.hssf.record.constant.ConstantValueParser; import org.apache.poi.hssf.record.constant.ErrorConstant; import org.apache.poi.util.LittleEndianInput; @@ -25,20 +24,20 @@ /** * ArrayPtg - handles arrays - * + * * The ArrayPtg is a little weird, the size of the Ptg when parsing initially only * includes the Ptg sid and the reserved bytes. The next Ptg in the expression then follows. * It is only after the "size" of all the Ptgs is met, that the ArrayPtg data is actually - * held after this. So Ptg.createParsedExpression keeps track of the number of + * held after this. So Ptg.createParsedExpression keeps track of the number of * ArrayPtg elements and need to parse the data upto the FORMULA record size. - * + * * @author Jason Height (jheight at chariot dot net dot au) */ public final class ArrayPtg extends Ptg { public static final byte sid = 0x20; private static final int RESERVED_FIELD_LEN = 7; - /** + /** * The size of the plain tArray token written within the standard formula tokens * (not including the data which comes after all formula tokens) */ @@ -48,7 +47,7 @@ // TODO - fix up field visibility and subclasses private final byte[] field_1_reserved; - + // data from these fields comes after the Ptg data of all tokens in current formula private int token_1_columns; private short token_2_rows; @@ -78,7 +77,7 @@ vv[getValueIndex(c, r)] = rowData[c]; } } - + token_3_arrayValues = vv; field_1_reserved = DEFAULT_RESERVED_DATA; } @@ -98,13 +97,13 @@ } return result; } - + public boolean isBaseToken() { return false; } - - /** - * Read in the actual token (array) values. This occurs + + /** + * Read in the actual token (array) values. This occurs * AFTER the last Ptg in the expression. * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf */ @@ -116,10 +115,10 @@ //Which is not explicitly documented. nColumns++; nRows++; - + token_1_columns = nColumns; token_2_rows = nRows; - + int totalCount = nRows * nColumns; token_3_arrayValues = ConstantValueParser.parse(in, totalCount); } @@ -143,11 +142,11 @@ */ /* package */ int getValueIndex(int colIx, int rowIx) { if(colIx < 0 || colIx >= token_1_columns) { - throw new IllegalArgumentException("Specified colIx (" + colIx + throw new IllegalArgumentException("Specified colIx (" + colIx + ") is outside the allowed range (0.." + (token_1_columns-1) + ")"); } if(rowIx < 0 || rowIx >= token_2_rows) { - throw new IllegalArgumentException("Specified rowIx (" + rowIx + throw new IllegalArgumentException("Specified rowIx (" + rowIx + ") is outside the allowed range (0.." + (token_2_rows-1) + ")"); } return rowIx * token_1_columns + colIx; @@ -176,7 +175,7 @@ /** This size includes the size of the array Ptg plus the Array Ptg Token value size*/ public int getSize() { - return PLAIN_TOKEN_SIZE + return PLAIN_TOKEN_SIZE // data written after the all tokens: + 1 + 2 // column, row + ConstantValueParser.getEncodedSize(token_3_arrayValues); @@ -200,7 +199,7 @@ b.append("}"); return b.toString(); } - + private static String getConstantText(Object o) { if (o == null) { @@ -220,7 +219,7 @@ } throw new IllegalArgumentException("Unexpected constant class (" + o.getClass().getName() + ")"); } - + public byte getDefaultOperandClass() { return Ptg.CLASS_ARRAY; } Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java Tue Aug 18 02:41:45 2009 @@ -22,11 +22,10 @@ import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndianInput; import org.apache.poi.util.LittleEndianOutput; -import org.apache.poi.ss.SpreadsheetVersion; /** * ReferencePtgBase - handles references (such as A1, A2, IA4) - * + * * @author Andrew C. Oliver (acoliver@apache.org) * @author Jason Height (jheight at chariot dot net dot au) */ Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/ParityFunction.java Tue Aug 18 02:41:45 2009 @@ -19,7 +19,6 @@ import org.apache.poi.hssf.record.formula.eval.BoolEval; import org.apache.poi.hssf.record.formula.eval.ErrorEval; -import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.eval.EvaluationException; import org.apache.poi.hssf.record.formula.eval.OperandResolver; import org.apache.poi.hssf.record.formula.eval.ValueEval; Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/atp/YearFrac.java Tue Aug 18 02:41:45 2009 @@ -22,15 +22,14 @@ import java.util.regex.Pattern; import org.apache.poi.hssf.record.formula.eval.ErrorEval; -import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.eval.EvaluationException; import org.apache.poi.hssf.record.formula.eval.NumberEval; import org.apache.poi.hssf.record.formula.eval.OperandResolver; import org.apache.poi.hssf.record.formula.eval.StringEval; import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.functions.FreeRefFunction; -import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.formula.EvaluationWorkbook; +import org.apache.poi.ss.usermodel.DateUtil; /** * Implementation of Excel 'Analysis ToolPak' function YEARFRAC()
* Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java Tue Aug 18 02:41:45 2009 @@ -17,13 +17,8 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ddf.EscherRecord; -import org.apache.poi.ddf.EscherClientAnchorRecord; -import org.apache.poi.ddf.EscherChildAnchorRecord; - -public class HSSFChildAnchor - extends HSSFAnchor -{ + +public final class HSSFChildAnchor extends HSSFAnchor { public HSSFChildAnchor() { } @@ -50,5 +45,4 @@ { return dy1 > dy2; } - } Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java Tue Aug 18 02:41:45 2009 @@ -14,54 +14,50 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ + package org.apache.poi.hssf.usermodel; import org.apache.poi.ss.usermodel.CreationHelper; -import org.apache.poi.ss.usermodel.Sheet; public class HSSFCreationHelper implements CreationHelper { private HSSFWorkbook workbook; - private HSSFDataFormat dataFormat; - + private HSSFDataFormat dataFormat; + HSSFCreationHelper(HSSFWorkbook wb) { workbook = wb; - + // Create the things we only ever need one of dataFormat = new HSSFDataFormat(workbook.getWorkbook()); } - - /** - * Creates a new HSSFRichTextString for you. - */ + public HSSFRichTextString createRichTextString(String text) { return new HSSFRichTextString(text); } - + public HSSFDataFormat createDataFormat() { return dataFormat; } - + public HSSFHyperlink createHyperlink(int type) { return new HSSFHyperlink(type); } - /** - * Creates a HSSFFormulaEvaluator, the object that evaluates formula cells. - * - * @return a HSSFFormulaEvaluator instance - */ - public HSSFFormulaEvaluator createFormulaEvaluator(){ - return new HSSFFormulaEvaluator(workbook); - } - - /** - * Creates a HSSFClientAnchor. Use this object to position drawing object in a sheet - * - * @return a HSSFClientAnchor instance - * @see org.apache.poi.ss.usermodel.Drawing - */ - public HSSFClientAnchor createClientAnchor(){ - return new HSSFClientAnchor(); - } + /** + * Creates a HSSFFormulaEvaluator, the object that evaluates formula cells. + * + * @return a HSSFFormulaEvaluator instance + */ + public HSSFFormulaEvaluator createFormulaEvaluator(){ + return new HSSFFormulaEvaluator(workbook); + } + /** + * Creates a HSSFClientAnchor. Use this object to position drawing object in a sheet + * + * @return a HSSFClientAnchor instance + * @see org.apache.poi.ss.usermodel.Drawing + */ + public HSSFClientAnchor createClientAnchor(){ + return new HSSFClientAnchor(); + } } Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormatter.java Tue Aug 18 02:41:45 2009 @@ -17,21 +17,11 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ss.usermodel.DataFormatter; - import java.text.DecimalFormat; -import java.text.FieldPosition; import java.text.Format; -import java.text.ParsePosition; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + +import org.apache.poi.ss.usermodel.DataFormatter; /** * HSSFDataFormatter contains methods for formatting the value stored in an @@ -73,7 +63,6 @@ * cell's data format string. * * @author James May (james dot may at fmr dot com) - * */ public final class HSSFDataFormatter extends DataFormatter { Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java (original) +++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFTextbox.java Tue Aug 18 02:41:45 2009 @@ -19,9 +19,6 @@ import org.apache.poi.ss.usermodel.RichTextString; -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; - /** * A textbox is a shape that may hold a rich text string. * Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java Tue Aug 18 02:41:45 2009 @@ -21,78 +21,69 @@ import java.io.IOException; import java.util.Iterator; -import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.DirectoryNode; -import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * A lister of the entries in POIFS files. - * + * * Much simpler than {@link POIFSViewer} */ public class POIFSLister { - /** - * Display the entries of multiple POIFS files - * - * @param args the names of the files to be displayed - */ - public static void main(final String args[]) throws IOException { - if (args.length == 0) - { - System.err.println("Must specify at least one file to view"); - System.exit(1); - } - - boolean withSizes = false; - for (int j = 0; j < args.length; j++) { - if(args[j].equalsIgnoreCase("-size") || - args[j].equalsIgnoreCase("-sizes")) { - withSizes = true; - } else { - viewFile(args[j], withSizes); - } - } - } - - public static void viewFile(final String filename, boolean withSizes) throws IOException - { - POIFSFileSystem fs = new POIFSFileSystem( - new FileInputStream(filename) - ); - displayDirectory(fs.getRoot(), "", withSizes); - } - - public static void displayDirectory(DirectoryNode dir, String indent, boolean withSizes) { - System.out.println(indent + dir.getName() + " -"); - String newIndent = indent + " "; - - boolean hadChildren = false; - for(Iterator it = dir.getEntries(); it.hasNext(); ) { - hadChildren = true; - Object entry = it.next(); - if(entry instanceof DirectoryNode) { - displayDirectory((DirectoryNode)entry, newIndent, withSizes); - } else { - DocumentNode doc = (DocumentNode)entry; - String name = doc.getName(); - String size = ""; - if(name.charAt(0) < 10) { - String altname = "(0x0" + (int)name.charAt(0) + ")" + name.substring(1); - name = name.substring(1) + " <" + altname + ">"; - } - if(withSizes) { - size = " [" + - doc.getSize() + " / 0x" + - Integer.toHexString(doc.getSize()) + - "]"; - } - System.out.println(newIndent + name + size); - } - } - if(!hadChildren) { - System.out.println(newIndent + "(no children)"); - } - } -} \ No newline at end of file + /** + * Display the entries of multiple POIFS files + * + * @param args the names of the files to be displayed + */ + public static void main(final String args[]) throws IOException { + if (args.length == 0) { + System.err.println("Must specify at least one file to view"); + System.exit(1); + } + + boolean withSizes = false; + for (int j = 0; j < args.length; j++) { + if (args[j].equalsIgnoreCase("-size") || args[j].equalsIgnoreCase("-sizes")) { + withSizes = true; + } else { + viewFile(args[j], withSizes); + } + } + } + + public static void viewFile(final String filename, boolean withSizes) throws IOException { + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename)); + displayDirectory(fs.getRoot(), "", withSizes); + } + + public static void displayDirectory(DirectoryNode dir, String indent, boolean withSizes) { + System.out.println(indent + dir.getName() + " -"); + String newIndent = indent + " "; + + boolean hadChildren = false; + for (Iterator it = dir.getEntries(); it.hasNext();) { + hadChildren = true; + Object entry = it.next(); + if (entry instanceof DirectoryNode) { + displayDirectory((DirectoryNode) entry, newIndent, withSizes); + } else { + DocumentNode doc = (DocumentNode) entry; + String name = doc.getName(); + String size = ""; + if (name.charAt(0) < 10) { + String altname = "(0x0" + (int) name.charAt(0) + ")" + name.substring(1); + name = name.substring(1) + " <" + altname + ">"; + } + if (withSizes) { + size = " [" + doc.getSize() + " / 0x" + Integer.toHexString(doc.getSize()) + + "]"; + } + System.out.println(newIndent + name + size); + } + } + if (!hadChildren) { + System.out.println(newIndent + "(no children)"); + } + } +} Modified: poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,44 +14,35 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.property; -import java.util.*; - import java.io.IOException; - -import org.apache.poi.poifs.storage.SmallDocumentBlock; +import java.util.*; /** * Directory property * * @author Marc Johnson (mjohnson at apache dot org) */ +public class DirectoryProperty extends Property implements Parent { // TODO - fix instantiable superclass -public class DirectoryProperty - extends Property - implements Parent -{ - - // List of Property instances - private List _children; + /** List of Property instances */ + private List _children; - // set of children's names - private Set _children_names; + /** set of children's names */ + private Set _children_names; /** * Default constructor * * @param name the name of the directory */ - public DirectoryProperty(String name) { super(); - _children = new ArrayList(); - _children_names = new HashSet(); + _children = new ArrayList(); + _children_names = new HashSet(); setName(name); setSize(0); setPropertyType(PropertyConstants.DIRECTORY_TYPE); @@ -67,13 +57,12 @@ * @param array byte data * @param offset offset into byte data */ - protected DirectoryProperty(final int index, final byte [] array, final int offset) { super(index, array, offset); - _children = new ArrayList(); - _children_names = new HashSet(); + _children = new ArrayList(); + _children_names = new HashSet(); } /** @@ -84,8 +73,7 @@ * * @return true if the name change could be made, else false */ - - public boolean changeName(final Property property, final String newName) + public boolean changeName(Property property, String newName) { boolean result; String oldName = property.getName(); @@ -116,8 +104,7 @@ * * @return true if the Property could be deleted, else false */ - - public boolean deleteChild(final Property property) + public boolean deleteChild(Property property) { boolean result = _children.remove(property); @@ -128,9 +115,7 @@ return result; } - public static class PropertyComparator - implements Comparator - { + public static class PropertyComparator implements Comparator { /** * Object equality, implemented as object identity @@ -139,7 +124,6 @@ * * @return true if identical, else false */ - public boolean equals(Object o) { return this == o; @@ -160,12 +144,11 @@ * zero if o1 == o2, * positive value if o1 > o2. */ - - public int compare(Object o1, Object o2) + public int compare(Property o1, Property o2) { String VBA_PROJECT = "_VBA_PROJECT"; - String name1 = (( Property ) o1).getName(); - String name2 = (( Property ) o2).getName(); + String name1 = o1.getName(); + String name2 = o2.getName(); int result = name1.length() - name2.length(); if (result == 0) @@ -200,14 +183,11 @@ } return result; } - } // end private class PropertyComparator - - /* ********** START extension of Property ********** */ + } /** * @return true if a directory type Property */ - public boolean isDirectory() { return true; @@ -217,13 +197,11 @@ * Perform whatever activities need to be performed prior to * writing */ - protected void preWrite() { if (_children.size() > 0) { - Property[] children = - ( Property [] ) _children.toArray(new Property[ 0 ]); + Property[] children = _children.toArray(new Property[ 0 ]); Arrays.sort(children, new PropertyComparator()); int midpoint = children.length / 2; @@ -259,17 +237,13 @@ } } - /* ********** END extension of Property ********** */ - /* ********** START implementation of Parent ********** */ - /** * Get an iterator over the children of this Parent; all elements * are instances of Property. * * @return Iterator of children; may refer to an empty collection */ - - public Iterator getChildren() + public Iterator getChildren() { return _children.iterator(); } @@ -282,7 +256,6 @@ * @exception IOException if we already have a child with the same * name */ - public void addChild(final Property property) throws IOException { @@ -295,7 +268,4 @@ _children_names.add(name); _children.add(property); } - - /* ********** END implementation of Parent ********** */ -} // end public class DirectoryProperty - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,20 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.property; import java.io.IOException; import java.io.OutputStream; - -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.poifs.filesystem.BATManaged; import org.apache.poi.poifs.storage.BlockWritable; import org.apache.poi.poifs.storage.PropertyBlock; -import org.apache.poi.poifs.storage.RawDataBlock; import org.apache.poi.poifs.storage.RawDataBlockList; /** @@ -38,22 +36,15 @@ * * @author Marc Johnson (mjohnson at apache dot org) */ - -public class PropertyTable - implements BATManaged, BlockWritable -{ +public final class PropertyTable implements BATManaged, BlockWritable { private int _start_block; - private List _properties; + private List _properties; private BlockWritable[] _blocks; - /** - * Default constructor - */ - public PropertyTable() { _start_block = POIFSConstants.END_OF_CHAIN; - _properties = new ArrayList(); + _properties = new ArrayList(); addProperty(new RootProperty()); _blocks = null; } @@ -69,7 +60,6 @@ * @exception IOException if anything goes wrong (which should be * a result of the input being NFG) */ - public PropertyTable(final int startBlock, final RawDataBlockList blockList) throws IOException @@ -87,8 +77,7 @@ * * @param property the new Property to manage */ - - public void addProperty(final Property property) + public void addProperty(Property property) { _properties.add(property); } @@ -98,7 +87,6 @@ * * @param property the Property to be removed */ - public void removeProperty(final Property property) { _properties.remove(property); @@ -109,7 +97,6 @@ * * @return the root property */ - public RootProperty getRoot() { @@ -120,11 +107,9 @@ /** * Prepare to be written */ - public void preWrite() { - Property[] properties = - ( Property [] ) _properties.toArray(new Property[ 0 ]); + Property[] properties = _properties.toArray(new Property[ 0 ]); // give each property its index for (int k = 0; k < properties.length; k++) @@ -147,7 +132,6 @@ * * @return start block index */ - public int getStartBlock() { return _start_block; @@ -164,12 +148,12 @@ // property has no children return; } - Stack children = new Stack(); + Stack children = new Stack(); children.push(_properties.get(index)); while (!children.empty()) { - Property property = ( Property ) children.pop(); + Property property = children.pop(); root.addChild(property); if (property.isDirectory()) @@ -189,14 +173,11 @@ } } - /* ********** START implementation of BATManaged ********** */ - /** * Return the number of BigBlock's this instance uses * * @return count of BigBlock instances */ - public int countBlocks() { return (_blocks == null) ? 0 @@ -209,15 +190,11 @@ * @param index index into the array of BigBlock instances making * up the the filesystem */ - public void setStartBlock(final int index) { _start_block = index; } - /* ********** END implementation of BATManaged ********** */ - /* ********** START implementation of BlockWritable ********** */ - /** * Write the storage to an OutputStream * @@ -227,7 +204,6 @@ * @exception IOException on problems writing to the specified * stream */ - public void writeBlocks(final OutputStream stream) throws IOException { @@ -239,7 +215,4 @@ } } } - - /* ********** END implementation of BlockWritable ********** */ -} // end public class PropertyTable - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/property/RootProperty.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/RootProperty.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/property/RootProperty.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/property/RootProperty.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,14 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.property; -import java.util.*; - -import java.io.IOException; - import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.poifs.storage.SmallDocumentBlock; @@ -31,14 +25,7 @@ * * @author Marc Johnson (mjohnson at apache dot org) */ - -public class RootProperty - extends DirectoryProperty -{ - - /** - * Default constructor - */ +public final class RootProperty extends DirectoryProperty { RootProperty() { @@ -57,7 +44,6 @@ * @param array byte data * @param offset offset into byte data */ - protected RootProperty(final int index, final byte [] array, final int offset) { @@ -69,10 +55,8 @@ * * @param size size in terms of small blocks */ - public void setSize(int size) { super.setSize(SmallDocumentBlock.calcSize(size)); } -} // end public class RootProperty - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.storage; @@ -26,7 +24,6 @@ import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.util.IntegerField; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; /** @@ -35,10 +32,7 @@ * * @author Marc Johnson (mjohnson at apache dot org) */ - -public class BATBlock - extends BigBlock -{ +public final class BATBlock extends BigBlock { private static final int _entries_per_block = POIFSConstants.BIG_BLOCK_SIZE / LittleEndianConsts.INT_SIZE; private static final int _entries_per_xbat_block = _entries_per_block Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.storage; @@ -43,9 +41,7 @@ * * @author Marc Johnson (mjohnson at apache dot org) */ - -public class BlockAllocationTableReader -{ +public final class BlockAllocationTableReader { private IntList _entries; /** @@ -154,12 +150,6 @@ setEntries(blocks, raw_block_list); } - /** - * Constructor BlockAllocationTableReader - * - * - */ - BlockAllocationTableReader() { _entries = new IntList(); @@ -177,17 +167,16 @@ * * @exception IOException if there is a problem acquiring the blocks */ - ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock, final BlockList blockList) throws IOException { - List blocks = new ArrayList(); + List blocks = new ArrayList(); int currentBlock = startBlock; boolean firstPass = true; ListManagedBlock dataBlock = null; - + // Process the chain from the start to the end // Normally we have header, data, end // Sometimes we have data, header, end @@ -216,9 +205,8 @@ } } } - - return ( ListManagedBlock [] ) blocks - .toArray(new ListManagedBlock[ blocks.size() ]); + + return blocks.toArray(new ListManagedBlock[blocks.size()]); } // methods for debugging reader @@ -230,7 +218,6 @@ * * @return true if the specific block is used, else false */ - boolean isUsed(final int index) { boolean rval = false; @@ -238,9 +225,8 @@ try { rval = _entries.get(index) != -1; - } - catch (IndexOutOfBoundsException ignored) - { + } catch (IndexOutOfBoundsException e) { + // ignored } return rval; } @@ -256,7 +242,6 @@ * * @exception IOException if the current block is unused */ - int getNextBlockIndex(final int index) throws IOException { @@ -264,10 +249,7 @@ { return _entries.get(index); } - else - { - throw new IOException("index " + index + " is unused"); - } + throw new IOException("index " + index + " is unused"); } /** @@ -276,10 +258,7 @@ * @param blocks the array of blocks containing the indices * @param raw_blocks the list of blocks being managed. Unused * blocks will be eliminated from the list - * - * @exception IOException */ - private void setEntries(final ListManagedBlock [] blocks, final BlockList raw_blocks) throws IOException @@ -308,5 +287,4 @@ } raw_blocks.setBAT(this); } -} // end class BlockAllocationTableReader - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,20 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.storage; import java.io.IOException; import java.io.OutputStream; -import java.util.*; - import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.poifs.filesystem.BATManaged; import org.apache.poi.util.IntList; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.LittleEndianConsts; /** * This class manages and creates the Block Allocation Table, which is @@ -45,10 +39,7 @@ * * @author Marc Johnson (mjohnson at apache dot org) */ - -public class BlockAllocationTableWriter - implements BlockWritable, BATManaged -{ +public final class BlockAllocationTableWriter implements BlockWritable, BATManaged { private IntList _entries; private BATBlock[] _blocks; private int _start_block; @@ -56,7 +47,6 @@ /** * create a BlockAllocationTableWriter */ - public BlockAllocationTableWriter() { _start_block = POIFSConstants.END_OF_CHAIN; @@ -69,7 +59,6 @@ * * @return start block index of BAT blocks */ - public int createBlocks() { int xbat_blocks = 0; @@ -92,11 +81,8 @@ // stable ... we're OK break; } - else - { - bat_blocks = calculated_bat_blocks; - xbat_blocks = calculated_xbat_blocks; - } + bat_blocks = calculated_bat_blocks; + xbat_blocks = calculated_xbat_blocks; } int startBlock = allocateSpace(bat_blocks); @@ -112,7 +98,6 @@ * * @return the starting index of the blocks */ - public int allocateSpace(final int blockCount) { int startBlock = _entries.size(); @@ -136,7 +121,6 @@ * * @return the starting block index */ - public int getStartBlock() { return _start_block; @@ -145,14 +129,11 @@ /** * create the BATBlocks */ - void simpleCreateBlocks() { _blocks = BATBlock.createBATBlocks(_entries.toArray()); } - /* ********** START implementation of BlockWritable ********** */ - /** * Write the storage to an OutputStream * @@ -162,7 +143,6 @@ * @exception IOException on problems writing to the specified * stream */ - public void writeBlocks(final OutputStream stream) throws IOException { @@ -172,15 +152,11 @@ } } - /* ********** END implementation of BlockWritable ********** */ - /* ********** START implementation of BATManaged ********** */ - /** * Return the number of BigBlock's this instance uses * * @return count of BigBlock instances */ - public int countBlocks() { return _blocks.length; @@ -188,15 +164,9 @@ /** * Set the start block for this instance - * - * @param start_block */ - public void setStartBlock(int start_block) { _start_block = start_block; } - - /* ********** END implementation of BATManaged ********** */ -} // end class BlockAllocationTableWriter - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,30 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.storage; -import java.io.*; - -import java.util.*; +import java.io.IOException; /** * A simple implementation of BlockList * * @author Marc Johnson (mjohnson at apache dot org */ - -class BlockListImpl - implements BlockList -{ +abstract class BlockListImpl implements BlockList { private ListManagedBlock[] _blocks; private BlockAllocationTableReader _bat; - /** - * Constructor BlockListImpl - */ - protected BlockListImpl() { _blocks = new ListManagedBlock[ 0 ]; @@ -50,21 +39,17 @@ * * @param blocks blocks to be managed */ - protected void setBlocks(final ListManagedBlock [] blocks) { _blocks = blocks; } - /* ********** START implementation of BlockList ********** */ - /** * remove the specified block from the list * * @param index the index of the specified block; if the index is * out of range, that's ok */ - public void zap(final int index) { if ((index >= 0) && (index < _blocks.length)) @@ -72,13 +57,13 @@ _blocks[ index ] = null; } } - + /** * Unit testing method. Gets, without sanity checks or * removing. */ - protected ListManagedBlock get(final int index) throws IOException { - return _blocks[index]; + protected ListManagedBlock get(final int index) { + return _blocks[index]; } /** @@ -91,7 +76,6 @@ * @exception IOException if the index is out of range or has * already been removed */ - public ListManagedBlock remove(final int index) throws IOException { @@ -112,7 +96,7 @@ catch (ArrayIndexOutOfBoundsException ignored) { throw new IOException("Cannot remove block[ " + index - + " ]; out of range[ 0 - " + + + " ]; out of range[ 0 - " + (_blocks.length-1) + " ]"); } return result; @@ -128,7 +112,6 @@ * * @exception IOException if blocks are missing */ - public ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock) throws IOException { @@ -144,10 +127,7 @@ * set the associated BlockAllocationTable * * @param bat the associated BlockAllocationTable - * - * @exception IOException */ - public void setBAT(final BlockAllocationTableReader bat) throws IOException { @@ -158,7 +138,4 @@ } _bat = bat; } - - /* ********** END implementation of BlockList ********** */ -} // end package-scope class BlockListImpl - +} Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java?rev=805262&r1=805261&r2=805262&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java (original) +++ poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java Tue Aug 18 02:41:45 2009 @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,23 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.poifs.storage; import org.apache.poi.poifs.common.POIFSConstants; -import org.apache.poi.util.IntegerField; -import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.LongField; -import org.apache.poi.util.ShortField; /** * Constants used in reading/writing the Header block * * @author Marc Johnson (mjohnson at apache dot org) */ - public interface HeaderBlockConstants { public static final long _signature = 0xE11AB1A1E011CFD0L; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org