poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1751193 - in /poi/trunk/src: java/org/apache/poi/hssf/record/CFRuleBase.java scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
Date Mon, 04 Jul 2016 01:49:28 GMT
Author: onealj
Date: Mon Jul  4 01:49:28 2016
New Revision: 1751193

URL: http://svn.apache.org/viewvc?rev=1751193&view=rev
Log:
bug 59773: replace for loops with for-each loops; javadocs fixes for JDK8

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleBase.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleBase.java?rev=1751193&r1=1751192&r2=1751193&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CFRuleBase.java Mon Jul  4 01:49:28 2016
@@ -424,6 +424,8 @@ public abstract class CFRuleBase extends
      * One approach might be to apply the inverse of SharedFormulaRecord.convertSharedFormulas(Stack,
int, int)
      * Note - two extra parameters (rowIx & colIx) will be required. They probably
come from one of the Region objects.
      *
+     * @param formula  The formula to parse, excluding the leading equals sign.
+     * @param sheet  The sheet that the formula is on.
      * @return <code>null</code> if <tt>formula</tt> was null.
      */
     public static Ptg[] parseFormula(String formula, HSSFSheet sheet) {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java?rev=1751193&r1=1751192&r2=1751193&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java Mon
Jul  4 01:49:28 2016
@@ -35,8 +35,8 @@ import org.apache.poi.poifs.filesystem.P
 
 /**
  * Class to find all the text in a Visio file, and return it.
- * Can opperate on the command line (outputs to stdout), or
- *  can return the text for you (eg for use with Lucene).
+ * Can operate on the command line (outputs to stdout), or
+ *  can return the text for you (example: for use with Lucene).
  */
 public final class VisioTextExtractor extends POIOLE2TextExtractor {
 	private HDGFDiagram hdgf;
@@ -61,11 +61,13 @@ public final class VisioTextExtractor ex
 	/**
 	 * Locates all the text entries in the file, and returns their
 	 *  contents.
+	 * 
+	 * @return An array of each Text item in the document
 	 */
 	public String[] getAllText() {
 		ArrayList<String> text = new ArrayList<String>();
-		for(int i=0; i<hdgf.getTopLevelStreams().length; i++) {
-			findText(hdgf.getTopLevelStreams()[i], text);
+		for(Stream stream : hdgf.getTopLevelStreams()) {
+			findText(stream, text);
 		}
 		return text.toArray( new String[text.size()] );
 	}
@@ -106,15 +108,16 @@ public final class VisioTextExtractor ex
 	 * Returns the textual contents of the file.
 	 * Each textual object's text will be separated
 	 *  by a newline
+	 *  
+	 * @return All text contained in this document, separated by <code>\n</code>
 	 */
+	@Override
 	public String getText() {
 		StringBuffer text = new StringBuffer();
-		String[] allText = getAllText();
-		for(int i=0; i<allText.length; i++) {
-			text.append(allText[i]);
-			if(!allText[i].endsWith("\r") &&
-					!allText[i].endsWith("\n")) {
-				text.append("\n");
+		for(String t : getAllText()) {
+			text.append(t);
+			if(!t.endsWith("\r") && !t.endsWith("\n")) {
+				text.append('\n');
 			}
 		}
 		return text.toString();



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


Mime
View raw message