ECJ-INTEREST-L Archives

March 2014

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Subject:
From:
Raymond Shpeley <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Wed, 5 Mar 2014 01:41:17 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
Thanks. Actually the cast did work. Eclipse gave me warning errors with a cast 
that went away after I compiled it. If I had kept the cast in and tried compiling 
I would have saved myself some time. Still learning these quirks.

I'll keep your suggestion in mind, just in case.

-- ray

On Wed, 5 Mar 2014 00:42:05 -0500, Sean Luke <[log in to unmask]> wrote:

>On Mar 4, 2014, at 8:37 PM, Raymond Shpeley <[log in to unmask]> 
wrote:
>
>> The iterator works fine. Thanks.
>>
>> Now I'm trying to figure out how to get it into integer data form. I'm using 
an
>> ArrayList to hold the terminals after iteration and have tried various casts 
to no
>> avail when I want to put one of the terminals into an int.
>
>Why can't you just say:
>
>int[] vals = root.numNodes(GPNode.NODESEARCH_TERMINALS);
>int count = 0;
>Iterator it = root.iterator(GPNode.NODESEARCH_TERMINALS);
>while(it.hasNext())
>	{
>	TsERC erc = (TSERC)(it.next());
>	vals[count++] = erc.theInteger;  // or wherever you stored it
>	}
>
>Sean

ATOM RSS1 RSS2