poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r805284 [1/8] - in /poi/trunk/src: examples/src/org/apache/poi/hssf/usermodel/examples/ java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/eventmodel/ java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf...
Date Tue, 18 Aug 2009 05:29:55 GMT
Author: josh
Date: Tue Aug 18 05:29:53 2009
New Revision: 805284

URL: http://svn.apache.org/viewvc?rev=805284&view=rev
Log:
Fixing compiler warnings - unnecessary typecasts

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
    poi/trunk/src/java/org/apache/poi/hpsf/Util.java
    poi/trunk/src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java
    poi/trunk/src/java/org/apache/poi/hssf/model/LinkTable.java
    poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
    poi/trunk/src/java/org/apache/poi/hssf/record/SSTRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/java/org/apache/poi/hssf/util/RKUtil.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
    poi/trunk/src/java/org/apache/poi/poifs/property/Property.java
    poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
    poi/trunk/src/java/org/apache/poi/ss/util/Region.java
    poi/trunk/src/java/org/apache/poi/util/BinaryTree.java
    poi/trunk/src/java/org/apache/poi/util/POILogger.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/RelationshipSource.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackagePart.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPrintSetup.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFHyperlink.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/StyleSheet.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.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/hdgf/HDGFLZW.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.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/record/CString.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ColorSchemeAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/DocumentAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/EscherTextboxWrapper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlidePersistAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextHeaderAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.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/TCAbstractType.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmUncompressor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/HWPFList.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java
    poi/trunk/src/testcases/org/apache/poi/hssf/eventmodel/TestModelFactory.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java Tue Aug 18 05:29:53 2009
@@ -238,7 +238,6 @@
             String imageFile, double reqImageWidthMM, double reqImageHeightMM,
             int resizeBehaviour) throws FileNotFoundException, IOException,
                                                      IllegalArgumentException  {
-        HSSFRow row = null;
         HSSFClientAnchor anchor = null;
         HSSFPatriarch patriarch = null;
         ClientAnchorDetail rowClientAnchorDetail = null;
@@ -280,7 +279,7 @@
         // image as the size of the row/column is adjusted. This could easilly
         // become another parameter passed to the method.
         anchor.setAnchorType(HSSFClientAnchor.DONT_MOVE_AND_RESIZE);
-        
+
         // Now, add the picture to the workbook. Note that the type is assumed
         // to be a JPEG/JPG, this could easily (and should) be parameterised
         // however.
@@ -485,7 +484,6 @@
         double colWidthMM = 0.0D;
         double overlapMM = 0.0D;
         double coordinatePositionsPerMM = 0.0D;
-        int fromNumber = startingColumn;
         int toColumn = startingColumn;
         int inset = 0;
 
@@ -522,7 +520,7 @@
             // total number of co-ordinate positions to the third paramater
             // of the ClientAnchorDetail constructor. For no sepcific reason,
             // the latter option is used below.
-            anchorDetail = new ClientAnchorDetail(startingColumn, 
+            anchorDetail = new ClientAnchorDetail(startingColumn,
                     toColumn, ConvertImageUnits.TOTAL_COLUMN_COORDINATE_POSITIONS);
         }
         // In this case, the image will overlap part of another column and it is
@@ -706,8 +704,6 @@
      * @param args the command line arguments
      */
     public static void main(String[] args) {
-        File file = null;
-        FileInputStream fis = null;
         FileOutputStream fos = null;
         HSSFWorkbook workbook = null;
         HSSFSheet sheet = null;
@@ -761,13 +757,13 @@
      *      * Together, parameter seven and eight determine the column and row
      *      co-ordinates of the cell whose top left hand corner will be aligned
      *      with the images bottom right hand corner.
-     * 
+     *
      * An instance of the ClientAnchorDetail class provides three of the eight
      * parameters, one of the co-ordinates for the images top left hand corner,
-     * one of the co-ordinates for the images bottom right hand corner and 
+     * one of the co-ordinates for the images bottom right hand corner and
      * either how far the image should be inset from the top or the left hand
      * edge of the cell.
-     * 
+     *
      * @author Mark Beardsley [msb at apache.org]
      * @version 1.00 5th August 2009.
      */
@@ -892,7 +888,7 @@
             int pixels = (widthUnits / EXCEL_COLUMN_WIDTH_FACTOR)
                     * UNIT_OFFSET_LENGTH;
             int offsetWidthUnits = widthUnits % EXCEL_COLUMN_WIDTH_FACTOR;
-            pixels += Math.round((float) offsetWidthUnits /
+            pixels += Math.round(offsetWidthUnits /
                     ((float) EXCEL_COLUMN_WIDTH_FACTOR / UNIT_OFFSET_LENGTH));
             return pixels;
         }
@@ -923,4 +919,4 @@
                     ConvertImageUnits.PIXELS_PER_MILLIMETRES)));
         }
     }
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/java/org/apache/poi/hpsf/Util.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Util.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Util.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Util.java Tue Aug 18 05:29:53 2009
@@ -177,7 +177,7 @@
      *
      * @param date The date to be converted
      * @return The filetime
-     * 
+     *
      * @see #filetimeToDate(long)
      * @see #filetimeToDate(int, int)
      */
@@ -211,10 +211,10 @@
      * @return <code>true</code> if the collections are equal, else
      * <code>false</code>.
      */
-    public static boolean equals(final Collection c1, final Collection c2)
+    public static boolean equals(Collection<?> c1, Collection<?> c2)
     {
-        final Object[] o1 = c1.toArray();
-        final Object[] o2 = c2.toArray();
+        Object[] o1 = c1.toArray();
+        Object[] o2 = c2.toArray();
         return internalEquals(o1, o2);
     }
 
@@ -229,14 +229,14 @@
      * @return <code>true</code> if the object arrays are equal,
      * <code>false</code> if they are not.
      */
-    public static boolean equals(final Object[] c1, final Object[] c2)
+    public static boolean equals(Object[] c1, Object[] c2)
     {
-        final Object[] o1 = (Object[]) c1.clone();
-        final Object[] o2 = (Object[]) c2.clone();
+        final Object[] o1 = c1.clone();
+        final Object[] o2 = c2.clone();
         return internalEquals(o1, o2);
     }
 
-    private static boolean internalEquals(final Object[] o1, final Object[] o2)
+    private static boolean internalEquals(Object[] o1, Object[] o2)
     {
         for (int i1 = 0; i1 < o1.length; i1++)
         {
@@ -326,9 +326,9 @@
     /**
      * <p>Returns a textual representation of a {@link Throwable}, including a
      * stacktrace.</p>
-     * 
+     *
      * @param t The {@link Throwable}
-     * 
+     *
      * @return a string containing the output of a call to
      * <code>t.printStacktrace()</code>.
      */

Modified: poi/trunk/src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java Tue Aug 18 05:29:53 2009
@@ -24,10 +24,10 @@
 
 /**
  * Event-based record factory.  As opposed to RecordFactory
- * this version sends {@link ERFListener#processRecord(Record) } messages to 
+ * this version sends {@link ERFListener#processRecord(Record) } messages to
  * the supplied listener.  Record notifications are sent one record behind
  * to ensure that {@link ContinueRecord}s are processed first.
- * 
+ *
  * @author Andrew C. Oliver (acoliver@apache.org) - probably to blame for the bugs (so yank his chain on the list)
  * @author Marc Johnson (mjohnson at apache dot org) - methods taken from RecordFactory
  * @author Glen Stampoultzis (glens at apache.org) - methods taken from RecordFactory
@@ -35,87 +35,87 @@
  */
 public final class EventRecordFactory {
 
-    private final ERFListener _listener;
+	private final ERFListener _listener;
 	private final short[] _sids;
 
-    /**
-     *
-     * @param sids an array of Record.sid values identifying the records
-     * the listener will work with.  Alternatively if this is "null" then 
-     * all records are passed. For all 'known' record types use {@link RecordFactory#getAllKnownRecordSIDs()}
-     */
-    public EventRecordFactory(ERFListener listener, short[] sids) {
-        _listener = listener;
-        if (sids == null) {
-        	_sids = null;
-        } else {
-            _sids = (short[]) sids.clone();
-            Arrays.sort(_sids); // for faster binary search
-        }
-    }
+	/**
+	 *
+	 * @param sids an array of Record.sid values identifying the records
+	 * the listener will work with.  Alternatively if this is "null" then
+	 * all records are passed. For all 'known' record types use {@link RecordFactory#getAllKnownRecordSIDs()}
+	 */
+	public EventRecordFactory(ERFListener listener, short[] sids) {
+		_listener = listener;
+		if (sids == null) {
+			_sids = null;
+		} else {
+			_sids = sids.clone();
+			Arrays.sort(_sids); // for faster binary search
+		}
+	}
 	private boolean isSidIncluded(short sid) {
 		if (_sids == null) {
 			return true;
 		}
 		return Arrays.binarySearch(_sids, sid) >= 0;
-	}   
+	}
+
 
+	/**
+	 * sends the record event to all registered listeners.
+	 * @param record the record to be thrown.
+	 * @return <code>false</code> to abort.  This aborts
+	 * out of the event loop should the listener return false
+	 */
+	private boolean processRecord(Record record) {
+		if (!isSidIncluded(record.getSid())) {
+			return true;
+		}
+		return _listener.processRecord(record);
+	}
 
-    /**
-     * sends the record event to all registered listeners.
-     * @param record the record to be thrown.
-     * @return <code>false</code> to abort.  This aborts
-     * out of the event loop should the listener return false
-     */
-    private boolean processRecord(Record record) {
-    	if (!isSidIncluded(record.getSid())) {
-    		return true;
-    	}
-    	return _listener.processRecord(record);
-    }
-
-    /**
-     * Create an array of records from an input stream
-     *
-     * @param in the InputStream from which the records will be
-     *           obtained
-     *
-     * @exception RecordFormatException on error processing the
-     *            InputStream
-     */
-    public void processRecords(InputStream in) throws RecordFormatException {
-        Record last_record = null;
-
-        RecordInputStream recStream = new RecordInputStream(in);
-
-        while (recStream.hasNextRecord()) {
-            recStream.nextRecord();
-            Record[] recs = RecordFactory.createRecord(recStream);   // handle MulRK records
-            if (recs.length > 1) {
-                for (int k = 0; k < recs.length; k++) {
-                    if ( last_record != null ) {
-                        if (!processRecord(last_record)) {
-                            return;   
-                        }
-                    }
-                    last_record = recs[ k ]; // do to keep the algorithm homogeneous...you can't
-                }                            // actually continue a number record anyhow.
-            } else {
-                Record record = recs[ 0 ];
-
-                if (record != null) {
-                    if (last_record != null) {
-                        if (!processRecord(last_record)) {
-                            return;   
-                        }
-                    }
-                     last_record = record;
-                }
-            }
-        }
-            
-        if (last_record != null) {
-        	processRecord(last_record);               
-        }
-    }
-}
\ No newline at end of file
+	/**
+	 * Create an array of records from an input stream
+	 *
+	 * @param in the InputStream from which the records will be
+	 *		   obtained
+	 *
+	 * @exception RecordFormatException on error processing the
+	 *			InputStream
+	 */
+	public void processRecords(InputStream in) throws RecordFormatException {
+		Record last_record = null;
+
+		RecordInputStream recStream = new RecordInputStream(in);
+
+		while (recStream.hasNextRecord()) {
+			recStream.nextRecord();
+			Record[] recs = RecordFactory.createRecord(recStream);   // handle MulRK records
+			if (recs.length > 1) {
+				for (int k = 0; k < recs.length; k++) {
+					if ( last_record != null ) {
+						if (!processRecord(last_record)) {
+							return;
+						}
+					}
+					last_record = recs[ k ]; // do to keep the algorithm homogeneous...you can't
+				}							// actually continue a number record anyhow.
+			} else {
+				Record record = recs[ 0 ];
+
+				if (record != null) {
+					if (last_record != null) {
+						if (!processRecord(last_record)) {
+							return;
+						}
+					}
+					 last_record = record;
+				}
+			}
+		}
+
+		if (last_record != null) {
+			processRecord(last_record);
+		}
+	}
+}

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/LinkTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/LinkTable.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/LinkTable.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/LinkTable.java Tue Aug 18 05:29:53 2009
@@ -65,8 +65,8 @@
  * @author Josh Micich
  */
 final class LinkTable {
-	
-	
+
+
 	// TODO make this class into a record aggregate
 
 	private static final class CRNBlock {
@@ -84,7 +84,7 @@
 			_crns = crns;
 		}
 		public CRNRecord[] getCrns() {
-			return (CRNRecord[]) _crns.clone();
+			return _crns.clone();
 		}
 	}
 
