poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1142763 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
Date Mon, 04 Jul 2011 19:05:41 GMT
Author: sergey
Date: Mon Jul  4 19:05:40 2011
New Revision: 1142763

URL: http://svn.apache.org/viewvc?rev=1142763&view=rev
Log:
extract private getCharacterRun method with CHPX as parameter (used with reflection in workaround
in AbstractWordUtils)

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java?rev=1142763&r1=1142762&r2=1142763&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java Mon Jul  4 19:05:40
2011
@@ -781,28 +781,36 @@ public class Range { // TODO -instantiab
 	 *            The index of the character run to get.
 	 * @return The character run at the specified index in this range.
 	 */
-	public CharacterRun getCharacterRun(int index) {
-		initCharacterRuns();
-		CHPX chpx = _characters.get(index + _charStart);
-        
-        if (chpx == null) {
+    public CharacterRun getCharacterRun( int index )
+    {
+        initCharacterRuns();
+        CHPX chpx = _characters.get( index + _charStart );
+        return getCharacterRun( chpx );
+    }
+
+    private CharacterRun getCharacterRun( CHPX chpx )
+    {
+        if ( chpx == null )
+        {
             return null;
         }
 
-		int[] point = findRange(_paragraphs, _parStart, Math.max(chpx.getStart(), _start), chpx
-				.getEnd());
+        int[] point = findRange( _paragraphs, _parStart,
+                Math.max( chpx.getStart(), _start ), chpx.getEnd() );
 
-        if (point[0] >= _paragraphs.size()) {
+        if ( point[0] >= _paragraphs.size() )
+        {
             return null;
         }
 
-		PAPX papx = _paragraphs.get(point[0]);
-		short istd = papx.getIstd();
+        PAPX papx = _paragraphs.get( point[0] );
+        short istd = papx.getIstd();
 
-		CharacterRun chp = new CharacterRun(chpx, _doc.getStyleSheet(), istd, this);
+        CharacterRun chp = new CharacterRun( chpx, _doc.getStyleSheet(), istd,
+                this );
 
-		return chp;
-	}
+        return chp;
+    }
 
 	/**
 	 * Gets the section at index. The index is relative to this range.
@@ -1077,10 +1085,16 @@ public class Range { // TODO -instantiab
 		}
 	}
 
+	/**
+	 * @return Starting character offset of the range
+	 */
 	public int getStartOffset() {
 		return _start;
 	}
 
+	/**
+	 * @return The ending character offset of this range
+	 */
 	public int getEndOffset() {
 		return _end;
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message