Rajarshi Guha wrote:
>
> On May 22, 2008, at 1:34 AM, Nina Jeliazkova wrote:
> >>
> >> So if you're going to do an instanceof check, why not do 3 more :)
> > Main reason - code doesn't look good :) ( joking). Also AFAIK,
> > "instance of" is not considered an efficient piece of code from
> > performance point of view, aside from aesthetic reasons. Finally,
> > imagine somebody introduce a derived DescriptorResult type for a
> > descriptor he is inventing. This will need adding "instance of"
> > check in every piece of code that works with descriptors, while in
> > case of exploiting inheritance, it will be handled by the derived
> > type and the integration is completely transparent.
>
> > Some possible solutions:
> > - The top class in the hierarchy can be array, with size 1 for scalars
> > - The results can be accessed via iterator, which will (naturally)
> > return only a single value for the scalar.
> > - Some other technique, based on generics (let me get my morning
> > coffee first ...)
>
> Hmm, making the top class an array type would be a good idea. But at
> one point you'd need to know the type of the result (numeric, string,
> boolean) to do something with it. Since the top class would probably
> be an array of Object
>
What about
public interface IDescriptorResult<T> extends Iterator<T> {
double doubleValue();
int intValue();
String stringValue();
...
//or even
double convert(T value);
String convert(T value);
}
Then there could be a top class based on T[] , but also another one
based on other collections.
Just came to my mind this is not far away from jdbc ResultSet interface
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html - see
lot of getXXX() methods in there.
A step further might be to introduce the short descriptor name into
IDescriptorResult interface, rather than in a separate array.
> > There are other issues of interest to me in QSAR library, for
> > example having descriptors short names somewhere in
> > DescriptorSpecification, rather than only in DescriptorValue.
>
> I agree with this - I'd like to be able to get the expected number of
> descriptors and the escriptor names before calculating the
Yes.
Regards,
Nina
> descriptors themselves (i.e., maybe as a static method of individual
> descriptor classes etc). I think the first one is possible now and
> the last one is certainly doable - just needs to move some code
> around in each of the descriptor classes
>
> -------------------------------------------------------------------
> Rajarshi Guha <[EMAIL PROTECTED]>
> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84
> -------------------------------------------------------------------
> Q: What do you get when you put a spinning flywheel in a casket and
> turn a corner?
> A: A funeral precession.
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user