ASF Bugzilla – Attachment 1874 Details for
Bug 9114
[PATCH] fix RowRecordAggregate.getRow bug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ooops forgot to add @author in the last one
RowRecordsAggregate.diff (text/plain), 2.58 KB, created by
Tal Moshaiov
on 2002-05-15 15:09:27 UTC
(
hide
)
Description:
ooops forgot to add @author in the last one
Filename:
MIME Type:
Creator:
Tal Moshaiov
Created:
2002-05-15 15:09:27 UTC
Size:
2.58 KB
patch
obsolete
>Index: RowRecordsAggregate.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java,v >retrieving revision 1.2 >diff -r1.2 RowRecordsAggregate.java >62c62 >< import java.util.HashMap; >--- >> import java.util.TreeMap; >64a65 >> import java.util.Comparator; >68a70 >> * @author Tal Moshaiov (talm@vistaportal.com) >76c78 >< HashMap records = null; >--- >> TreeMap records = null; >80d81 >< >83c84 >< records = new HashMap(); >--- >> records = new TreeMap(new RowRecordsComparator()); >219c220,268 >< } >--- >> >> /** >> * compares between two row records according to their row number >> */ >> private class RowRecordsComparator implements Comparator >> { >> /** >> * Object equality, implemented as object identity >> * @param o Object we're being compared to >> * @return true if identical, else false >> */ >> public boolean equals(Object obj) >> { >> return this == obj; >> } >> >> /** >> * compare method. Checks if any of the parameters is null or not >> * instances of RowRecord. >> * One row is less than another if its row number is smaller than >> * the other's. >> * >> * @param row1 first object to compare, better be a RowRecord >> * @param row2 second object to compare, better be a RowRecord >> * >> * @return negative value if row1 < row2, >> * zero if row1 == row2, >> * positive value if row1 > row2. >> */ >> public int compare(Object row1, Object row2) { >> //if any of the records is null, return not equal >> if (row1 == null || row2 == null) >> return -1; >> //if any of the objects isn't a RowRecrod, return not equal >> if (!(row2 instanceof RowRecord && row2 instanceof RowRecord)) >> return -1; >> //get row numbers of both row records >> int row1Number = ((RowRecord)row1).getRowNumber(); >> int row2Number = ((RowRecord)row2).getRowNumber(); >> //compare row numbers and return result >> if (row1Number == row2Number) >> return 0; >> else if (row1Number < row2Number) >> return -1; >> else >> return 1; >> } >> }//end private class RowRecordsComparator >> } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 9114
:
1873
| 1874