Re: KVC NSArray attribute to double[] ?
Re: KVC NSArray attribute to double[] ?
- Subject: Re: KVC NSArray attribute to double[] ?
- From: James Cicenia <email@hidden>
- Date: Sun, 27 Aug 2006 21:31:41 -0500
Had to go with double as jFreeChart wants it. Just looped through..
was hoping to get some KVC goodness in some array handling.
- James
On Aug 27, 2006, at 9:16 PM, Peter Vandoros wrote:
James,
I have a feeling that KVC will wrap your double values
("calculatedRewardScore") into the Double object. So what you
actually get is an Object[] (actually Double[]) instead of double[].
Is Double[] good enough for what you need or do you still need
double[] ?
regards
Peter
James Cicenia wrote:
Sacha -
That gives me a compiler error. I tried that too. Searched
around ... I guess I just have to loop through.
- James
On Aug 27, 2006, at 8:51 PM, Sacha Michel Mallais wrote:
On Aug 27, 2006, at 6:22 PM, James Cicenia wrote:
Is there a way to use KVC to:
1) Given an array of EOs
2) Get an array of attribute A1 which is a double.
Not directly.
I was hoping to do:
double[] y = (double[])projects.valueForKeyPath
("calculatedRewardScore");
but this throws an exception.
What am I doing wrong?
valueForKey (and valueForKeyPath) on an NSArray return an NSArray
(unless using an aggregate function like @sum, in which case they
return a Double IIRC). What you want is (warning, untested code):
double[] y = (double[])((NSArray)projects.valueForKeyPath
("calculatedRewardScore")).objects();
sacha
--Sacha Michel Mallais 400 kg chimp
Global Village Consulting Inc. http://www.global-village.net/
PGP Key ID: 7D757B65 AIM: smallais
"Choke on that, causality!" -- the Professor, "Futurama"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40etechgroup.com.au
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40jimijon.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden