git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1502902 13f79535-47bb-0310-9956-ffa450edef68pull/1/head
@@ -279,20 +279,20 @@ public class AFPResourceManager { | |||
*/ | |||
public boolean includeCachedObject(AFPResourceInfo resourceInfo, AFPObjectAreaInfo areaInfo) { | |||
String objectName; | |||
String objectName; | |||
AbstractCachedObject cachedObject = (AbstractCachedObject)includeObjectCache.get(resourceInfo); | |||
AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); | |||
if (cachedObject != null) { | |||
if (areaInfo != null) { | |||
cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo); | |||
} | |||
cachedObject.includeObject(); | |||
return true; | |||
} else { | |||
return false; | |||
if (cachedObject != null) { | |||
if (areaInfo != null) { | |||
cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo); | |||
} | |||
cachedObject.includeObject(); | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} | |||
@@ -382,8 +382,7 @@ public class AFPResourceManager { | |||
resourceInfo.setName(resourceName); | |||
resourceInfo.setUri(uri.toASCIIString()); | |||
AbstractCachedObject cachedObject = (AbstractCachedObject) | |||
includeObjectCache.get(resourceInfo); | |||
AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); | |||
if (cachedObject == null) { | |||
if (log.isDebugEnabled()) { | |||
log.debug("Adding included resource: " + resourceName); | |||
@@ -425,7 +424,7 @@ public class AFPResourceManager { | |||
resourceInfo.setName(resourceName); | |||
resourceInfo.setUri(uri.toASCIIString()); | |||
AbstractCachedObject cachedObject = (AbstractCachedObject) includeObjectCache.get(resourceInfo); | |||
AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo); | |||
if (cachedObject == null) { | |||
ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel); | |||
@@ -99,8 +99,8 @@ public class MapPageOverlay extends AbstractAFPObject { | |||
// Structured field ID for a MPO | |||
data[3] = (byte) 0xD3; | |||
data[4] = (byte) Type.MAP; | |||
data[5] = (byte) Category.PAGE_OVERLAY; | |||
data[4] = Type.MAP; | |||
data[5] = Category.PAGE_OVERLAY; | |||
data[6] = 0x00; // Reserved | |||
data[7] = 0x00; // Reserved |
@@ -135,7 +135,7 @@ public class BodyRegion extends RegionReference { | |||
List<Span> spans = getMainReference().getSpans(); | |||
int previousSpanCount = spans.size() - 1; | |||
for (int i = 0; i < previousSpanCount; i++) { | |||
usedBPD += ((Span)spans.get(i)).getHeight(); | |||
usedBPD += spans.get(i).getHeight(); | |||
} | |||
return getBPD() - usedBPD; | |||
} |
@@ -258,7 +258,7 @@ public class LineArea extends Area { | |||
boolean bUnresolvedAreasPresent = false; | |||
// recursively apply variation factor to descendant areas | |||
for (int i = 0, len = inlineAreas.size(); i < len; i++) { | |||
bUnresolvedAreasPresent |= ((InlineArea) inlineAreas.get(i)) | |||
bUnresolvedAreasPresent |= inlineAreas.get(i) | |||
.applyVariationFactor(adjustingInfo.variationFactor, | |||
adjustingInfo.availableStretch, | |||
adjustingInfo.availableShrink); |
@@ -53,7 +53,7 @@ public final class EventExceptionManager { | |||
*/ | |||
public static void throwException(Event event, String exceptionClass) throws Throwable { | |||
if (exceptionClass != null) { | |||
ExceptionFactory factory = (ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass); | |||
ExceptionFactory factory = EXCEPTION_FACTORIES.get(exceptionClass); | |||
if (factory != null) { | |||
throw factory.createException(event); | |||
} else { |
@@ -160,7 +160,7 @@ public class ElementMappingRegistry { | |||
* @return the handling DOMImplementation, or null if not applicable | |||
*/ | |||
public DOMImplementation getDOMImplementationForNamespace(String namespaceURI) { | |||
ElementMapping mapping = (ElementMapping)this.namespaces.get(namespaceURI); | |||
ElementMapping mapping = this.namespaces.get(namespaceURI); | |||
if (mapping == null) { | |||
return null; | |||
} else { | |||
@@ -175,7 +175,7 @@ public class ElementMappingRegistry { | |||
* available. | |||
*/ | |||
public ElementMapping getElementMapping(String namespaceURI) { | |||
return (ElementMapping)this.namespaces.get(namespaceURI); | |||
return this.namespaces.get(namespaceURI); | |||
} | |||
/** |
@@ -393,7 +393,7 @@ public final class PropertyParser extends PropertyTokenizer { | |||
} | |||
} | |||
} | |||
return (Property[]) args.toArray(new Property [ args.size() ]); | |||
return args.toArray(new Property [ args.size() ]); | |||
} | |||
/** |
@@ -144,7 +144,7 @@ public final class CommonFont { | |||
/** @return the first font-family name in the list */ | |||
public String getFirstFontFamily() { | |||
return ((Property) fontFamily.list.get(0)).getString(); | |||
return fontFamily.list.get(0).getString(); | |||
} | |||
/** @return the "font-selection-strategy" property */ |
@@ -140,7 +140,7 @@ public final class FontFamilyProperty extends ListProperty { | |||
/** {@inheritDoc} */ | |||
public String getString() { | |||
if (list.size() > 0) { | |||
Property first = (Property)list.get(0); | |||
Property first = list.get(0); | |||
return first.getString(); | |||
} else { | |||
return super.getString(); |
@@ -40,7 +40,7 @@ public final class FontUtil { | |||
int weight = 400; | |||
try { | |||
weight = Integer.parseInt(text); | |||
weight = ((int)weight / 100) * 100; | |||
weight = (weight / 100) * 100; | |||
weight = Math.max(weight, 100); | |||
weight = Math.min(weight, 900); | |||
} catch (NumberFormatException nfe) { |
@@ -990,7 +990,7 @@ public class TTFFile { | |||
int[] bboxInTTFUnits = mtxTab[glyphIndex].getBoundingBox(); | |||
int[] bbox = new int[4]; | |||
for (int i = 0; i < 4; i++) { | |||
bbox[i] = (int) convertTTFUnit2PDFUnit(bboxInTTFUnits[i]); | |||
bbox[i] = convertTTFUnit2PDFUnit(bboxInTTFUnits[i]); | |||
} | |||
return bbox; | |||
} |
@@ -103,7 +103,7 @@ public class CharVector implements Cloneable, Serializable { | |||
/** {@inheritDoc} */ | |||
public Object clone() throws CloneNotSupportedException { | |||
CharVector cv = (CharVector) super.clone(); | |||
cv.array = (char[])array.clone(); | |||
cv.array = array.clone(); | |||
return cv; | |||
} | |||
@@ -284,7 +284,7 @@ public class TernaryTree implements Cloneable, Serializable { | |||
} | |||
} | |||
if (a[start + i] != 0) { | |||
return (int)-a[start + i]; | |||
return -a[start + i]; | |||
} | |||
return 0; | |||
@@ -408,10 +408,10 @@ public class TernaryTree implements Cloneable, Serializable { | |||
/** {@inheritDoc} */ | |||
public Object clone() throws CloneNotSupportedException { | |||
TernaryTree t = (TernaryTree) super.clone(); | |||
t.lo = (char[])this.lo.clone(); | |||
t.hi = (char[])this.hi.clone(); | |||
t.eq = (char[])this.eq.clone(); | |||
t.sc = (char[])this.sc.clone(); | |||
t.lo = this.lo.clone(); | |||
t.hi = this.hi.clone(); | |||
t.eq = this.eq.clone(); | |||
t.sc = this.sc.clone(); | |||
t.kv = (CharVector)this.kv.clone(); | |||
return t; |
@@ -861,7 +861,7 @@ public abstract class AbstractBreaker { | |||
} | |||
int averageLineLength = 0; | |||
if (accumulatedLineLength > 0 && boxCount > 0) { | |||
averageLineLength = (int) (accumulatedLineLength / boxCount); | |||
averageLineLength = accumulatedLineLength / boxCount; | |||
log.debug("Average line length = " + averageLineLength); | |||
if (averageLineLength < greatestMinimumLength) { | |||
averageLineLength = greatestMinimumLength; |
@@ -244,7 +244,7 @@ public abstract class AbstractPageSequenceLayoutManager extends AbstractLayoutMa | |||
PageViewport pv = areaTreeModel.getPage(seq, page); | |||
int originalPosition = rm.getPosition(); | |||
rm.changePositionTo(Constants.EN_LEWP); | |||
mark = (Marker) pv.resolveMarker(rm); | |||
mark = pv.resolveMarker(rm); | |||
// this is probably not necessary since the RM will not be used again, but to be safe... | |||
rm.changePositionTo(originalPosition); | |||
if (mark != null) { |
@@ -71,7 +71,7 @@ public class BlockKnuthSequence extends KnuthSequence { | |||
if (keepTogether) { | |||
breakElement.setPenaltyValue(KnuthElement.INFINITE); | |||
add(breakElement); | |||
} else if (!((ListElement) getLast()).isGlue()) { | |||
} else if (!getLast().isGlue()) { | |||
breakElement.setPenaltyValue(0); | |||
add(breakElement); | |||
} |
@@ -115,7 +115,7 @@ public abstract class LocalBreaker extends AbstractBreaker { | |||
protected void doPhase3(PageBreakingAlgorithm alg, int partCount, BlockSequence originalList, | |||
BlockSequence effectiveList) { | |||
if (partCount > 1) { | |||
PageBreakPosition pos = (PageBreakPosition) alg.getPageBreaks().getFirst(); | |||
PageBreakPosition pos = alg.getPageBreaks().getFirst(); | |||
int firstPartLength = ElementListUtils.calcContentLength(effectiveList, | |||
effectiveList.ignoreAtStart, pos.getLeafPos()); | |||
overflow += alg.totalWidth - firstPartLength; |
@@ -328,8 +328,7 @@ public class PageBreaker extends AbstractBreaker { | |||
//restarting point | |||
addAreas(alg, restartPoint, originalList, effectiveList); | |||
//Get page break from which we restart | |||
PageBreakPosition pbp = (PageBreakPosition) | |||
alg.getPageBreaks().get(restartPoint - 1); | |||
PageBreakPosition pbp = alg.getPageBreaks().get(restartPoint - 1); | |||
newStartPos = alg.par.getFirstBoxIndex(pbp.getLeafPos() + 1); | |||
//Handle page break right here to avoid any side-effects | |||
if (newStartPos > 0) { |
@@ -289,7 +289,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager | |||
} | |||
int n = childrenLMs.size(); | |||
for (int j = 0; j < n; j++) { | |||
LayoutManager lm = (LayoutManager) childrenLMs.get(j); | |||
LayoutManager lm = childrenLMs.get(j); | |||
if (lm == null) { | |||
return; | |||
} else if (lm instanceof RetrieveTableMarkerLayoutManager) { |
@@ -350,7 +350,7 @@ public class TableContentLayoutManager implements PercentBaseContext { | |||
Position lastPos = null; | |||
Position lastCheckPos = null; | |||
while (parentIter.hasNext()) { | |||
Position pos = (Position)parentIter.next(); | |||
Position pos = parentIter.next(); | |||
if (pos instanceof SpaceHandlingBreakPosition) { | |||
//This position has only been needed before addAreas was called, now we need the | |||
//original one created by the layout manager. |
@@ -250,7 +250,7 @@ public class PDFFilterList { | |||
// run the filters | |||
int nonNullParams = 0; | |||
for (int count = 0; count < filters.size(); count++) { | |||
PDFFilter filter = (PDFFilter)filters.get(count); | |||
PDFFilter filter = filters.get(count); | |||
// place the names in our local vector in reverse order | |||
if (filter.getName().length() > 0) { | |||
names.add(0, filter.getName()); | |||
@@ -365,7 +365,7 @@ public class PDFFilterList { | |||
OutputStream out = stream; | |||
if (!isDisableAllFilters()) { | |||
for (int count = filters.size() - 1; count >= 0; count--) { | |||
PDFFilter filter = (PDFFilter)filters.get(count); | |||
PDFFilter filter = filters.get(count); | |||
out = filter.applyFilter(out); | |||
} | |||
} |
@@ -446,7 +446,7 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
* @return document id of the corner image | |||
*/ | |||
public String getCachedRoundedCorner(String cornerKey) { | |||
return (String)roundedCornerNameCache.get(cornerKey); | |||
return roundedCornerNameCache.get(cornerKey); | |||
} | |||
@@ -992,7 +992,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
} | |||
private Typeface getTypeface(String fontName) { | |||
Typeface tf = (Typeface) fontInfo.getFonts().get(fontName); | |||
Typeface tf = fontInfo.getFonts().get(fontName); | |||
if (tf instanceof LazyFont) { | |||
tf = ((LazyFont)tf).getRealFont(); | |||
} |
@@ -51,8 +51,8 @@ public class Java2DGraphics2DAdapter extends AbstractGraphics2DAdapter { | |||
float imw = (float)dim.getWidth() / 1000f; | |||
float imh = (float)dim.getHeight() / 1000f; | |||
float sx = fwidth / (float)imw; | |||
float sy = fheight / (float)imh; | |||
float sx = fwidth / imw; | |||
float sy = fheight / imh; | |||
Java2DRenderer renderer = (Java2DRenderer)context.getRenderer(); | |||
Java2DGraphicsState state = renderer.state; |
@@ -51,7 +51,7 @@ public class ImageEncoderPNG implements ImageEncoder { | |||
*/ | |||
public ImageEncoderPNG(ImageRawPNG image) { | |||
this.image = image; | |||
ColorModel cm = ((ImageRawPNG) this.image).getColorModel(); | |||
ColorModel cm = this.image.getColorModel(); | |||
if (cm instanceof IndexColorModel) { | |||
numberOfInterleavedComponents = 1; | |||
} else { |
@@ -76,8 +76,8 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { | |||
&& ImageHandlerUtil.isConversionModeBitmap(foreign)); | |||
} | |||
float sx = paintAsBitmap ? 1.0f : (fwidth / (float)imw); | |||
float sy = paintAsBitmap ? 1.0f : (fheight / (float)imh); | |||
float sx = paintAsBitmap ? 1.0f : (fwidth / imw); | |||
float sy = paintAsBitmap ? 1.0f : (fheight / imh); | |||
gen.commentln("%FOPBeginGraphics2D"); | |||
gen.saveGraphicsState(); | |||
@@ -102,7 +102,7 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { | |||
gen.getCurrentState().concatMatrix(transform); | |||
if (paintAsBitmap) { | |||
//Fallback solution: Paint to a BufferedImage | |||
int resolution = (int)Math.round(context.getUserAgent().getTargetResolution()); | |||
int resolution = Math.round(context.getUserAgent().getTargetResolution()); | |||
RendererContextWrapper ctx = RendererContext.wrapRendererContext(context); | |||
BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false); | |||
@@ -65,8 +65,8 @@ public class PSImageHandlerGraphics2D implements PSImageHandler { | |||
float imw = (float)dim.getWidth() / 1000f; | |||
float imh = (float)dim.getHeight() / 1000f; | |||
float sx = fwidth / (float)imw; | |||
float sy = fheight / (float)imh; | |||
float sx = fwidth / imw; | |||
float sy = fheight / imh; | |||
gen.commentln("%FOPBeginGraphics2D"); | |||
gen.saveGraphicsState(); |
@@ -43,7 +43,7 @@ public class RtfJforCmd extends RtfContainer { | |||
RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException { | |||
super((RtfContainer)parent, w); | |||
super(parent, w); | |||
attrib = attrs; | |||
} | |||
@@ -48,7 +48,7 @@ public class RtfList extends RtfContainer { | |||
/** Create an RTF list as a child of given container with given attributes */ | |||
RtfList(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException { | |||
super((RtfContainer)parent, w, attr); | |||
super(parent, w, attr); | |||
//random number generator for ids | |||
listId = new Integer(listIdGenerator.nextInt()); |
@@ -104,7 +104,7 @@ public abstract class PDFTextUtil extends org.apache.fop.pdf.PDFTextUtil { | |||
* @return true if it's a multi-byte font | |||
*/ | |||
protected boolean isMultiByteFont(String name) { | |||
Typeface f = (Typeface)fontInfo.getFonts().get(name); | |||
Typeface f = fontInfo.getFonts().get(name); | |||
return f.isMultiByte(); | |||
} | |||
@@ -170,7 +170,7 @@ public class AdvancedMessageFormat { | |||
} | |||
} else { | |||
String format = parts[1]; | |||
PartFactory factory = (PartFactory)PART_FACTORIES.get(format); | |||
PartFactory factory = PART_FACTORIES.get(format); | |||
if (factory == null) { | |||
throw new IllegalArgumentException( | |||
"No PartFactory available under the name: " + format); | |||
@@ -184,7 +184,7 @@ public class AdvancedMessageFormat { | |||
} | |||
private static Function getFunction(String functionName) { | |||
return (Function)FUNCTIONS.get(functionName); | |||
return FUNCTIONS.get(functionName); | |||
} | |||
/** |