]> source.dussan.org Git - poi.git/commitdiff
whitespace (tabs to spaces)
authorJaven O'Neal <onealj@apache.org>
Thu, 7 Jul 2016 22:29:28 +0000 (22:29 +0000)
committerJaven O'Neal <onealj@apache.org>
Thu, 7 Jul 2016 22:29:28 +0000 (22:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751838 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java
src/java/org/apache/poi/ss/formula/EvaluationSheet.java
src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java
src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java

index 3c9f801a304dc9d4cfbef914f1c2f0e366901824..229788600ef76b80c102584c7eaff4f4a2b19f91 100644 (file)
@@ -25,30 +25,30 @@ import org.apache.poi.ss.formula.EvaluationSheet;
  */
 final class HSSFEvaluationSheet implements EvaluationSheet {
 
-       private final HSSFSheet _hs;
-
-       public HSSFEvaluationSheet(HSSFSheet hs) {
-               _hs = hs;
-       }
-
-       public HSSFSheet getHSSFSheet() {
-               return _hs;
-       }
-       @Override
-       public EvaluationCell getCell(int rowIndex, int columnIndex) {
-               HSSFRow row = _hs.getRow(rowIndex);
-               if (row == null) {
-                       return null;
-               }
-               HSSFCell cell = row.getCell(columnIndex);
-               if (cell == null) {
-                       return null;
-               }
-               return new HSSFEvaluationCell(cell, this);
-       }
-       
-       @Override
-       public void clearAllCachedResultValues() {
-           // nothing to do
-       }
+    private final HSSFSheet _hs;
+
+    public HSSFEvaluationSheet(HSSFSheet hs) {
+        _hs = hs;
+    }
+
+    public HSSFSheet getHSSFSheet() {
+        return _hs;
+    }
+    @Override
+    public EvaluationCell getCell(int rowIndex, int columnIndex) {
+        HSSFRow row = _hs.getRow(rowIndex);
+        if (row == null) {
+            return null;
+        }
+        HSSFCell cell = row.getCell(columnIndex);
+        if (cell == null) {
+            return null;
+        }
+        return new HSSFEvaluationCell(cell, this);
+    }
+    
+    @Override
+    public void clearAllCachedResultValues() {
+        // nothing to do
+    }
 }
index 3cc292dc5463c40ad87c9284e8fbc0f70f1c465c..06fb6b533744fd4dd18a53aaf22cde6db23869e4 100644 (file)
@@ -26,11 +26,11 @@ package org.apache.poi.ss.formula;
  */
 public interface EvaluationSheet {
 
-       /**
-        * @return <code>null</code> if there is no cell at the specified coordinates
-        */
-       EvaluationCell getCell(int rowIndex, int columnIndex);
-       
+    /**
+     * @return <code>null</code> if there is no cell at the specified coordinates
+     */
+    EvaluationCell getCell(int rowIndex, int columnIndex);
+    
     /**
      * Propagated from {@link EvaluationWorkbook#clearAllCachedResultValues()} to clear locally cached data.
      * 
index 0ba3a66ed1170ea1ed0ad17c1623ba22fd43106f..d15a3461a71052612acaf45423a420ab3cfb57e6 100644 (file)
@@ -39,109 +39,109 @@ import org.apache.poi.ss.util.CellReference;
  */
 final class ForkedEvaluationSheet implements EvaluationSheet {
 
-       private final EvaluationSheet _masterSheet;
-       /**
-        * Only cells which have been split are put in this map.  (This has been done to conserve memory).
-        */
-       private final Map<RowColKey, ForkedEvaluationCell> _sharedCellsByRowCol;
-
-       public ForkedEvaluationSheet(EvaluationSheet masterSheet) {
-               _masterSheet = masterSheet;
-               _sharedCellsByRowCol = new HashMap<RowColKey, ForkedEvaluationCell>();
-       }
-
-       @Override
-       public EvaluationCell getCell(int rowIndex, int columnIndex) {
-               RowColKey key = new RowColKey(rowIndex, columnIndex);
-
-               ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
-               if (result == null) {
-                       return _masterSheet.getCell(rowIndex, columnIndex);
-               }
-               return result;
-       }
-
-       public ForkedEvaluationCell getOrCreateUpdatableCell(int rowIndex, int columnIndex) {
-               RowColKey key = new RowColKey(rowIndex, columnIndex);
-
-               ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
-               if (result == null) {
-                       EvaluationCell mcell = _masterSheet.getCell(rowIndex, columnIndex);
-                       if (mcell == null) {
-                               CellReference cr = new CellReference(rowIndex, columnIndex);
-                               throw new UnsupportedOperationException("Underlying cell '"
-                                               + cr.formatAsString() + "' is missing in master sheet.");
-                       }
-                       result = new ForkedEvaluationCell(this, mcell);
-                       _sharedCellsByRowCol.put(key, result);
-               }
-               return result;
-       }
-
-       public void copyUpdatedCells(Sheet sheet) {
-               RowColKey[] keys = new RowColKey[_sharedCellsByRowCol.size()];
-               _sharedCellsByRowCol.keySet().toArray(keys);
-               Arrays.sort(keys);
-               for (int i = 0; i < keys.length; i++) {
-                       RowColKey key = keys[i];
-                       Row row = sheet.getRow(key.getRowIndex());
-                       if (row == null) {
-                               row = sheet.createRow(key.getRowIndex());
-                       }
-                       Cell destCell = row.getCell(key.getColumnIndex());
-                       if (destCell == null) {
-                               destCell = row.createCell(key.getColumnIndex());
-                       }
-
-                       ForkedEvaluationCell srcCell = _sharedCellsByRowCol.get(key);
-                       srcCell.copyValue(destCell);
-               }
-       }
-
-       public int getSheetIndex(EvaluationWorkbook mewb) {
-               return mewb.getSheetIndex(_masterSheet);
-       }
-
-       /* (non-Javadoc)
-        * leave the map alone, if it needs resetting, reusing this class is probably a bad idea.
-        * @see org.apache.poi.ss.formula.EvaluationSheet#clearAllCachedResultValues()
-        */
-       @Override
-       public void clearAllCachedResultValues() {
-           _masterSheet.clearAllCachedResultValues();
-       }
-       
+    private final EvaluationSheet _masterSheet;
+    /**
+     * Only cells which have been split are put in this map.  (This has been done to conserve memory).
+     */
+    private final Map<RowColKey, ForkedEvaluationCell> _sharedCellsByRowCol;
+
+    public ForkedEvaluationSheet(EvaluationSheet masterSheet) {
+        _masterSheet = masterSheet;
+        _sharedCellsByRowCol = new HashMap<RowColKey, ForkedEvaluationCell>();
+    }
+
+    @Override
+    public EvaluationCell getCell(int rowIndex, int columnIndex) {
+        RowColKey key = new RowColKey(rowIndex, columnIndex);
+
+        ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
+        if (result == null) {
+            return _masterSheet.getCell(rowIndex, columnIndex);
+        }
+        return result;
+    }
+
+    public ForkedEvaluationCell getOrCreateUpdatableCell(int rowIndex, int columnIndex) {
+        RowColKey key = new RowColKey(rowIndex, columnIndex);
+
+        ForkedEvaluationCell result = _sharedCellsByRowCol.get(key);
+        if (result == null) {
+            EvaluationCell mcell = _masterSheet.getCell(rowIndex, columnIndex);
+            if (mcell == null) {
+                CellReference cr = new CellReference(rowIndex, columnIndex);
+                throw new UnsupportedOperationException("Underlying cell '"
+                        + cr.formatAsString() + "' is missing in master sheet.");
+            }
+            result = new ForkedEvaluationCell(this, mcell);
+            _sharedCellsByRowCol.put(key, result);
+        }
+        return result;
+    }
+
+    public void copyUpdatedCells(Sheet sheet) {
+        RowColKey[] keys = new RowColKey[_sharedCellsByRowCol.size()];
+        _sharedCellsByRowCol.keySet().toArray(keys);
+        Arrays.sort(keys);
+        for (int i = 0; i < keys.length; i++) {
+            RowColKey key = keys[i];
+            Row row = sheet.getRow(key.getRowIndex());
+            if (row == null) {
+                row = sheet.createRow(key.getRowIndex());
+            }
+            Cell destCell = row.getCell(key.getColumnIndex());
+            if (destCell == null) {
+                destCell = row.createCell(key.getColumnIndex());
+            }
+
+            ForkedEvaluationCell srcCell = _sharedCellsByRowCol.get(key);
+            srcCell.copyValue(destCell);
+        }
+    }
+
+    public int getSheetIndex(EvaluationWorkbook mewb) {
+        return mewb.getSheetIndex(_masterSheet);
+    }
+
+    /* (non-Javadoc)
+     * leave the map alone, if it needs resetting, reusing this class is probably a bad idea.
+     * @see org.apache.poi.ss.formula.EvaluationSheet#clearAllCachedResultValues()
+     */
+    @Override
+    public void clearAllCachedResultValues() {
+        _masterSheet.clearAllCachedResultValues();
+    }
+    
     // FIXME: serves same purpose as org.apache.poi.xssf.usermodel.XSSFEvaluationSheet$CellKey
-       private static final class RowColKey implements Comparable<RowColKey>{
-               private final int _rowIndex;
-               private final int _columnIndex;
-
-               public RowColKey(int rowIndex, int columnIndex) {
-                       _rowIndex = rowIndex;
-                       _columnIndex = columnIndex;
-               }
-               @Override
-               public boolean equals(Object obj) {
-                       assert obj instanceof RowColKey : "these private cache key instances are only compared to themselves";
-                       RowColKey other = (RowColKey) obj;
-                       return _rowIndex == other._rowIndex && _columnIndex == other._columnIndex;
-               }
-               @Override
-               public int hashCode() {
-                       return _rowIndex ^ _columnIndex;
-               }
-               public int compareTo(RowColKey o) {
-                       int cmp = _rowIndex - o._rowIndex;
-                       if (cmp != 0) {
-                               return cmp;
-                       }
-                       return _columnIndex - o._columnIndex;
-               }
-               public int getRowIndex() {
-                       return _rowIndex;
-               }
-               public int getColumnIndex() {
-                       return _columnIndex;
-               }
-       }
+    private static final class RowColKey implements Comparable<RowColKey>{
+        private final int _rowIndex;
+        private final int _columnIndex;
+
+        public RowColKey(int rowIndex, int columnIndex) {
+            _rowIndex = rowIndex;
+            _columnIndex = columnIndex;
+        }
+        @Override
+        public boolean equals(Object obj) {
+            assert obj instanceof RowColKey : "these private cache key instances are only compared to themselves";
+            RowColKey other = (RowColKey) obj;
+            return _rowIndex == other._rowIndex && _columnIndex == other._columnIndex;
+        }
+        @Override
+        public int hashCode() {
+            return _rowIndex ^ _columnIndex;
+        }
+        public int compareTo(RowColKey o) {
+            int cmp = _rowIndex - o._rowIndex;
+            if (cmp != 0) {
+                return cmp;
+            }
+            return _columnIndex - o._columnIndex;
+        }
+        public int getRowIndex() {
+            return _rowIndex;
+        }
+        public int getColumnIndex() {
+            return _columnIndex;
+        }
+    }
 }
index cb50f6871a2c9f77cb56426014d8d65b44b8c74c..54cbd644c6442cde7a253953cf6b4d350cc106f3 100644 (file)
@@ -37,71 +37,71 @@ import org.apache.poi.ss.usermodel.Workbook;
  */
 final class ForkedEvaluationWorkbook implements EvaluationWorkbook {
 
-       private final EvaluationWorkbook _masterBook;
-       private final Map<String, ForkedEvaluationSheet> _sharedSheetsByName;
-
-       public ForkedEvaluationWorkbook(EvaluationWorkbook master) {
-               _masterBook = master;
-               _sharedSheetsByName = new HashMap<String, ForkedEvaluationSheet>();
-       }
-
-       public ForkedEvaluationCell getOrCreateUpdatableCell(String sheetName, int rowIndex,
-                       int columnIndex) {
-               ForkedEvaluationSheet sheet = getSharedSheet(sheetName);
-               return sheet.getOrCreateUpdatableCell(rowIndex, columnIndex);
-       }
-
-       public EvaluationCell getEvaluationCell(String sheetName, int rowIndex, int columnIndex) {
-               ForkedEvaluationSheet sheet = getSharedSheet(sheetName);
-               return sheet.getCell(rowIndex, columnIndex);
-       }
-
-       private ForkedEvaluationSheet getSharedSheet(String sheetName) {
-               ForkedEvaluationSheet result = _sharedSheetsByName.get(sheetName);
-               if (result == null) {
-                       result = new ForkedEvaluationSheet(_masterBook.getSheet(_masterBook
-                                       .getSheetIndex(sheetName)));
-                       _sharedSheetsByName.put(sheetName, result);
-               }
-               return result;
-       }
-
-       public void copyUpdatedCells(Workbook workbook) {
+    private final EvaluationWorkbook _masterBook;
+    private final Map<String, ForkedEvaluationSheet> _sharedSheetsByName;
+
+    public ForkedEvaluationWorkbook(EvaluationWorkbook master) {
+        _masterBook = master;
+        _sharedSheetsByName = new HashMap<String, ForkedEvaluationSheet>();
+    }
+
+    public ForkedEvaluationCell getOrCreateUpdatableCell(String sheetName, int rowIndex,
+            int columnIndex) {
+        ForkedEvaluationSheet sheet = getSharedSheet(sheetName);
+        return sheet.getOrCreateUpdatableCell(rowIndex, columnIndex);
+    }
+
+    public EvaluationCell getEvaluationCell(String sheetName, int rowIndex, int columnIndex) {
+        ForkedEvaluationSheet sheet = getSharedSheet(sheetName);
+        return sheet.getCell(rowIndex, columnIndex);
+    }
+
+    private ForkedEvaluationSheet getSharedSheet(String sheetName) {
+        ForkedEvaluationSheet result = _sharedSheetsByName.get(sheetName);
+        if (result == null) {
+            result = new ForkedEvaluationSheet(_masterBook.getSheet(_masterBook
+                    .getSheetIndex(sheetName)));
+            _sharedSheetsByName.put(sheetName, result);
+        }
+        return result;
+    }
+
+    public void copyUpdatedCells(Workbook workbook) {
         String[] sheetNames = new String[_sharedSheetsByName.size()];
         _sharedSheetsByName.keySet().toArray(sheetNames);
-               for (String sheetName : sheetNames) {
-                       ForkedEvaluationSheet sheet = _sharedSheetsByName.get(sheetName);
-                       sheet.copyUpdatedCells(workbook.getSheet(sheetName));
-               }
-       }
+        for (String sheetName : sheetNames) {
+            ForkedEvaluationSheet sheet = _sharedSheetsByName.get(sheetName);
+            sheet.copyUpdatedCells(workbook.getSheet(sheetName));
+        }
+    }
 
     @Override
-       public int convertFromExternSheetIndex(int externSheetIndex) {
-               return _masterBook.convertFromExternSheetIndex(externSheetIndex);
-       }
+    public int convertFromExternSheetIndex(int externSheetIndex) {
+        return _masterBook.convertFromExternSheetIndex(externSheetIndex);
+    }
 
     @Override
-       public ExternalSheet getExternalSheet(int externSheetIndex) {
-               return _masterBook.getExternalSheet(externSheetIndex);
-       }
+    public ExternalSheet getExternalSheet(int externSheetIndex) {
+        return _masterBook.getExternalSheet(externSheetIndex);
+    }
     @Override
-       public ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
+    public ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
         return _masterBook.getExternalSheet(firstSheetName, lastSheetName, externalWorkbookNumber);
     }
 
     @Override
     public Ptg[] getFormulaTokens(EvaluationCell cell) {
-               if (cell instanceof ForkedEvaluationCell) {
-                       // doesn't happen yet because formulas cannot be modified from the master workbook
-                       throw new RuntimeException("Updated formulas not supported yet");
-               }
-               return _masterBook.getFormulaTokens(cell);
-       }
+        if (cell instanceof ForkedEvaluationCell) {
+            // doesn't happen yet because formulas cannot be modified from the master workbook
+            throw new RuntimeException("Updated formulas not supported yet");
+        }
+        return _masterBook.getFormulaTokens(cell);
+    }
 
     @Override
-       public EvaluationName getName(NamePtg namePtg) {
-               return _masterBook.getName(namePtg);
-       }
+    public EvaluationName getName(NamePtg namePtg) {
+        return _masterBook.getName(namePtg);
+    }
 
     @Override
     public EvaluationName getName(String name, int sheetIndex){
@@ -109,42 +109,42 @@ final class ForkedEvaluationWorkbook implements EvaluationWorkbook {
     }
 
     @Override
-       public EvaluationSheet getSheet(int sheetIndex) {
-               return getSharedSheet(getSheetName(sheetIndex));
-       }
-       
+    public EvaluationSheet getSheet(int sheetIndex) {
+        return getSharedSheet(getSheetName(sheetIndex));
+    }
+    
     @Override
-       public ExternalName getExternalName(int externSheetIndex, int externNameIndex) {
-          return _masterBook.getExternalName(externSheetIndex, externNameIndex);
-       }
+    public ExternalName getExternalName(int externSheetIndex, int externNameIndex) {
+       return _masterBook.getExternalName(externSheetIndex, externNameIndex);
+    }
     @Override
-       public ExternalName getExternalName(String nameName, String sheetName, int externalWorkbookNumber) {
-              return _masterBook.getExternalName(nameName, sheetName, externalWorkbookNumber);
+    public ExternalName getExternalName(String nameName, String sheetName, int externalWorkbookNumber) {
+           return _masterBook.getExternalName(nameName, sheetName, externalWorkbookNumber);
     }
 
     @Override
     public int getSheetIndex(EvaluationSheet sheet) {
-               if (sheet instanceof ForkedEvaluationSheet) {
-                       ForkedEvaluationSheet mes = (ForkedEvaluationSheet) sheet;
-                       return mes.getSheetIndex(_masterBook);
-               }
-               return _masterBook.getSheetIndex(sheet);
-       }
+        if (sheet instanceof ForkedEvaluationSheet) {
+            ForkedEvaluationSheet mes = (ForkedEvaluationSheet) sheet;
+            return mes.getSheetIndex(_masterBook);
+        }
+        return _masterBook.getSheetIndex(sheet);
+    }
 
     @Override
-       public int getSheetIndex(String sheetName) {
-               return _masterBook.getSheetIndex(sheetName);
-       }
+    public int getSheetIndex(String sheetName) {
+        return _masterBook.getSheetIndex(sheetName);
+    }
 
     @Override
-       public String getSheetName(int sheetIndex) {
-               return _masterBook.getSheetName(sheetIndex);
-       }
+    public String getSheetName(int sheetIndex) {
+        return _masterBook.getSheetName(sheetIndex);
+    }
 
     @Override
-       public String resolveNameXText(NameXPtg ptg) {
-               return _masterBook.resolveNameXText(ptg);
-       }
+    public String resolveNameXText(NameXPtg ptg) {
+        return _masterBook.resolveNameXText(ptg);
+    }
 
     @Override
     public UDFFinder getUDFFinder() {