ECJ-INTEREST-L Archives

February 2008

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version:
1.0 (Apple Message framework v915)
Content-Type:
text/plain; charset=US-ASCII; format=flowed; delsp=yes
Date:
Mon, 11 Feb 2008 12:02:30 +1100
Reply-To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Subject:
From:
Michael Hart <[log in to unmask]>
Content-Transfer-Encoding:
7bit
Sender:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Comments:
Parts/Attachments:
text/plain (43 lines)
The parameters are sorted - but only after being copied into the array  
that they're printed from.

Here's a fix (does away with the array copy entirely):

Index: ParameterDatabase.java
===================================================================
RCS file: /cvs/ecj/ecj/ec/util/ParameterDatabase.java,v
retrieving revision 1.5
diff -c -r1.5 ParameterDatabase.java
*** ParameterDatabase.java	4 Feb 2008 19:07:34 -0000	1.5
--- ParameterDatabase.java	11 Feb 2008 00:57:27 -0000
***************
*** 2289,2303 ****
                   vec.addElement(e.nextElement());

               // sort the keys
-             Object[] array = new Object[vec.size()];
-             vec.copyInto(array);
-
               java.util.Collections.sort(vec);

               // Uncheck and print each item
!             for (int x = 0; x < array.length; x++)
                   {
!                 String s = (String) (array[x]);
                   String v = null;
                   if (s != null)
                       v = (String) gather.get(s);
--- 2289,2300 ----
                   vec.addElement(e.nextElement());

               // sort the keys
               java.util.Collections.sort(vec);

               // Uncheck and print each item
!             for (int x = 0; x < vec.size(); x++)
                   {
!                 String s = (String) vec.get(x);
                   String v = null;
                   if (s != null)
                       v = (String) gather.get(s);

ATOM RSS1 RSS2