bug 59773: replace for loops with for-each loops; javadocs fixes for JDK8

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751193 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-07-04 01:49:28 +00:00
parent 8329fc22f5
commit 954306ea2e
2 changed files with 15 additions and 10 deletions

View File

@ -424,6 +424,8 @@ public abstract class CFRuleBase extends StandardRecord implements Cloneable {
* 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) {

View File

@ -35,8 +35,8 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
* 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 extends POIOLE2TextExtractor {
/**
* 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 extends POIOLE2TextExtractor {
* 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();