*/
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;
+ }
}
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);
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);
// 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
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;
}
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);
*/
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 {
* @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 {
* available.
*/
public ElementMapping getElementMapping(String namespaceURI) {
- return (ElementMapping)this.namespaces.get(namespaceURI);
+ return this.namespaces.get(namespaceURI);
}
/**
}
}
}
- return (Property[]) args.toArray(new Property [ args.size() ]);
+ return args.toArray(new Property [ args.size() ]);
}
/**
/** @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 */
/** {@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();
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) {
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;
}
/** {@inheritDoc} */
public Object clone() throws CloneNotSupportedException {
CharVector cv = (CharVector) super.clone();
- cv.array = (char[])array.clone();
+ cv.array = array.clone();
return cv;
}
}
}
if (a[start + i] != 0) {
- return (int)-a[start + i];
+ return -a[start + i];
}
return 0;
/** {@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;
}
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;
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) {
if (keepTogether) {
breakElement.setPenaltyValue(KnuthElement.INFINITE);
add(breakElement);
- } else if (!((ListElement) getLast()).isGlue()) {
+ } else if (!getLast().isGlue()) {
breakElement.setPenaltyValue(0);
add(breakElement);
}
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;
//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) {
}
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) {
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.
// 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());
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);
}
}
* @return document id of the corner image
*/
public String getCachedRoundedCorner(String cornerKey) {
- return (String)roundedCornerNameCache.get(cornerKey);
+ return roundedCornerNameCache.get(cornerKey);
}
}
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();
}
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;
*/
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 {
&& 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();
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);
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();
RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
- super((RtfContainer)parent, w);
+ super(parent, w);
attrib = attrs;
}
/** 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());
* @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();
}
}
} 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);
}
private static Function getFunction(String functionName) {
- return (Function)FUNCTIONS.get(functionName);
+ return FUNCTIONS.get(functionName);
}
/**