*/
public class FOText extends FObj {
- protected char[] ca;
- protected int start;
- protected int length;
- TextInfo textInfo;
- TextState ts;
+ private char[] ca;
+ private int start;
+ private int length;
+ private TextInfo textInfo;
+ private TextState ts;
/**
* Keeps track of the last FOText object created within the current
* block. This is used to create pointers between such objects.
+ * TODO: As soon as the control hierarchy is straightened out, this static
+ * variable needs to become an instance variable in some parent object,
+ * probably the page-sequence.
*/
private static FOText lastFOTextProcessed = null;
*/
private Block ancestorBlock = null;
- public static final int IS_WORD_CHAR_FALSE = 0;
- public static final int IS_WORD_CHAR_TRUE = 1;
- public static final int IS_WORD_CHAR_MAYBE = 2;
+ private static final int IS_WORD_CHAR_FALSE = 0;
+ private static final int IS_WORD_CHAR_TRUE = 1;
+ private static final int IS_WORD_CHAR_MAYBE = 2;
+ /**
+ *
+ * @param chars array of chars which contains the text in this object (may
+ * be a superset of the text in this object
+ * @param s starting index into char[] for the text in this object
+ * @param e ending index into char[] for the text in this object
+ * @param ti TextInfo object for the text in this object
+ * @param parent FONode that is the parent of this object
+ */
public FOText(char[] chars, int s, int e, TextInfo ti, FONode parent) {
super(parent);
this.start = 0;
list.add(lm);
}
+ /**
+ * @return a new TextCharIterator
+ */
public CharIterator charIterator() {
return new TextCharIterator();
}
}
}
// if the last FOText is a sibling, point to it, and have it point here
- if ( lastFOTextProcessed != null) {
+ if (lastFOTextProcessed != null) {
if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) {
prevFOTextThisBlock = lastFOTextProcessed;
prevFOTextThisBlock.nextFOTextThisBlock = this;
- }
- else {
+ } else {
prevFOTextThisBlock = null;
}
}
* well, such as word-spacing. The definition of "word" is somewhat ambiguous
* and appears to be definable by the user agent.
*
- * @param (int i) with index to ca[]
+ * @param i index into ca[]
*
* @return True if the character at this location is the start of a new
* word.
* block as one unit, allowing text in adjoining FOText objects to be
* returned if the parameters are outside of the current object.
*
- * @param (int i) with the index for ca[]
- * @param (int offset) signed integer with relative position within the
+ * @param i index into ca[]
+ * @param offset signed integer with relative position within the
* block of the character to return. To return the character immediately
* preceding i, pass -1. To return the character immediately after i,
* pass 1.
- * @return char the character in the offset position within the block.
- * @return \u0000 if the offset points to an area outside of the block.
+ * @return the character in the offset position within the block; \u0000 if
+ * the offset points to an area outside of the block.
*/
public char getRelativeCharInBlock(int i, int offset) {
// The easy case is where the desired character is in the same FOText
char charToReturn = '\u0000';
FOText nodeToTest = this;
int remainingOffset = offset + i;
- while (! foundChar) {
+ while (!foundChar) {
if (nodeToTest.prevFOTextThisBlock == null) {
foundChar = true;
break;
if ((nodeToTest.ca.length + remainingOffset) >= 0) {
charToReturn = nodeToTest.ca[nodeToTest.ca.length + remainingOffset];
foundChar = true;
- }
- else {
+ } else {
remainingOffset = remainingOffset + nodeToTest.ca.length;
}
}
}
/**
- * @return The previous FOText node in this Block.
- * @return null, if this is the first FOText in this Block.
+ * @return The previous FOText node in this Block; null, if this is the
+ * first FOText in this Block.
*/
public FOText getPrevFOTextThisBlock () {
return prevFOTextThisBlock;
}
/**
- * @return The next FOText node in this Block.
- * @return null, if this is the last FOText in this Block, or if subsequent
- * FOText nodes have not yet been processed.
+ * @return The next FOText node in this Block; null if this is the last
+ * FOText in this Block; null if subsequent FOText nodes have not yet been
+ * processed.
*/
public FOText getNextFOTextThisBlock () {
return nextFOTextThisBlock;
/**
* Transforms one character in ca[] using the text-transform property.
*
- * @param int with index for ca[]
+ * @param i the index into ca[]
* @return char with transformed value
*/
public char charTransform(int i) {
are capitalized. We will try to let Java handle this.
*/
return Character.toTitleCase(ca[i]);
- }
- else {
+ } else {
return Character.toLowerCase(ca[i]);
}
default:
* We have not found a definition of "word" in the standard (1.0), so the
* logic used here is based on the programmer's best guess.
*
- * @param char inputChar: the character to be tested.
+ * @param inputChar the character to be tested.
* @return int IS_WORD_CHAR_TRUE, IS_WORD_CHAR_FALSE, or IS_WORD_CHAR_MAYBE,
* depending on whether the character should be considered part of a word
* or not.
case Character.CURRENCY_SYMBOL:
return IS_WORD_CHAR_TRUE;
case Character.DASH_PUNCTUATION:
- if (inputChar == '-') return IS_WORD_CHAR_TRUE; //hyphen
+ if (inputChar == '-') {
+ return IS_WORD_CHAR_TRUE; //hyphen
+ }
return IS_WORD_CHAR_FALSE;
case Character.DECIMAL_DIGIT_NUMBER:
return IS_WORD_CHAR_TRUE;
case Character.ENCLOSING_MARK:
return IS_WORD_CHAR_FALSE;
case Character.END_PUNCTUATION:
- if (inputChar == '\u2019') return IS_WORD_CHAR_MAYBE; //apostrophe, right single quote
+ if (inputChar == '\u2019') {
+ return IS_WORD_CHAR_MAYBE; //apostrophe, right single quote
+ }
return IS_WORD_CHAR_FALSE;
case Character.FORMAT:
return IS_WORD_CHAR_FALSE;
case Character.OTHER_NUMBER:
return IS_WORD_CHAR_TRUE;
case Character.OTHER_PUNCTUATION:
- if (inputChar == '\'') return IS_WORD_CHAR_MAYBE; //ASCII apostrophe
+ if (inputChar == '\'') {
+ return IS_WORD_CHAR_MAYBE; //ASCII apostrophe
+ }
return IS_WORD_CHAR_FALSE;
case Character.OTHER_SYMBOL:
return IS_WORD_CHAR_TRUE;
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.layout.BorderAndPadding;
private boolean bStartBoundary = false;
private boolean bEndBoundary = false;
+ /**
+ * @param fobj the object for whose character contents and for whose
+ * descendant's character contents should be iterated
+ * @param bap
+ */
public InlineCharIterator(FObj fobj, BorderAndPadding bap) {
super(fobj);
checkBoundaries(bap);
|| bap.getPaddingRight(false) > 0);
}
+ /**
+ * @return true if there are more characters
+ */
public boolean hasNext() {
if (bStartBoundary) {
return true;
*/
}
+ /**
+ * @return the next character
+ * @throws NoSuchElementException if there are no more characters
+ */
public char nextChar() throws NoSuchElementException {
if (bStartBoundary) {
bStartBoundary = false;
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.datatypes.Keep;
+/**
+ * Superclass for properties that wrap Keep values
+ */
public class KeepProperty extends Property {
+ /**
+ * Inner class for creating instances of KeepProperty
+ */
public static class Maker extends Property.Maker {
+ /**
+ * @param name name of property for which Maker should be created
+ */
protected Maker(String name) {
super(name);
}
private Keep keep;
+ /**
+ * @param keep Keep value to wrap in this Property
+ */
public KeepProperty(Keep keep) {
this.keep = keep;
}
+ /**
+ * @return this.keep
+ */
public Keep getKeep() {
return this.keep;
}
+ /**
+ * @return this.keep cast as Object
+ */
public Object getObject() {
return this.keep;
}