aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area/MainReference.java
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2011-01-24 18:06:25 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2011-01-24 18:06:25 +0000
commit59933c342db81b1409d1c9d3cfdb466e194e4649 (patch)
tree593018e887bd48d9f7d28b483a28a393ac72ac71 /src/java/org/apache/fop/area/MainReference.java
parent9e0c21610df3f37956acef6b6042cdaa34aefea2 (diff)
downloadxmlgraphics-fop-59933c342db81b1409d1c9d3cfdb466e194e4649.tar.gz
xmlgraphics-fop-59933c342db81b1409d1c9d3cfdb466e194e4649.zip
Bugzilla 50593: Mostly add type safety to various collections in the fop.area package. Additionally, added @Override annotations and used static import for Constants.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1062901 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area/MainReference.java')
-rw-r--r--src/java/org/apache/fop/area/MainReference.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/area/MainReference.java b/src/java/org/apache/fop/area/MainReference.java
index 87e594169..a6112011d 100644
--- a/src/java/org/apache/fop/area/MainReference.java
+++ b/src/java/org/apache/fop/area/MainReference.java
@@ -34,7 +34,7 @@ public class MainReference extends Area {
private static final long serialVersionUID = 7635126485620012448L;
private BodyRegion parent;
- private List spanAreas = new java.util.ArrayList();
+ private List<Span> spanAreas = new java.util.ArrayList<Span>();
private boolean isEmpty = true;
/**
@@ -59,7 +59,7 @@ public class MainReference extends Area {
spanAreas.remove(spanAreas.size() - 1);
}
RegionViewport rv = parent.getRegionViewport();
- int ipdWidth = (int) parent.getIPD()
+ int ipdWidth = parent.getIPD()
- rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
Span newSpan = new Span(((spanAll) ? 1 : getColumnCount()),
@@ -84,8 +84,8 @@ public class MainReference extends Area {
*
* @param spans content already laid out
*/
- public void setSpans(List spans) {
- spanAreas = new ArrayList(spans);
+ public void setSpans(List<Span> spans) {
+ spanAreas = new ArrayList<Span>(spans);
}
/**
@@ -93,7 +93,7 @@ public class MainReference extends Area {
* @return the active span.
*/
public Span getCurrentSpan() {
- return (Span) spanAreas.get(spanAreas.size() - 1);
+ return spanAreas.get(spanAreas.size() - 1);
}
/**
@@ -103,16 +103,13 @@ public class MainReference extends Area {
* @return true if no child areas have been added yet.
*/
public boolean isEmpty() {
- if (isEmpty) {
- boolean nonEmptyFound = false;
- if (spanAreas != null) {
- for (Iterator spaniter = spanAreas.iterator(); spaniter.hasNext();) {
- Span spanArea = (Span) spaniter.next();
- nonEmptyFound |= !spanArea.isEmpty();
+ if (isEmpty && spanAreas != null) {
+ for (Span spanArea : spanAreas) {
+ if (!spanArea.isEmpty()) {
+ isEmpty = false;
+ break;
}
}
-
- isEmpty = !nonEmptyFound;
}
return isEmpty;
}