You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/07 22:29:29 UTC

svn commit: r1751838 - in /poi/trunk/src/java/org/apache/poi: hssf/usermodel/HSSFEvaluationSheet.java ss/formula/EvaluationSheet.java ss/formula/eval/forked/ForkedEvaluationSheet.java ss/formula/eval/forked/ForkedEvaluationWorkbook.java

Author: onealj
Date: Thu Jul  7 22:29:28 2016
New Revision: 1751838

URL: http://svn.apache.org/viewvc?rev=1751838&view=rev
Log:
whitespace (tabs to spaces)

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

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java?rev=1751838&r1=1751837&r2=1751838&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java Thu Jul  7 22:29:28 2016
@@ -25,30 +25,30 @@ import org.apache.poi.ss.formula.Evaluat
  */
 final class HSSFEvaluationSheet implements EvaluationSheet {
 
-	private final HSSFSheet _hs;
+    private final HSSFSheet _hs;
 
-	public HSSFEvaluationSheet(HSSFSheet hs) {
-		_hs = 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
-	}
+    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
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationSheet.java?rev=1751838&r1=1751837&r2=1751838&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationSheet.java Thu Jul  7 22:29:28 2016
@@ -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.
      * 

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java?rev=1751838&r1=1751837&r2=1751838&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java Thu Jul  7 22:29:28 2016
@@ -39,109 +39,109 @@ import org.apache.poi.ss.util.CellRefere
  */
 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;
+        }
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java?rev=1751838&r1=1751837&r2=1751838&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java Thu Jul  7 22:29:28 2016
@@ -37,71 +37,71 @@ import org.apache.poi.ss.usermodel.Workb
  */
 final class ForkedEvaluationWorkbook implements EvaluationWorkbook {
 
-	private final EvaluationWorkbook _masterBook;
-	private final Map<String, ForkedEvaluationSheet> _sharedSheetsByName;
+    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 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);
+    }
 
-	public void copyUpdatedCells(Workbook workbook) {
+    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 imp
     }
 
     @Override
-	public EvaluationSheet getSheet(int sheetIndex) {
-		return getSharedSheet(getSheetName(sheetIndex));
-	}
-	
-    @Override
-	public ExternalName getExternalName(int externSheetIndex, int externNameIndex) {
-	   return _masterBook.getExternalName(externSheetIndex, externNameIndex);
-	}
+    public EvaluationSheet getSheet(int sheetIndex) {
+        return getSharedSheet(getSheetName(sheetIndex));
+    }
+    
+    @Override
+    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() {



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