@@ -95,7 +95,7 @@
 
 		public ExternalBookBlock(RecordStream rs) {
 			_externalBookRecord = (SupBookRecord) rs.getNext();
-			List temp = new ArrayList();
+			List<Object> temp = new ArrayList<Object>();
 			while(rs.peekNextClass() == ExternalNameRecord.class) {
 			   temp.add(rs.getNext());
 			}
@@ -141,7 +141,7 @@
 
 	private final ExternalBookBlock[] _externalBookBlocks;
 	private final ExternSheetRecord _externSheetRecord;
-	private final List _definedNames;
+	private final List<NameRecord> _definedNames;
 	private final int _recordCount;
 	private final WorkbookRecordList _workbookRecordList; // TODO - would be nice to remove this
 
@@ -150,15 +150,15 @@
 		_workbookRecordList = workbookRecordList;
 		RecordStream rs = new RecordStream(inputList, startIndex);
 
-		List temp = new ArrayList();
+		List<ExternalBookBlock> temp = new ArrayList<ExternalBookBlock>();
 		while(rs.peekNextClass() == SupBookRecord.class) {
 		   temp.add(new ExternalBookBlock(rs));
 		}
-		
+
 		_externalBookBlocks = new ExternalBookBlock[temp.size()];
 		temp.toArray(_externalBookBlocks);
 		temp.clear();
-		
+
 		if (_externalBookBlocks.length > 0) {
 			// If any ExternalBookBlock present, there is always 1 of ExternSheetRecord
 			if (rs.peekNextClass() != ExternSheetRecord.class) {
@@ -170,8 +170,8 @@
 		} else {
 			_externSheetRecord = null;
 		}
-		
-		_definedNames = new ArrayList();
+
+		_definedNames = new ArrayList<NameRecord>();
 		// collect zero or more DEFINEDNAMEs id=0x18
 		while(rs.peekNextClass() == NameRecord.class) {
 			NameRecord nr = (NameRecord)rs.getNext();
@@ -183,19 +183,19 @@
 	}
 
 	private static ExternSheetRecord readExtSheetRecord(RecordStream rs) {
-		List temp = new ArrayList(2);
+		List<ExternSheetRecord> temp = new ArrayList<ExternSheetRecord>(2);
 		while(rs.peekNextClass() == ExternSheetRecord.class) {
-			temp.add(rs.getNext());
+			temp.add((ExternSheetRecord) rs.getNext());
 		}
-		
+
 		int nItems = temp.size();
 		if (nItems < 1) {
-			throw new RuntimeException("Expected an EXTERNSHEET record but got (" 
+			throw new RuntimeException("Expected an EXTERNSHEET record but got ("
 					+ rs.peekNextClass().getName() + ")");
 		}
 		if (nItems == 1) {
 			// this is the normal case. There should be just one ExternSheetRecord
-			return (ExternSheetRecord) temp.get(0);
+			return temp.get(0);
 		}
 		// Some apps generate multiple ExternSheetRecords (see bug 45698).
 		// It seems like the best thing to do might be to combine these into one
@@ -206,7 +206,7 @@
 
 	public LinkTable(int numberOfSheets, WorkbookRecordList workbookRecordList) {
 		_workbookRecordList = workbookRecordList;
-		_definedNames = new ArrayList();
+		_definedNames = new ArrayList<NameRecord>();
 		_externalBookBlocks = new ExternalBookBlock[] {
 				new ExternalBookBlock(numberOfSheets),
 		};
@@ -267,7 +267,7 @@
 	}
 
 	public NameRecord getNameRecord(int index) {
-		return (NameRecord) _definedNames.get(index);
+		return _definedNames.get(index);
 	}
 
 	public void addName(NameRecord name) {
@@ -301,9 +301,9 @@
 		}
 		return false;
 	}
-	
+
 	private static boolean isDuplicatedNames(NameRecord firstName, NameRecord lastName) {
-		return lastName.getNameText().equalsIgnoreCase(firstName.getNameText()) 
+		return lastName.getNameText().equalsIgnoreCase(firstName.getNameText())
 			&& isSameSheetNames(firstName, lastName);
 	}
 	private static boolean isSameSheetNames(NameRecord firstName, NameRecord lastName) {
@@ -342,10 +342,10 @@
 			throw new RuntimeException("No external workbook with name '" + workbookName + "'");
 		}
 		int sheetIndex = getSheetIndex(ebrTarget.getSheetNames(), sheetName);
-		
+
 		int result = _externSheetRecord.getRefIxForSheet(externalBookIndex, sheetIndex);
 		if (result < 0) {
-			throw new RuntimeException("ExternSheetRecord does not contain combination (" 
+			throw new RuntimeException("ExternSheetRecord does not contain combination ("
 					+ externalBookIndex + ", " + sheetIndex + ")");
 		}
 		return result;
@@ -356,7 +356,7 @@
 			if (sheetNames[i].equals(sheetName)) {
 				return i;
 			}
-			
+
 		}
 		throw new RuntimeException("External workbook does not contain sheet '" + sheetName + "'");
 	}
@@ -428,7 +428,7 @@
 				continue;
 			}
 			// found it.
-			int sheetRefIndex = findRefIndexFromExtBookIndex(i); 
+			int sheetRefIndex = findRefIndexFromExtBookIndex(i);
 			if (sheetRefIndex >= 0) {
 				return new NameXPtg(sheetRefIndex, definedNameIndex);
 			}
@@ -437,6 +437,6 @@
 	}
 
 	private int findRefIndexFromExtBookIndex(int extBookIndex) {
-		return _externSheetRecord.findRefIndexFromExtBookIndex(extBookIndex); 
+		return _externSheetRecord.findRefIndexFromExtBookIndex(extBookIndex);
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/EscherAggregate.java Tue Aug 18 05:29:53 2009
@@ -465,7 +465,7 @@
 			pos += temp;
 
 			// Write the matching OBJ record
-			Record obj = (Record) shapeToObj.get( shapes.get( i ) );
+			Record obj = shapeToObj.get( shapes.get( i ) );
 			temp = obj.serialize( pos, data );
 			pos += temp;
 
@@ -535,7 +535,7 @@
 	{
 		this.patriarch = patriarch;
 	}
-	
+
 	/**
 	 * Converts the Records into UserModel
 	 *  objects on the bound HSSFPatriarch
@@ -544,7 +544,7 @@
 		if(patriarch == null) {
 			throw new IllegalStateException("Must call setPatriarch() first");
 		}
-		
+
 		// The top level container ought to have
 		//  the DgRecord and the container of one container
 		//  per shape group (patriach overall first)
@@ -552,14 +552,13 @@
 		if(topContainer == null) {
 			return;
 		}
-		topContainer = (EscherContainerRecord) 
-			topContainer.getChildContainers().get(0);
-		
+		topContainer = topContainer.getChildContainers().get(0);
+
 		List tcc = topContainer.getChildContainers();
 		if(tcc.size() == 0) {
 			throw new IllegalStateException("No child escher containers at the point that should hold the patriach data, and one container per top level shape!");
 		}
-		
+
 		// First up, get the patriach position
 		// This is in the first EscherSpgrRecord, in
 		//  the first container, with a EscherSRecord too
@@ -579,7 +578,7 @@
 					spgr.getRectX2(), spgr.getRectY2()
 			);
 		}
-		
+
 		// Now process the containers for each group
 		//  and objects
 		for(int i=1; i<tcc.size(); i++) {
@@ -587,7 +586,7 @@
 				(EscherContainerRecord)tcc.get(i);
 			//System.err.println("\n\n*****\n\n");
 			//System.err.println(shapeContainer);
-			
+
 			// Could be a group, or a base object
 			if(shapeContainer.getChildRecords().size() == 1 &&
 					shapeContainer.getChildContainers().size() == 1) {
@@ -595,7 +594,7 @@
 				HSSFShapeGroup group =
 					new HSSFShapeGroup(null, new HSSFClientAnchor());
 				patriarch.getChildren().add(group);
-				
+
 				EscherContainerRecord groupContainer =
 					(EscherContainerRecord)shapeContainer.getChild(0);
 				convertRecordsToUserModel(groupContainer, group);
@@ -604,7 +603,7 @@
 				HSSFTextbox box =
 					new HSSFTextbox(null, new HSSFClientAnchor());
 				patriarch.getChildren().add(box);
-				
+
 				convertRecordsToUserModel(shapeContainer, box);
 			} else if(shapeContainer.hasChildOfType((short)0xF011)) {
 				// Not yet supporting EscherClientDataRecord stuff
@@ -613,7 +612,7 @@
 				convertRecordsToUserModel(shapeContainer, patriarch);
 			}
 		}
-		
+
 		// Now, clear any trace of what records make up
 		//  the patriarch
 		// Otherwise, everything will go horribly wrong
@@ -625,14 +624,14 @@
 		//  back into shapes
 		log.log(POILogger.WARN, "Not processing objects into Patriarch!");
 	}
-	
+
 	private void convertRecordsToUserModel(EscherContainerRecord shapeContainer, Object model) {
 		for(Iterator<EscherRecord> it = shapeContainer.getChildIterator(); it.hasNext();) {
 			EscherRecord r = it.next();
 			if(r instanceof EscherSpgrRecord) {
 				// This may be overriden by a later EscherClientAnchorRecord
 				EscherSpgrRecord spgr = (EscherSpgrRecord)r;
-				
+
 				if(model instanceof HSSFShapeGroup) {
 					HSSFShapeGroup g = (HSSFShapeGroup)model;
 					g.setCoordinates(
@@ -642,10 +641,10 @@
 				} else {
 					throw new IllegalStateException("Got top level anchor but not processing a group");
 				}
-			} 
+			}
 			else if(r instanceof EscherClientAnchorRecord) {
 				EscherClientAnchorRecord car = (EscherClientAnchorRecord)r;
-				
+
 				if(model instanceof HSSFShape) {
 					HSSFShape g = (HSSFShape)model;
 					g.getAnchor().setDx1(car.getDx1());
@@ -658,7 +657,7 @@
 			}
 			else if(r instanceof EscherTextboxRecord) {
 				EscherTextboxRecord tbr = (EscherTextboxRecord)r;
-				
+
 				// Also need to find the TextObjectRecord too
 				// TODO
 			}
@@ -673,7 +672,7 @@
 			}
 		}
 	}
-	
+
 	public void clear()
 	{
 		clearEscherRecords();
@@ -742,7 +741,7 @@
 					EscherRecord escherTextbox = ( (TextboxShape) shapeModel ).getEscherTextbox();
 					shapeToObj.put( escherTextbox, ( (TextboxShape) shapeModel ).getTextObjectRecord() );
 					//					escherParent.addChildRecord(escherTextbox);
-					
+
 					if ( shapeModel instanceof CommentShape ){
 						CommentShape comment = (CommentShape)shapeModel;
 						tailRec.add(comment.getNoteRecord());

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SSTRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SSTRecord.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/SSTRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/SSTRecord.java Tue Aug 18 05:29:53 2009
@@ -68,9 +68,6 @@
     /** Offsets relative the start of the current SST or continue record */
     int[] bucketRelativeOffsets;
 
-    /**
-     * default constructor
-     */
     public SSTRecord()
     {
         field_1_num_strings = 0;
@@ -86,8 +83,7 @@
      *
      * @return the index of that string in the table
      */
-
-    public int addString( final UnicodeString string )
+    public int addString(UnicodeString string)
     {
         field_1_num_strings++;
         UnicodeString ucs = ( string == null ) ? EMPTY_STRING
@@ -95,12 +91,9 @@
         int rval;
         int index = field_3_strings.getIndex(ucs);
 
-        if ( index != -1 )
-        {
+        if ( index != -1 ) {
             rval = index;
-        }
-        else
-        {
+        } else {
             // This is a new string -- we didn't see it among the
             // strings we've already collected
             rval = field_3_strings.size();
@@ -113,7 +106,6 @@
     /**
      * @return number of strings
      */
-
     public int getNumStrings()
     {
         return field_1_num_strings;
@@ -122,7 +114,6 @@
     /**
      * @return number of unique strings
      */
-
     public int getNumUniqueStrings()
     {
         return field_2_num_unique_strings;
@@ -136,8 +127,7 @@
      *
      * @return the desired string
      */
-
-    public UnicodeString getString( final int id )
+    public UnicodeString getString(int id )
     {
         return (UnicodeString) field_3_strings.get( id );
     }
@@ -148,9 +138,7 @@
      *
      * @return string representation
      */
-
-    public String toString()
-    {
+    public String toString() {
         StringBuffer buffer = new StringBuffer();
 
         buffer.append( "[SST]\n" );
@@ -168,11 +156,7 @@
         return buffer.toString();
     }
 
-    /**
-     * @return sid
-     */
-    public short getSid()
-    {
+    public short getSid() {
         return sid;
     }
 
@@ -254,9 +238,7 @@
      *
      * @param in the RecordInputstream to read the record from
      */
-
-    public SSTRecord( RecordInputStream in )
-    {
+    public SSTRecord(RecordInputStream in) {
         // this method is ALWAYS called after construction -- using
         // the nontrivial constructor, of course -- so this is where
         // we initialize our fields
@@ -272,7 +254,6 @@
      * @return an iterator of the strings we hold. All instances are
      *         UnicodeStrings
      */
-
     Iterator getStrings()
     {
         return field_3_strings.iterator();
@@ -281,9 +262,7 @@
     /**
      * @return count of the strings we hold.
      */
-
-    int countStrings()
-    {
+    int countStrings() {
         return field_3_strings.size();
     }
 
@@ -294,8 +273,7 @@
         bucketRelativeOffsets = serializer.getBucketRelativeOffsets();
     }
 
-    SSTDeserializer getDeserializer()
-    {
+    SSTDeserializer getDeserializer() {
         return deserializer;
     }
 
@@ -312,15 +290,14 @@
      *                      SST record.
      * @return  The new SST record.
      */
-    public ExtSSTRecord createExtSSTRecord(int sstOffset)
-    {
+    public ExtSSTRecord createExtSSTRecord(int sstOffset) {
         if (bucketAbsoluteOffsets == null || bucketAbsoluteOffsets == null)
             throw new IllegalStateException("SST record has not yet been serialized.");
 
         ExtSSTRecord extSST = new ExtSSTRecord();
         extSST.setNumStringsPerBucket((short)8);
-        int[] absoluteOffsets = (int[]) bucketAbsoluteOffsets.clone();
-        int[] relativeOffsets = (int[]) bucketRelativeOffsets.clone();
+        int[] absoluteOffsets = bucketAbsoluteOffsets.clone();
+        int[] relativeOffsets = bucketRelativeOffsets.clone();
         for ( int i = 0; i < absoluteOffsets.length; i++ )
             absoluteOffsets[i] += sstOffset;
         extSST.setBucketOffsets(absoluteOffsets, relativeOffsets);
@@ -333,8 +310,7 @@
      *
      * @return  The size of the ExtSST record in bytes.
      */
-    public int calcExtSSTRecordSize()
-    {
+    public int calcExtSSTRecordSize() {
       return ExtSSTRecord.getRecordSizeForStrings(field_3_strings.size());
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java Tue Aug 18 05:29:53 2009
@@ -25,10 +25,10 @@
 
 /**
  * Font Formatting Block of the Conditional Formatting Rule Record.
- * 
+ *
  * @author Dmitriy Kumshayev
  */
-public final class FontFormatting 
+public final class FontFormatting
 {
 	private byte[] _rawData;
 
@@ -45,7 +45,7 @@
 	private static final int OFFSET_FONT_WEIGHT_MODIFIED = 100;
 	private static final int OFFSET_NOT_USED1 = 104;
 	private static final int OFFSET_NOT_USED2 = 108;
-	private static final int OFFSET_NOT_USED3 = 112; // for some reason Excel always writes  0x7FFFFFFF at this offset   
+	private static final int OFFSET_NOT_USED3 = 112; // for some reason Excel always writes  0x7FFFFFFF at this offset
 	private static final int OFFSET_FONT_FORMATING_END = 116;
 	private static final int RAW_DATA_SIZE = 118;
 
@@ -71,15 +71,15 @@
 	public static final short SS_SUPER = 1;
 	/** Escapement type - Subscript */
 	public static final short SS_SUB   = 2;
-	/** Underline type - None */ 
+	/** Underline type - None */
 	public static final byte U_NONE               = 0;
-	/** Underline type - Single */ 
+	/** Underline type - Single */
 	public static final byte U_SINGLE             = 1;
-	/** Underline type - Double */ 
+	/** Underline type - Double */
 	public static final byte U_DOUBLE             = 2;
-	/** Underline type - Single Accounting */ 
+	/** Underline type - Single Accounting */
 	public static final byte U_SINGLE_ACCOUNTING  = 0x21;
-	/** Underline type - Double Accounting */ 
+	/** Underline type - Double Accounting */
 	public static final byte U_DOUBLE_ACCOUNTING  = 0x22;
 	/** Normal boldness (not bold) */
 	private static final short FONT_WEIGHT_NORMAL = 0x190;
@@ -92,7 +92,7 @@
 	private FontFormatting(byte[] rawData) {
 		_rawData = rawData;
 	}
-	
+
 	public FontFormatting()
 	{
 		this(new byte[RAW_DATA_SIZE]);
@@ -144,7 +144,7 @@
 	private void setInt(int offset, int value) {
 		LittleEndian.putInt( _rawData, offset, value);
 	}
-	
+
 	public byte[] getRawRecord()
 	{
 		return _rawData;
@@ -152,7 +152,7 @@
 
 	/**
 	 * sets the height of the font in 1/20th point units
-	 *  
+	 *
 	 *
 	 * @param height  fontheight (in points/20); or -1 to preserve the cell font height
 	 */
@@ -270,7 +270,7 @@
 	/**
 	 * set the font weight to bold (weight=700) or to normal(weight=400) boldness.
 	 *
-	 * @param bold - set font weight to bold if true; to normal otherwise  
+	 * @param bold - set font weight to bold if true; to normal otherwise
 	 */
 	public void setBold(boolean bold)
 	{
@@ -541,9 +541,9 @@
 		return buffer.toString();
 	}
 
-	public Object clone() 
+	public Object clone()
 	{
-		byte[] rawData = (byte[]) _rawData.clone();
+		byte[] rawData = _rawData.clone();
 		return new FontFormatting(rawData);
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/OperandResolver.java Tue Aug 18 05:29:53 2009
@@ -53,10 +53,7 @@
 		if (result instanceof ErrorEval) {
 			throw new EvaluationException((ErrorEval) result);
 		}
-		if (result instanceof ValueEval) {
-			return (ValueEval) result;
-		}
-		throw new RuntimeException("Unexpected eval type (" + result.getClass().getName() + ")");
+		return result;
 	}
 
 	/**

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java Tue Aug 18 05:29:53 2009
@@ -283,7 +283,7 @@
             excelFont = new Font( font.getName(), font.getStyle(), (int) ( font.getSize() / verticalPixelsPerPoint ));
         }
         FontDetails d = StaticFontMetrics.getFontDetails( excelFont );
-        int width = (int) ( (d.getStringWidth( str ) * 8)  + 12 );
+        int width = d.getStringWidth( str ) * 8  + 12;
         int height = (int) ( ( font.getSize() / verticalPixelsPerPoint ) + 6 ) * 2;
         y -= ( font.getSize() / verticalPixelsPerPoint ) + 2 * verticalPixelsPerPoint;    // we want to draw the shape from the top-left
         HSSFTextbox textbox = escherGroup.createTextbox( new HSSFChildAnchor( x, y, x + width, y + height ) );
@@ -357,13 +357,13 @@
      * <p>
      * This draws the polygon, with <code>nPoint</code> line segments.
      * The first <code>nPoint&nbsp;-&nbsp;1</code> line segments are
-     *  drawn between sequential points 
+     *  drawn between sequential points
      *  (<code>xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]</code>).
-     * The final line segment is a closing one, from the last point to 
+     * The final line segment is a closing one, from the last point to
      *  the first (assuming they are different).
      * <p>
      * The area inside of the polygon is defined by using an
-     *  even-odd fill rule (also known as the alternating rule), and 
+     *  even-odd fill rule (also known as the alternating rule), and
      *  the area inside of it is filled.
      * @param xPoints array of the <code>x</code> coordinates.
      * @param yPoints array of the <code>y</code> coordinates.
@@ -454,7 +454,7 @@
 
     public void setClip(int x, int y, int width, int height)
     {
-        setClip(((Shape) (new Rectangle(x,y,width,height))));
+        setClip(new Rectangle(x,y,width,height));
     }
 
     public void setClip(Shape shape)

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java Tue Aug 18 05:29:53 2009
@@ -70,14 +70,13 @@
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class EscherGraphics2d extends Graphics2D
-{
-    private EscherGraphics escherGraphics;
-    private BufferedImage img;
-    private AffineTransform trans;
-    private Stroke stroke;
-    private Paint paint;
-    private Shape deviceclip;
+public final class EscherGraphics2d extends Graphics2D {
+    private EscherGraphics _escherGraphics;
+    private BufferedImage _img;
+    private AffineTransform _trans;
+    private Stroke _stroke;
+    private Paint _paint;
+    private Shape _deviceclip;
     private POILogger logger = POILogFactory.getLogger(getClass());
 
     /**
@@ -87,7 +86,7 @@
      */
     public EscherGraphics2d(EscherGraphics escherGraphics)
     {
-        this.escherGraphics = escherGraphics;
+        this._escherGraphics = escherGraphics;
         setImg( new BufferedImage(1, 1, 2) );
         setColor(Color.black);
     }
@@ -130,7 +129,7 @@
 
     public Graphics create()
     {
-        EscherGraphics2d g2d = new EscherGraphics2d(escherGraphics);
+        EscherGraphics2d g2d = new EscherGraphics2d(_escherGraphics);
         return g2d;
     }
 
@@ -148,8 +147,8 @@
             Line2D shape2d = (Line2D) shape;
 
             int width = 0;
-            if (stroke != null && stroke instanceof BasicStroke) {
-                width = (int) ((BasicStroke)stroke).getLineWidth() * 12700;
+            if (_stroke != null && _stroke instanceof BasicStroke) {
+                width = (int) ((BasicStroke)_stroke).getLineWidth() * 12700;
             }
 
             drawLine((int)shape2d.getX1(), (int)shape2d.getY1(), (int)shape2d.getX2(), (int)shape2d.getY2(), width);
@@ -223,7 +222,7 @@
     public void drawImage(BufferedImage bufferedimage, BufferedImageOp op, int x, int y)
     {
         BufferedImage img = op.filter(bufferedimage, null);
-        drawImage(((Image) (img)), new AffineTransform(1.0F, 0.0F, 0.0F, 1.0F, x, y), null);
+        drawImage(img, new AffineTransform(1.0F, 0.0F, 0.0F, 1.0F, x, y), null);
     }
 
     public void drawLine(int x1, int y1, int x2, int y2, int width)
@@ -234,8 +233,8 @@
     public void drawLine(int x1, int y1, int x2, int y2)
     {
         int width = 0;
-        if (stroke != null && stroke instanceof BasicStroke) {
-            width = (int) ((BasicStroke)stroke).getLineWidth() * 12700;
+        if (_stroke != null && _stroke instanceof BasicStroke) {
+            width = (int) ((BasicStroke)_stroke).getLineWidth() * 12700;
         }
         getEscherGraphics().drawLine(x1,y1,x2,y2, width);
 //        draw(new GeneralPath(new java.awt.geom.Line2D.Float(x1, y1, x2, y2)));
@@ -268,7 +267,7 @@
 
     public void drawRect(int x, int y, int width, int height)
     {
-        escherGraphics.drawRect(x,y,width,height);
+        _escherGraphics.drawRect(x,y,width,height);
     }
 
     public void drawRenderableImage(RenderableImage renderableimage, AffineTransform affinetransform)
@@ -325,7 +324,7 @@
 
     public void fillOval(int x, int y, int width, int height)
     {
-        escherGraphics.fillOval(x,y,width,height);
+        _escherGraphics.fillOval(x,y,width,height);
     }
 
     /**
@@ -334,13 +333,13 @@
      * <p>
      * This draws the polygon, with <code>nPoint</code> line segments.
      * The first <code>nPoint&nbsp;-&nbsp;1</code> line segments are
-     *  drawn between sequential points 
+     *  drawn between sequential points
      *  (<code>xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]</code>).
-     * The final line segment is a closing one, from the last point to 
+     * The final line segment is a closing one, from the last point to
      *  the first (assuming they are different).
      * <p>
      * The area inside of the polygon is defined by using an
-     *  even-odd fill rule (also known as the alternating rule), and 
+     *  even-odd fill rule (also known as the alternating rule), and
      *  the area inside of it is filled.
      * @param xPoints array of the <code>x</code> coordinates.
      * @param yPoints array of the <code>y</code> coordinates.
@@ -349,7 +348,7 @@
      */
     public void fillPolygon(int xPoints[], int yPoints[], int nPoints)
     {
-        escherGraphics.fillPolygon(xPoints, yPoints, nPoints);
+        _escherGraphics.fillPolygon(xPoints, yPoints, nPoints);
     }
 
     public void fillRect(int x, int y, int width, int height)
@@ -382,15 +381,15 @@
 
     public Rectangle getClipBounds()
     {
-        if(getDeviceclip() != null)
+        if(getDeviceclip() != null) {
             return getClip().getBounds();
-        else
-            return null;
+        }
+        return null;
     }
 
     public Color getColor()
     {
-        return escherGraphics.getColor();
+        return _escherGraphics.getColor();
     }
 
     public Composite getComposite()
@@ -421,7 +420,7 @@
 
     public Paint getPaint()
     {
-        return paint;
+        return _paint;
     }
 
     public Object getRenderingHint(java.awt.RenderingHints.Key key)
@@ -436,7 +435,7 @@
 
     public Stroke getStroke()
     {
-        return stroke;
+        return _stroke;
     }
 
     public AffineTransform getTransform()
@@ -474,7 +473,7 @@
 
     public void setClip(int i, int j, int k, int l)
     {
-        setClip(((Shape) (new Rectangle(i, j, k, l))));
+        setClip(new Rectangle(i, j, k, l));
     }
 
     public void setClip(Shape shape)
@@ -484,7 +483,7 @@
 
     public void setColor(Color c)
     {
-        escherGraphics.setColor(c);
+        _escherGraphics.setColor(c);
     }
 
     public void setComposite(Composite composite)
@@ -501,7 +500,7 @@
     {
         if(paint1 != null)
         {
-            paint = paint1;
+            _paint = paint1;
             if(paint1 instanceof Color)
                 setColor( (Color)paint1 );
         }
@@ -524,7 +523,7 @@
 
     public void setStroke(Stroke s)
     {
-        stroke = s;
+        _stroke = s;
     }
 
     public void setTransform(AffineTransform affinetransform)
@@ -571,42 +570,42 @@
 
     private EscherGraphics getEscherGraphics()
     {
-        return escherGraphics;
+        return _escherGraphics;
     }
 
     private BufferedImage getImg()
     {
-        return img;
+        return _img;
     }
 
     private void setImg( BufferedImage img )
     {
-        this.img = img;
+        this._img = img;
     }
 
     private Graphics2D getG2D()
     {
-        return (Graphics2D) img.getGraphics();
+        return (Graphics2D) _img.getGraphics();
     }
 
     private AffineTransform getTrans()
     {
-        return trans;
+        return _trans;
     }
 
     private void setTrans( AffineTransform trans )
     {
-        this.trans = trans;
+        this._trans = trans;
     }
 
     private Shape getDeviceclip()
     {
-        return deviceclip;
+        return _deviceclip;
     }
 
     private void setDeviceclip( Shape deviceclip )
     {
-        this.deviceclip = deviceclip;
+        this._deviceclip = deviceclip;
     }
 
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPalette.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPalette.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPalette.java Tue Aug 18 05:29:53 2009
@@ -28,15 +28,14 @@
  *
  * @author Brian Sanders (bsanders at risklabs dot com)
  */
-public class HSSFPalette
-{
-    private PaletteRecord palette;
-    
+public final class HSSFPalette {
+    private PaletteRecord _palette;
+
     protected HSSFPalette(PaletteRecord palette)
     {
-        this.palette = palette;
+        _palette = palette;
     }
-    
+
     /**
      * Retrieves the color at a given index
      *
@@ -45,16 +44,15 @@
      */
     public HSSFColor getColor(short index)
     {
-    	//Handle the special AUTOMATIC case
-    	if (index == HSSFColor.AUTOMATIC.index)
-    		return HSSFColor.AUTOMATIC.getInstance();
-    	else {
-          byte[] b = palette.getColor(index);
+        //Handle the special AUTOMATIC case
+        if (index == HSSFColor.AUTOMATIC.index) {
+            return HSSFColor.AUTOMATIC.getInstance();
+        }
+        byte[] b = _palette.getColor(index);
           if (b != null)
           {
              return new CustomColor(index, b);
           }
-    	}
         return null;
     }
     /**
@@ -66,7 +64,7 @@
     public HSSFColor getColor(int index) {
     	return getColor((short)index);
     }
-    
+
     /**
      * Finds the first occurance of a given color
      *
@@ -77,9 +75,9 @@
      */
     public HSSFColor findColor(byte red, byte green, byte blue)
     {
-        byte[] b = palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
-        for (short i = (short) PaletteRecord.FIRST_COLOR_INDEX; b != null;
-            b = palette.getColor(++i))
+        byte[] b = _palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
+        for (short i = PaletteRecord.FIRST_COLOR_INDEX; b != null;
+            b = _palette.getColor(++i))
         {
             if (b[0] == red && b[1] == green && b[2] == blue)
             {
@@ -104,11 +102,11 @@
     {
         HSSFColor result = null;
         int minColorDistance = Integer.MAX_VALUE;
-        byte[] b = palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
-        for (short i = (short) PaletteRecord.FIRST_COLOR_INDEX; b != null;
-            b = palette.getColor(++i))
+        byte[] b = _palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
+        for (short i = PaletteRecord.FIRST_COLOR_INDEX; b != null;
+            b = _palette.getColor(++i))
         {
-            int colorDistance = Math.abs(red - b[0]) + 
+            int colorDistance = Math.abs(red - b[0]) +
             	Math.abs(green - b[1]) + Math.abs(blue - b[2]);
             if (colorDistance < minColorDistance)
             {
@@ -129,7 +127,7 @@
      */
     public void setColorAtIndex(short index, byte red, byte green, byte blue)
     {
-        palette.setColor(index, red, green, blue);
+        _palette.setColor(index, red, green, blue);
     }
 
     /**
@@ -144,9 +142,9 @@
      */
     public HSSFColor addColor( byte red, byte green, byte blue )
     {
-        byte[] b = palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
+        byte[] b = _palette.getColor(PaletteRecord.FIRST_COLOR_INDEX);
         short i;
-        for (i = (short) PaletteRecord.FIRST_COLOR_INDEX; i < PaletteRecord.STANDARD_PALETTE_SIZE + PaletteRecord.FIRST_COLOR_INDEX; b = palette.getColor(++i))
+        for (i = PaletteRecord.FIRST_COLOR_INDEX; i < PaletteRecord.STANDARD_PALETTE_SIZE + PaletteRecord.FIRST_COLOR_INDEX; b = _palette.getColor(++i))
         {
             if (b == null)
             {
@@ -157,52 +155,51 @@
         throw new RuntimeException("Could not find free color index");
     }
 
-    private static class CustomColor extends HSSFColor
-    {
-        private short byteOffset;
-        private byte red;
-        private byte green;
-        private byte blue;
-        
-        private CustomColor(short byteOffset, byte[] colors)
+    private static final class CustomColor extends HSSFColor {
+        private short _byteOffset;
+        private byte _red;
+        private byte _green;
+        private byte _blue;
+
+        public CustomColor(short byteOffset, byte[] colors)
         {
             this(byteOffset, colors[0], colors[1], colors[2]);
         }
-        
+
         private CustomColor(short byteOffset, byte red, byte green, byte blue)
         {
-            this.byteOffset = byteOffset;
-            this.red = red;
-            this.green = green;
-            this.blue = blue;
+            _byteOffset = byteOffset;
+            _red = red;
+            _green = green;
+            _blue = blue;
         }
-        
+
         public short getIndex()
         {
-            return byteOffset;
+            return _byteOffset;
         }
-        
+
         public short[] getTriplet()
         {
             return new short[]
             {
-                (short) (red   & 0xff),
-                (short) (green & 0xff),
-                (short) (blue  & 0xff)
+                (short) (_red   & 0xff),
+                (short) (_green & 0xff),
+                (short) (_blue  & 0xff)
             };
         }
-        
+
         public String getHexString()
         {
             StringBuffer sb = new StringBuffer();
-            sb.append(getGnumericPart(red));
+            sb.append(getGnumericPart(_red));
             sb.append(':');
-            sb.append(getGnumericPart(green));
+            sb.append(getGnumericPart(_green));
             sb.append(':');
-            sb.append(getGnumericPart(blue));
+            sb.append(getGnumericPart(_blue));
             return sb.toString();
         }
-        
+
         private String getGnumericPart(byte color)
         {
             String s;

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Tue Aug 18 05:29:53 2009
@@ -524,9 +524,9 @@
      * Sets the sheet name.
      * Will throw IllegalArgumentException if the name is duplicated or contains /\?*[]
      * Note - Excel allows sheet names up to 31 chars in length but other applications allow more.
-     * Excel does not crash with names longer than 31 chars, but silently truncates such names to 
+     * Excel does not crash with names longer than 31 chars, but silently truncates such names to
      * 31 chars.  POI enforces uniqueness on the first 31 chars.
-     * 
+     *
      * @param sheetIx number (0 based)
      */
     public void setSheetName(int sheetIx, String name) {
@@ -552,7 +552,7 @@
     public void setHidden(boolean hiddenFlag) {
         workbook.getWindowOne().setHidden(hiddenFlag);
     }
-    
+
     public boolean isSheetHidden(int sheetIx) {
         validateSheetIndex(sheetIx);
         return workbook.isSheetHidden(sheetIx);
@@ -618,7 +618,7 @@
     /**
      * @deprecated for POI internal use only (formula rendering).  This method is likely to
      * be removed in future versions of POI.
-     * 
+     *
      * @param refIndex Index to REF entry in EXTERNSHEET record in the Link Table
      * @param definedNameIndex zero-based to DEFINEDNAME or EXTERNALNAME record
      * @return the string representation of the defined or external name
@@ -665,10 +665,10 @@
         clonedSheet.setActive(false);
 
         String name = getUniqueSheetName(srcName);
-        int newSheetIndex = _sheets.size(); 
+        int newSheetIndex = _sheets.size();
         _sheets.add(clonedSheet);
         workbook.setSheetName(newSheetIndex, name);
-        
+
         // Check this sheet has an autofilter, (which has a built-in NameRecord at workbook level)
         int filterDbNameIndex = findExistingBuiltinNameRecordIdx(sheetIndex, NameRecord.BUILTIN_FILTER_DB);
         if (filterDbNameIndex >=0) {
@@ -679,7 +679,7 @@
             for (int i=0; i< ptgs.length; i++) {
                 Ptg ptg = ptgs[i];
                 ptg = ptg.copy();
-                
+
                 if (ptg instanceof Area3DPtg) {
                     Area3DPtg a3p = (Area3DPtg) ptg;
                     a3p.setExternSheetIndex(newExtSheetIx);
@@ -698,7 +698,7 @@
             workbook.cloneDrawings(clonedSheet.getSheet());
         }
         // TODO - maybe same logic required for other/all built-in name records
-        
+
         return clonedSheet;
     }
 
@@ -966,12 +966,12 @@
             temp.add(new MemFuncPtg(exprsSize));
         }
         if (startColumn >= 0) {
-            Area3DPtg colArea = new Area3DPtg(0, MAX_ROW, startColumn, endColumn, 
+            Area3DPtg colArea = new Area3DPtg(0, MAX_ROW, startColumn, endColumn,
                     false, false, false, false, externSheetIndex);
             temp.add(colArea);
         }
         if (startRow >= 0) {
-            Area3DPtg rowArea = new Area3DPtg(startRow, endRow, 0, MAX_COLUMN, 
+            Area3DPtg rowArea = new Area3DPtg(startRow, endRow, 0, MAX_COLUMN,
                     false, false, false, false, externSheetIndex);
             temp.add(rowArea);
         }
@@ -1136,7 +1136,7 @@
      */
     public HSSFCellStyle getCellStyleAt(short idx)
     {
-        ExtendedFormatRecord xfr = workbook.getExFormatAt((int)idx);
+        ExtendedFormatRecord xfr = workbook.getExFormatAt(idx);
         HSSFCellStyle style = new HSSFCellStyle(idx, xfr, this);
 
         return style;
@@ -1296,7 +1296,7 @@
         int result = names.size();
         return result;
     }
-    
+
     public HSSFName getName(String name) {
         int nameIndex = getNameIndex(name);
         if (nameIndex < 0) {
@@ -1311,7 +1311,7 @@
             throw new IllegalStateException("There are no defined names in this workbook");
         }
         if (nameIndex < 0 || nameIndex > nNames) {
-            throw new IllegalArgumentException("Specified name index " + nameIndex 
+            throw new IllegalArgumentException("Specified name index " + nameIndex
                     + " is outside the allowable range (0.." + (nNames-1) + ").");
         }
         return (HSSFName) names.get(nameIndex);
@@ -1394,7 +1394,7 @@
         if (name == null) {
             return null;
         }
- 
+
         return HSSFFormulaParser.toFormulaString(this, name.getNameDefinition());
     }
 
@@ -1684,7 +1684,7 @@
             }
         }
     }
-    
+
     public CreationHelper getCreationHelper() {
         return new HSSFCreationHelper(this);
     }

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/RKUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/RKUtil.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/RKUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/RKUtil.java Tue Aug 18 05:29:53 2009
@@ -27,19 +27,16 @@
  * @see org.apache.poi.hssf.record.MulRKRecord
  * @see org.apache.poi.hssf.record.RKRecord
  */
-public class RKUtil
-{
-    private RKUtil()
-    {
+public final class RKUtil {
+    private RKUtil() {
+        // no instances of this class
     }
 
     /**
      * Do the dirty work of decoding; made a private static method to
      * facilitate testing the algorithm
      */
-
-    public static double decodeNumber(int number)
-    {
+    public static double decodeNumber(int number) {
         long raw_number = number;
 
         // mask off the two low-order bits, 'cause they're not part of
@@ -51,7 +48,7 @@
         {
             // ok, it's just a plain ol' int; we can handle this
             // trivially by casting
-            rvalue = ( double ) (raw_number);
+            rvalue = raw_number;
         }
         else
         {
@@ -72,5 +69,4 @@
 
         return rvalue;
     }
-
 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java Tue Aug 18 05:29:53 2009
@@ -72,7 +72,7 @@
 	private static DocumentBlock[] convertRawBlocksToBigBlocks(ListManagedBlock[] blocks) throws IOException {
 		DocumentBlock[] result = new DocumentBlock[blocks.length];
 		for (int i = 0; i < result.length; i++) {
-			result[i] = new DocumentBlock((RawDataBlock)blocks[i]); 
+			result[i] = new DocumentBlock((RawDataBlock)blocks[i]);
 		}
 		return result;
 	}
@@ -127,7 +127,7 @@
 	 * @param stream the InputStream we read data from
 	 */
 	public POIFSDocument(String name, InputStream stream) throws IOException {
-		List blocks = new ArrayList();
+		List<DocumentBlock> blocks = new ArrayList<DocumentBlock>();
 
 		_size = 0;
 		while (true) {
@@ -142,7 +142,7 @@
 				break;
 			}
 		}
-		DocumentBlock[] bigBlocks = (DocumentBlock[]) blocks.toArray(new DocumentBlock[blocks.size()]);
+		DocumentBlock[] bigBlocks = blocks.toArray(new DocumentBlock[blocks.size()]);
 
 		_big_store = new BigBlockStore(bigBlocks);
 		_property = new DocumentProperty(name, _size);
@@ -201,7 +201,7 @@
 		int len = buffer.length;
 
 		DataInputBlock currentBlock = getDataInputBlock(offset);
-		
+
 		int blockAvailable = currentBlock.available();
 		if (blockAvailable > len) {
 			currentBlock.readFully(buffer, 0, len);
@@ -249,9 +249,8 @@
 		}
 		if (_property.shouldUseSmallBlocks()) {
 			return SmallDocumentBlock.getDataInputBlock(_small_store.getBlocks(), offset);
-		} else {
-			return DocumentBlock.getDataInputBlock(_big_store.getBlocks(), offset);
 		}
+		return DocumentBlock.getDataInputBlock(_big_store.getBlocks(), offset);
 	}
 
 	/**
@@ -377,11 +376,11 @@
 
 	/* **********  END  begin implementation of POIFSViewable ********** */
 	private static final class SmallBlockStore {
-		private SmallDocumentBlock[] smallBlocks;
-		private final POIFSDocumentPath path;
-		private final String name;
-		private final int size;
-		private final POIFSWriterListener writer;
+		private SmallDocumentBlock[] _smallBlocks;
+		private final POIFSDocumentPath _path;
+		private final String _name;
+		private final int _size;
+		private final POIFSWriterListener _writer;
 
 		/**
 		 * Constructor
@@ -389,11 +388,11 @@
 		 * @param blocks blocks to construct the store from
 		 */
 		SmallBlockStore(SmallDocumentBlock[] blocks) {
-			smallBlocks = (SmallDocumentBlock[]) blocks.clone();
-			this.path = null;
-			this.name = null;
-			this.size = -1;
-			this.writer = null;
+			_smallBlocks = blocks.clone();
+			this._path = null;
+			this._name = null;
+			this._size = -1;
+			this._writer = null;
 		}
 
 		/**
@@ -405,41 +404,41 @@
 		 * @param writer the object that will eventually write the document
 		 */
 		SmallBlockStore(POIFSDocumentPath path, String name, int size, POIFSWriterListener writer) {
-			smallBlocks = new SmallDocumentBlock[0];
-			this.path = path;
-			this.name = name;
-			this.size = size;
-			this.writer = writer;
+			_smallBlocks = new SmallDocumentBlock[0];
+			this._path = path;
+			this._name = name;
+			this._size = size;
+			this._writer = writer;
 		}
 
 		/**
 		 * @return <code>true</code> if this store is a valid source of data
 		 */
 		boolean isValid() {
-			return smallBlocks.length > 0 || writer != null;
+			return _smallBlocks.length > 0 || _writer != null;
 		}
 
 		/**
 		 * @return the SmallDocumentBlocks
 		 */
 		SmallDocumentBlock[] getBlocks() {
-			if (isValid() && writer != null) {
-				ByteArrayOutputStream stream = new ByteArrayOutputStream(size);
-				DocumentOutputStream dstream = new DocumentOutputStream(stream, size);
+			if (isValid() && _writer != null) {
+				ByteArrayOutputStream stream = new ByteArrayOutputStream(_size);
+				DocumentOutputStream dstream = new DocumentOutputStream(stream, _size);
 
-				writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, path, name, size));
-				smallBlocks = SmallDocumentBlock.convert(stream.toByteArray(), size);
+				_writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size));
+				_smallBlocks = SmallDocumentBlock.convert(stream.toByteArray(), _size);
 			}
-			return smallBlocks;
+			return _smallBlocks;
 		}
 	} // end private class SmallBlockStore
 
 	private static final class BigBlockStore {
 		private DocumentBlock[] bigBlocks;
-		private final POIFSDocumentPath path;
-		private final String name;
-		private final int size;
-		private final POIFSWriterListener writer;
+		private final POIFSDocumentPath _path;
+		private final String _name;
+		private final int _size;
+		private final POIFSWriterListener _writer;
 
 		/**
 		 * Constructor
@@ -447,11 +446,11 @@
 		 * @param blocks the blocks making up the store
 		 */
 		BigBlockStore(DocumentBlock[] blocks) {
-			bigBlocks = (DocumentBlock[]) blocks.clone();
-			this.path = null;
-			this.name = null;
-			this.size = -1;
-			this.writer = null;
+			bigBlocks = blocks.clone();
+			_path = null;
+			_name = null;
+			_size = -1;
+			_writer = null;
 		}
 
 		/**
@@ -464,29 +463,29 @@
 		 */
 		BigBlockStore(POIFSDocumentPath path, String name, int size, POIFSWriterListener writer) {
 			bigBlocks = new DocumentBlock[0];
-			this.path = path;
-			this.name = name;
-			this.size = size;
-			this.writer = writer;
+			_path = path;
+			_name = name;
+			_size = size;
+			_writer = writer;
 		}
 
 		/**
 		 * @return <code>true</code> if this store is a valid source of data
 		 */
 		boolean isValid() {
-			return bigBlocks.length > 0 || writer != null;
+			return bigBlocks.length > 0 || _writer != null;
 		}
 
 		/**
 		 * @return the DocumentBlocks
 		 */
 		DocumentBlock[] getBlocks() {
-			if (isValid() && writer != null) {
-				ByteArrayOutputStream stream = new ByteArrayOutputStream(size);
-				DocumentOutputStream dstream = new DocumentOutputStream(stream, size);
+			if (isValid() && _writer != null) {
+				ByteArrayOutputStream stream = new ByteArrayOutputStream(_size);
+				DocumentOutputStream dstream = new DocumentOutputStream(stream, _size);
 
-				writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, path, name, size));
-				bigBlocks = DocumentBlock.convert(stream.toByteArray(), size);
+				_writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size));
+				bigBlocks = DocumentBlock.convert(stream.toByteArray(), _size);
 			}
 			return bigBlocks;
 		}
@@ -498,10 +497,10 @@
 		 */
 		void writeBlocks(OutputStream stream) throws IOException {
 			if (isValid()) {
-				if (writer != null) {
-					DocumentOutputStream dstream = new DocumentOutputStream(stream, size);
+				if (_writer != null) {
+					DocumentOutputStream dstream = new DocumentOutputStream(stream, _size);
 
-					writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, path, name, size));
+					_writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size));
 					dstream.writeFiller(countBlocks() * POIFSConstants.BIG_BLOCK_SIZE,
 							DocumentBlock.getFillByte());
 				} else {
@@ -518,10 +517,10 @@
 		int countBlocks() {
 
 			if (isValid()) {
-				if (writer == null) {
+				if (_writer == null) {
 					return bigBlocks.length;
 				}
-				return (size + POIFSConstants.BIG_BLOCK_SIZE - 1)
+				return (_size + POIFSConstants.BIG_BLOCK_SIZE - 1)
 							/ POIFSConstants.BIG_BLOCK_SIZE;
 			}
 			return 0;

Modified: poi/trunk/src/java/org/apache/poi/poifs/property/Property.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/Property.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/property/Property.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/property/Property.java Tue Aug 18 05:29:53 2009
@@ -15,7 +15,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 
 package org.apache.poi.poifs.property;
 
@@ -39,9 +39,7 @@
  * @author Marc Johnson (mjohnson at apache dot org)
  */
 
-public abstract class Property
-    implements Child, POIFSViewable
-{
+public abstract class Property implements Child, POIFSViewable {
     static final private byte   _default_fill             = ( byte ) 0x00;
     static final private int    _name_size_offset         = 0x40;
     static final private int    _max_name_length          =
@@ -88,10 +86,6 @@
     private Child               _next_child;
     private Child               _previous_child;
 
-    /**
-     * Default constructor
-     */
-
     protected Property()
     {
         _raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
@@ -129,8 +123,7 @@
      * @param array byte data
      * @param offset offset into byte data
      */
-
-    protected Property(final int index, final byte [] array, final int offset)
+    protected Property(int index, byte [] array, int offset)
     {
         _raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
         System.arraycopy(array, offset, _raw_data, 0,
@@ -187,8 +180,7 @@
      * @exception IOException on problems writing to the specified
      *            stream.
      */
-
-    public void writeData(final OutputStream stream)
+    public void writeData(OutputStream stream)
         throws IOException
     {
         stream.write(_raw_data);
@@ -200,8 +192,7 @@
      *
      * @param startBlock the start block index
      */
-
-    public void setStartBlock(final int startBlock)
+    public void setStartBlock(int startBlock)
     {
         _start_block.set(startBlock, _raw_data);
     }
@@ -209,7 +200,6 @@
     /**
      * @return the start block
      */
-
     public int getStartBlock()
     {
         return _start_block.get();
@@ -220,7 +210,6 @@
      *
      * @return size in bytes
      */
-
     public int getSize()
     {
         return _size.get();
@@ -232,7 +221,6 @@
      *
      * @return true if the size is less than _big_block_minimum_bytes
      */
-
     public boolean shouldUseSmallBlocks()
     {
         return Property.isSmall(_size.get());
@@ -246,8 +234,7 @@
      * @return true if the length is less than
      *         _big_block_minimum_bytes
      */
-
-    public static boolean isSmall(final int length)
+    public static boolean isSmall(int length)
     {
         return length < _big_block_minimum_bytes;
     }
@@ -257,7 +244,6 @@
      *
      * @return property name as String
      */
-
     public String getName()
     {
         return _name;
@@ -266,7 +252,6 @@
     /**
      * @return true if a directory type Property
      */
-
     abstract public boolean isDirectory();
 
     /**
@@ -284,7 +269,7 @@
      *
      * @param name the new name
      */
-    protected final void setName(final String name)
+    protected void setName(String name)
     {
         char[] char_array = name.toCharArray();
         int    limit      = Math.min(char_array.length, _max_name_length);
@@ -329,8 +314,7 @@
      *
      * @param propertyType the property type (root, file, directory)
      */
-
-    protected void setPropertyType(final byte propertyType)
+    protected void setPropertyType(byte propertyType)
     {
         _property_type.set(propertyType, _raw_data);
     }
@@ -340,8 +324,7 @@
      *
      * @param nodeColor the node color (red or black)
      */
-
-    protected void setNodeColor(final byte nodeColor)
+    protected void setNodeColor(byte nodeColor)
     {
         _node_color.set(nodeColor, _raw_data);
     }
@@ -351,8 +334,7 @@
      *
      * @param child the child property's index in the Property Table
      */
-
-    protected void setChildProperty(final int child)
+    protected void setChildProperty(int child)
     {
         _child_property.set(child, _raw_data);
     }
@@ -362,7 +344,6 @@
      *
      * @return child property index
      */
-
     protected int getChildIndex()
     {
         return _child_property.get();
@@ -373,8 +354,7 @@
      *
      * @param size the size of the document, in bytes
      */
-
-    protected void setSize(final int size)
+    protected void setSize(int size)
     {
         _size.set(size, _raw_data);
     }
@@ -385,8 +365,7 @@
      * @param index this Property's index within its containing
      *              Property Table
      */
-
-    protected void setIndex(final int index)
+    protected void setIndex(int index)
     {
         _index = index;
     }
@@ -396,7 +375,6 @@
      *
      * @return the index of this Property within its Property Table
      */
-
     protected int getIndex()
     {
         return _index;
@@ -406,7 +384,6 @@
      * Perform whatever activities need to be performed prior to
      * writing
      */
-
     abstract protected void preWrite();
 
     /**
@@ -414,7 +391,6 @@
      *
      * @return index of next sibling
      */
-
     int getNextChildIndex()
     {
         return _next_property.get();
@@ -425,7 +401,6 @@
      *
      * @return index of previous sibling
      */
-
     int getPreviousChildIndex()
     {
         return _previous_property.get();
@@ -438,20 +413,16 @@
      *
      * @return true if the index is valid
      */
-
     static boolean isValidIndex(int index)
     {
         return index != _NO_INDEX;
     }
 
-    /* ********** START implementation of Child ********** */
-
     /**
      * Get the next Child, if any
      *
      * @return the next Child; may return null
      */
-
     public Child getNextChild()
     {
         return _next_child;
@@ -462,7 +433,6 @@
      *
      * @return the previous Child; may return null
      */
-
     public Child getPreviousChild()
     {
         return _previous_child;
@@ -474,8 +444,7 @@
      * @param child the new 'next' child; may be null, which has the
      *              effect of saying there is no 'next' child
      */
-
-    public void setNextChild(final Child child)
+    public void setNextChild(Child child)
     {
         _next_child = child;
         _next_property.set((child == null) ? _NO_INDEX
@@ -489,8 +458,7 @@
      * @param child the new 'previous' child; may be null, which has
      *              the effect of saying there is no 'previous' child
      */
-
-    public void setPreviousChild(final Child child)
+    public void setPreviousChild(Child child)
     {
         _previous_child = child;
         _previous_property.set((child == null) ? _NO_INDEX
@@ -498,16 +466,12 @@
                                                    .getIndex(), _raw_data);
     }
 
-    /* **********  END  implementation of Child ********** */
-    /* ********** START begin implementation of POIFSViewable ********** */
-
     /**
      * Get an array of objects, some of which may implement
      * POIFSViewable
      *
      * @return an array of Object; may not be null, but may be empty
      */
-
     public Object [] getViewableArray()
     {
         Object[] results = new Object[ 5 ];
@@ -518,11 +482,11 @@
         long time = _days_1.get();
 
         time         <<= 32;
-        time         += (( long ) _seconds_1.get()) & 0x0000FFFFL;
+        time         += _seconds_1.get() & 0x0000FFFFL;
         results[ 3 ] = "Time 1        = " + time;
         time         = _days_2.get();
         time         <<= 32;
-        time         += (( long ) _seconds_2.get()) & 0x0000FFFFL;
+        time         += _seconds_2.get() & 0x0000FFFFL;
         results[ 4 ] = "Time 2        = " + time;
         return results;
     }
@@ -534,7 +498,6 @@
      * @return an Iterator; may not be null, but may have an empty
      * back end store
      */
-
     public Iterator getViewableIterator()
     {
         return Collections.EMPTY_LIST.iterator();
@@ -547,7 +510,6 @@
      * @return true if a viewer should call getViewableArray, false if
      *         a viewer should call getViewableIterator
      */
-
     public boolean preferArray()
     {
         return true;
@@ -559,7 +521,6 @@
      *
      * @return short description
      */
-
     public String getShortDescription()
     {
         StringBuffer buffer = new StringBuffer();
@@ -567,7 +528,4 @@
         buffer.append("Property: \"").append(getName()).append("\"");
         return buffer.toString();
     }
-
-    /* **********  END  begin implementation of POIFSViewable ********** */
-}   // end public abstract class Property
-
+}

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java Tue Aug 18 05:29:53 2009
@@ -393,8 +393,7 @@
 				return fe.getFreeRefFunction().evaluate(ops, workbook, sheetIndex, srcRowNum, srcColNum);
 			}
 		}
-		// TODO - fix return type of this evaluate method:
-		return (ValueEval) operation.evaluate(ops, srcRowNum, (short)srcColNum);
+		return operation.evaluate(ops, srcRowNum, (short)srcColNum);
 	}
 	private SheetRefEvaluator createExternSheetRefEvaluator(EvaluationTracker tracker,
 			ExternSheetReferenceToken ptg) {

Modified: poi/trunk/src/java/org/apache/poi/ss/util/Region.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/Region.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/Region.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/Region.java Tue Aug 18 05:29:53 2009
@@ -26,197 +26,183 @@
  * @author  Andrew C. Oliver acoliver at apache dot org
  * @deprecated (Aug-2008) use {@link CellRangeAddress}
  */
-public class Region implements Comparable {
-    private int   rowFrom;
-    private short colFrom;
-    private int   rowTo;
-    private short colTo;
-
-    /**
-     * Creates a new instance of Region (0,0 - 0,0)
-     */
-
-    public Region()
-    {
-    }
-
-    public Region(int rowFrom, short colFrom, int rowTo, short colTo)
-    {
-        this.rowFrom = rowFrom;
-        this.rowTo   = rowTo;
-        this.colFrom = colFrom;
-        this.colTo   = colTo;
-    }
-
-    public Region(String ref) {
-    	CellReference cellReferenceFrom = new CellReference(ref.substring(0, ref.indexOf(":")));
-    	CellReference cellReferenceTo = new CellReference(ref.substring(ref.indexOf(":") + 1));
-    	this.rowFrom = cellReferenceFrom.getRow();
-    	this.colFrom = (short) cellReferenceFrom.getCol();
-    	this.rowTo = cellReferenceTo.getRow();
-    	this.colTo = (short) cellReferenceTo.getCol();
-	}
-
-
-    /**
-     * get the upper left hand corner column number
-     *
-     * @return column number for the upper left hand corner
-     */
-
-    public short getColumnFrom()
-    {
-        return colFrom;
-    }
-
-    /**
-     * get the upper left hand corner row number
-     *
-     * @return row number for the upper left hand corner
-     */
-
-    public int getRowFrom()
-    {
-        return rowFrom;
-    }
-
-    /**
-     * get the lower right hand corner column number
-     *
-     * @return column number for the lower right hand corner
-     */
-
-    public short getColumnTo()
-    {
-        return colTo;
-    }
-
-    /**
-     * get the lower right hand corner row number
-     *
-     * @return row number for the lower right hand corner
-     */
-
-    public int getRowTo()
-    {
-        return rowTo;
-    }
-
-    /**
-     * set the upper left hand corner column number
-     *
-     * @param colFrom  column number for the upper left hand corner
-     */
-
-    public void setColumnFrom(short colFrom)
-    {
-        this.colFrom = colFrom;
-    }
-
-    /**
-     * set the upper left hand corner row number
-     *
-     * @param rowFrom  row number for the upper left hand corner
-     */
-
-    public void setRowFrom(int rowFrom)
-    {
-        this.rowFrom = rowFrom;
-    }
-
-    /**
-     * set the lower right hand corner column number
-     *
-     * @param colTo  column number for the lower right hand corner
-     */
-
-    public void setColumnTo(short colTo)
-    {
-        this.colTo = colTo;
-    }
-
-    /**
-     * get the lower right hand corner row number
-     *
-     * @param rowTo  row number for the lower right hand corner
-     */
-
-    public void setRowTo(int rowTo)
-    {
-        this.rowTo = rowTo;
-    }
-
-
-    /**
-     * Answers: "is the row/column inside this range?"
-     *
-     * @return <code>true</code> if the cell is in the range and
-     * <code>false</code> if it is not
-     */
-
-    public boolean contains(int row, short col)
-    {
-        if ((this.rowFrom <= row) && (this.rowTo >= row)
-                && (this.colFrom <= col) && (this.colTo >= col))
-        {
-
-//                System.out.println("Region ("+rowFrom+","+colFrom+","+rowTo+","+ 
-//                                   colTo+") does contain "+row+","+col);
-            return true;
-        }
-        return false;
-    }
-
-    public boolean equals(Region r)
-    {
-        return (compareTo(r) == 0);
-    }
-
-    /**
-     * Compares that the given region is the same less than or greater than this
-     * region.  If any regional coordiant passed in is less than this regions
-     * coordinants then a positive integer is returned.  Otherwise a negative
-     * integer is returned.
-     *
-     * @param r  region
-     * @see #compareTo(Object)
-     */
-
-    public int compareTo(Region r)
-    {
-        if ((this.getRowFrom() == r.getRowFrom())
-                && (this.getColumnFrom() == r.getColumnFrom())
-                && (this.getRowTo() == r.getRowTo())
-                && (this.getColumnTo() == r.getColumnTo()))
-        {
-            return 0;
-        }
-        if ((this.getRowFrom() < r.getRowFrom())
-                || (this.getColumnFrom() < r.getColumnFrom())
-                || (this.getRowTo() < r.getRowTo())
-                || (this.getColumnTo() < r.getColumnTo()))
-        {
-            return 1;
-        }
-        return -1;
-    }
-
-    public int compareTo(Object o)
-    {
-        return compareTo(( Region ) o);
-    }
-    
-    /**
-     * @return the size of the region (number of cells in the area).
-     */
-    public int getArea() {
-        return (rowTo - rowFrom + 1) * (colTo - colFrom + 1);
-    }
-    
+public class Region implements Comparable<Region> {
+	private int   _rowFrom;
+	private short _colFrom;
+	private int   _rowTo;
+	private short _colTo;
 
 	/**
-	 * Convert a List of CellRange objects to an array of regions 
-	 *  
+	 * Creates a new instance of Region (0,0 - 0,0)
+	 */
+	public Region()
+	{
+	}
+
+	public Region(int rowFrom, short colFrom, int rowTo, short colTo)
+	{
+		this._rowFrom = rowFrom;
+		this._rowTo   = rowTo;
+		this._colFrom = colFrom;
+		this._colTo   = colTo;
+	}
+
+	public Region(String ref) {
+		CellReference cellReferenceFrom = new CellReference(ref.substring(0, ref.indexOf(":")));
+		CellReference cellReferenceTo = new CellReference(ref.substring(ref.indexOf(":") + 1));
+		this._rowFrom = cellReferenceFrom.getRow();
+		this._colFrom = cellReferenceFrom.getCol();
+		this._rowTo = cellReferenceTo.getRow();
+		this._colTo = cellReferenceTo.getCol();
+	}
+
+
+	/**
+	 * get the upper left hand corner column number
+	 *
+	 * @return column number for the upper left hand corner
+	 */
+	public short getColumnFrom()
+	{
+		return _colFrom;
+	}
+
+	/**
+	 * get the upper left hand corner row number
+	 *
+	 * @return row number for the upper left hand corner
+	 */
+	public int getRowFrom()
+	{
+		return _rowFrom;
+	}
+
+	/**
+	 * get the lower right hand corner column number
+	 *
+	 * @return column number for the lower right hand corner
+	 */
+
+	public short getColumnTo()
+	{
+		return _colTo;
+	}
+
+	/**
+	 * get the lower right hand corner row number
+	 *
+	 * @return row number for the lower right hand corner
+	 */
+	public int getRowTo()
+	{
+		return _rowTo;
+	}
+
+	/**
+	 * set the upper left hand corner column number
+	 *
+	 * @param colFrom  column number for the upper left hand corner
+	 */
+	public void setColumnFrom(short colFrom)
+	{
+		this._colFrom = colFrom;
+	}
+
+	/**
+	 * set the upper left hand corner row number
+	 *
+	 * @param rowFrom  row number for the upper left hand corner
+	 */
+	public void setRowFrom(int rowFrom)
+	{
+		this._rowFrom = rowFrom;
+	}
+
+	/**
+	 * set the lower right hand corner column number
+	 *
+	 * @param colTo  column number for the lower right hand corner
+	 */
+
+	public void setColumnTo(short colTo)
+	{
+		this._colTo = colTo;
+	}
+
+	/**
+	 * get the lower right hand corner row number
+	 *
+	 * @param rowTo  row number for the lower right hand corner
+	 */
+	public void setRowTo(int rowTo)
+	{
+		this._rowTo = rowTo;
+	}
+
+
+	/**
+	 * Answers: "is the row/column inside this range?"
+	 *
+	 * @return <code>true</code> if the cell is in the range and
+	 * <code>false</code> if it is not
+	 */
+	public boolean contains(int row, short col)
+	{
+		if ((this._rowFrom <= row) && (this._rowTo >= row)
+				&& (this._colFrom <= col) && (this._colTo >= col))
+		{
+
+//				System.out.println("Region ("+rowFrom+","+colFrom+","+rowTo+","+
+//								   colTo+") does contain "+row+","+col);
+			return true;
+		}
+		return false;
+	}
+
+	public boolean equals(Region r)
+	{
+		return (compareTo(r) == 0);
+	}
+
+	/**
+	 * Compares that the given region is the same less than or greater than this
+	 * region.  If any regional coordiant passed in is less than this regions
+	 * coordinants then a positive integer is returned.  Otherwise a negative
+	 * integer is returned.
+	 *
+	 * @param r  region
+	 * @see #compareTo(Object)
+	 */
+	public int compareTo(Region r)
+	{
+		if ((this.getRowFrom() == r.getRowFrom())
+				&& (this.getColumnFrom() == r.getColumnFrom())
+				&& (this.getRowTo() == r.getRowTo())
+				&& (this.getColumnTo() == r.getColumnTo()))
+		{
+			return 0;
+		}
+		if ((this.getRowFrom() < r.getRowFrom())
+				|| (this.getColumnFrom() < r.getColumnFrom())
+				|| (this.getRowTo() < r.getRowTo())
+				|| (this.getColumnTo() < r.getColumnTo()))
+		{
+			return 1;
+		}
+		return -1;
+	}
+
+	/**
+	 * @return the size of the region (number of cells in the area).
+	 */
+	public int getArea() {
+		return (_rowTo - _rowFrom + 1) * (_colTo - _colFrom + 1);
+	}
+
+
+	/**
+	 * Convert a List of CellRange objects to an array of regions
+	 *
 	 * @param cellRanges list of CellRange objects
 	 * @return regions
 	 */
@@ -225,7 +211,7 @@
 		if(size < 1) {
 			return new Region[0];
 		}
-		
+
 		Region[] result = new Region[size];
 
 		for (int i = 0; i != size; i++) {
@@ -235,9 +221,9 @@
 	}
 
 
-		
+
 	private static Region convertToRegion(CellRangeAddress cr) {
-		
+
 		return new Region(cr.getFirstRow(), (short)cr.getFirstColumn(), cr.getLastRow(), (short)cr.getLastColumn());
 	}
 
@@ -246,7 +232,7 @@
 		if(size < 1) {
 			return new CellRangeAddress[0];
 		}
-		
+
 		CellRangeAddress[] result = new CellRangeAddress[size];
 
 		for (int i = 0; i != size; i++) {
@@ -259,13 +245,13 @@
 		return new CellRangeAddress(r.getRowFrom(), r.getRowTo(), r.getColumnFrom(), r.getColumnTo());
 	}
 
-    /**
-     * @return the string reference for this region
-     */
-    public String getRegionRef() {
-    	CellReference cellRefFrom = new CellReference(rowFrom, colFrom);
-    	CellReference cellRefTo = new CellReference(rowTo, colTo);
-    	String ref = cellRefFrom.formatAsString() + ":" + cellRefTo.formatAsString();
+	/**
+	 * @return the string reference for this region
+	 */
+	public String getRegionRef() {
+		CellReference cellRefFrom = new CellReference(_rowFrom, _colFrom);
+		CellReference cellRefTo = new CellReference(_rowTo, _colTo);
+		String ref = cellRefFrom.formatAsString() + ":" + cellRefTo.formatAsString();
 		return ref;
-    }
+	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message