[ERA-CVS] src/org/jdaemon/era/helper AbstractReport.java,1.6,1.7 GroupingImpl.java,1.2,1.3 HelperTyp
Brought to you by:
jessex
|
From: <je...@us...> - 2004-07-14 16:13:10
|
Update of /cvsroot/era/src/org/jdaemon/era/helper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29946/helper Modified Files: AbstractReport.java GroupingImpl.java HelperTypes.java Log Message: Fixing various bugs which showed up in unit testing... mostly just implementing sensible equals operators but also a real problem with AbstractReport's constructor not correctly copying the list parameter. Index: AbstractReport.java =================================================================== RCS file: /cvsroot/era/src/org/jdaemon/era/helper/AbstractReport.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractReport.java 22 Jun 2004 08:23:33 -0000 1.6 --- AbstractReport.java 14 Jul 2004 16:12:44 -0000 1.7 *************** *** 23,32 **** public abstract class AbstractReport implements Report { ! private List levels = new LinkedList(); private boolean detail_flag = true; private Formatting detail_formatting = null; public AbstractReport(List groupings, Formatting detail_formatting) { ! this.levels = levels; this.detail_formatting = detail_formatting; this.detail_flag = detail_formatting != null; --- 23,32 ---- public abstract class AbstractReport implements Report { ! private List levels; private boolean detail_flag = true; private Formatting detail_formatting = null; public AbstractReport(List groupings, Formatting detail_formatting) { ! this.levels = groupings; this.detail_formatting = detail_formatting; this.detail_flag = detail_formatting != null; Index: GroupingImpl.java =================================================================== RCS file: /cvsroot/era/src/org/jdaemon/era/helper/GroupingImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GroupingImpl.java 14 Jun 2004 22:01:07 -0000 1.2 --- GroupingImpl.java 14 Jul 2004 16:12:44 -0000 1.3 *************** *** 198,200 **** --- 198,229 ---- return true; } + + /** Compare one GroupingImpl with another. + * + * GroupingImpls are deemed equal if formattings are equal and the collections of sorts + * and aggregates are both equal. + * + * @param other GroupingImpl to compare. + * @return true if GroupingImpl is the same as this one. + */ + public boolean equals(Object other) { + if (other instanceof GroupingImpl) { + GroupingImpl other_grp = (GroupingImpl)other; + if (this.aggregates.equals(other_grp.aggregates)) { + if (this.sorts.equals(other_grp.sorts)) { + if (this.formatting.equals(other_grp.formatting)) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } } Index: HelperTypes.java =================================================================== RCS file: /cvsroot/era/src/org/jdaemon/era/helper/HelperTypes.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HelperTypes.java 22 Jun 2004 08:23:33 -0000 1.4 --- HelperTypes.java 14 Jul 2004 16:12:44 -0000 1.5 *************** *** 46,49 **** --- 46,50 ---- ERATypes.SORT_LIST.put(representation, "sorts", grouping.getSortsArray()); ERATypes.AGGREGATE_LIST.put(representation, "aggregates", grouping.getAggregatesArray()); + ERATypes.FORMATTING.put(representation, "formatting", grouping.getFormatting()); } }; |