aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-12-23 10:33:59 +0000
committerPJ Fanning <fanningpj@apache.org>2021-12-23 10:33:59 +0000
commitd6ab8e844442607965eb749d42c67d7c9f0f5495 (patch)
tree2570ca0e76f930df691a1c1080df6f723cfa2dc9 /poi-scratchpad
parentd41e05068855187d1e08d50e16f1428b1e1f30a1 (diff)
downloadpoi-d6ab8e844442607965eb749d42c67d7c9f0f5495.tar.gz
poi-d6ab8e844442607965eb749d42c67d7c9f0f5495.zip
[github-290] Customize Spliterator implementations for better parallelism. Thanks to Daniel Shuy. This closes #290
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896305 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java9
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFGroupShape.java9
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSheet.java8
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java9
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextShape.java9
5 files changed, 44 insertions, 0 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
index 2140678d26..1267da2eeb 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
@@ -25,6 +25,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Spliterator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
@@ -86,6 +87,14 @@ public final class PPDrawing extends RecordAtom implements Iterable<EscherRecord
}
/**
+ * @since POI 5.2.0
+ */
+ @Override
+ public Spliterator<EscherRecord> spliterator() {
+ return getEscherRecords().spliterator();
+ }
+
+ /**
* Get access to the atoms inside Textboxes
*/
public EscherTextboxWrapper[] getTextboxWrappers() { return textboxWrappers; }
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFGroupShape.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
index cfa09db8a4..a82390e97f 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFGroupShape.java
@@ -21,6 +21,7 @@ import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Spliterator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -261,6 +262,14 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
return getShapes().iterator();
}
+ /**
+ * @since POI 5.2.0
+ */
+ @Override
+ public Spliterator<HSLFShape> spliterator() {
+ return getShapes().spliterator();
+ }
+
@Override
public boolean removeShape(HSLFShape shape) {
// TODO: implement!
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSheet.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSheet.java
index 6ceafed5b4..effe54e372 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSheet.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSheet.java
@@ -22,6 +22,7 @@ import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Spliterator;
import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.ddf.EscherDgRecord;
@@ -360,6 +361,13 @@ public abstract class HSLFSheet implements HSLFShapeContainer, Sheet<HSLFShape,H
return getShapes().iterator();
}
+ /**
+ * @since POI 5.2.0
+ */
+ @Override
+ public Spliterator<HSLFShape> spliterator() {
+ return getShapes().spliterator();
+ }
/**
* @return whether shapes on the master sheet should be shown. By default master graphics is turned off.
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
index 129c61c0f3..2612b17692 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@@ -341,6 +342,14 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
return _runs.iterator();
}
+ /**
+ * @since POI 5.2.0
+ */
+ @Override
+ public Spliterator<HSLFTextRun> spliterator() {
+ return _runs.spliterator();
+ }
+
@Override
public Double getLeftMargin() {
Integer val = null;
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextShape.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextShape.java
index 8efa7cadb1..8d99617e7b 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextShape.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextShape.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Spliterator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -704,6 +705,14 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
return _paragraphs.iterator();
}
+ /**
+ * @since POI 5.2.0
+ */
+ @Override
+ public Spliterator<HSLFTextParagraph> spliterator() {
+ return _paragraphs.spliterator();
+ }
+
@Override
public Insets2D getInsets() {
return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());