]> source.dussan.org Git - poi.git/commitdiff
add or improve toString() methods of several classes for debug purposes
authorSergey Vladimirov <sergey@apache.org>
Tue, 5 Jul 2011 00:48:00 +0000 (00:48 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 5 Jul 2011 00:48:00 +0000 (00:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142860 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java

index 22777a80e7702538554cd48f741fae18263ddd29..6ea71ebccf65d7f158c4f4590a8750c03c9acb8b 100644 (file)
 package org.apache.poi.hwpf.model;
 
 
-import org.apache.poi.util.LittleEndian;
-
-import org.apache.poi.hwpf.usermodel.ParagraphProperties;
 import org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor;
 import org.apache.poi.hwpf.sprm.SprmBuffer;
 import org.apache.poi.hwpf.sprm.SprmOperation;
+import org.apache.poi.hwpf.usermodel.ParagraphProperties;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * DANGER - works in bytes!
@@ -145,4 +144,10 @@ public final class PAPX extends BytePropertyNode {
     }
     return false;
   }
+
+    public String toString()
+    {
+        return "PAPX from " + getStart() + " to " + getEnd() + " (in bytes "
+                + getStartBytes() + " to " + getEndBytes() + ")";
+    }
 }
index fcc9997ab5bdf22fb02e86c5e9dda72a2242a573..b16837763a9202a25b8ad585e7c9d0f9d2afbd79 100644 (file)
@@ -197,6 +197,9 @@ public final class BorderCode implements Cloneable {
     @Override
     public String toString()
     {
+        if ( isEmpty() )
+            return "[BRC] EMPTY";
+
         StringBuffer buffer = new StringBuffer();
 
         buffer.append( "[BRC]\n" );
index 5d27d41a0c3dfc02a6a38345bde2ccac7dae323f..042bce2606a811773dc7b0bbdc88e0eaaa008d79 100644 (file)
@@ -517,4 +517,20 @@ public class Paragraph extends Range implements Cloneable {
     return retVal;
   }
 
+    @Override
+    public String toString()
+    {
+        return toString( true );
+    }
+
+    public String toString( boolean withPapx )
+    {
+        return "Paragraph ("
+                + getStartOffset()
+                + "--"
+                + getEndOffset()
+                + ")"
+                + ( withPapx ? "\n"
+                        + _props.toString().replaceAll( "\n", "\n\t" ) : "" );
+    }
 }