import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import org.apache.poi.hwpf.model.io.HWPFFileSystem;
public class CHPBinTable
{
- private static final class CHPXStartComparator implements Comparator<CHPX>
- {
- static CHPXStartComparator instance = new CHPXStartComparator();
-
- public int compare( CHPX o1, CHPX o2 )
- {
- int thisVal = o1.getStart();
- int anotherVal = o2.getStart();
- return ( thisVal < anotherVal ? -1 : ( thisVal == anotherVal ? 0
- : 1 ) );
- }
- }
-
/** List of character properties.*/
protected ArrayList<CHPX> _textRuns = new ArrayList<CHPX>();
_textRuns.add(chpx);
}
}
- Collections.sort( _textRuns, CHPXStartComparator.instance );
+ Collections.sort( _textRuns, PropertyNode.StartComparator.instance );
}
public void adjustForDelete(int listIndex, int offset, int length)
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collections;
import org.apache.poi.hwpf.model.io.HWPFFileSystem;
import org.apache.poi.hwpf.model.io.HWPFOutputStream;
_paragraphs.add(papx);
}
}
+ Collections.sort( _paragraphs, PropertyNode.StartComparator.instance );
_dataStream = dataStream;
}
package org.apache.poi.hwpf.model;
import java.util.Arrays;
+import java.util.Comparator;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
*/
public abstract class PropertyNode<T extends PropertyNode<T>> implements Comparable<T>, Cloneable
{
+
+ static final class StartComparator implements Comparator<PropertyNode<?>>
+ {
+ static StartComparator instance = new StartComparator();
+
+ public int compare( PropertyNode<?> o1, PropertyNode<?> o2 )
+ {
+ int thisVal = o1.getStart();
+ int anotherVal = o2.getStart();
+ return ( thisVal < anotherVal ? -1 : ( thisVal == anotherVal ? 0
+ : 1 ) );
+ }
+ }
+
private final static POILogger _logger = POILogFactory.getLogger(PropertyNode.class);
protected Object _buf;
/** The start, in characters */
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.apache.poi.hwpf.model.io.HWPFFileSystem;
s.setEnd( CPtoFC(node.getEnd()) );
}
}
+
+ Collections.sort( _sections, PropertyNode.StartComparator.instance );
}
public void adjustForInsert(int listIndex, int length)
assertTrue( result.contains( "<table>" ) );
}
+ public void testO_kurs_doc() throws Exception
+ {
+ getHtmlText( "o_kurs.doc" );
+ }
+
public void testPageref() throws Exception
{
String result = getHtmlText( "pageref.doc" );