gzz-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gzz] PEG ``vob_colorable--humppake``: Abstract Colorable Vob


From: Tuomas Lukka
Subject: Re: [Gzz] PEG ``vob_colorable--humppake``: Abstract Colorable Vob
Date: Tue, 11 Mar 2003 11:31:59 +0200
User-agent: Mutt/1.4i

On Tue, Mar 11, 2003 at 11:20:59AM +0200, Asko Soukka wrote:
> Tue, 11 Mar 2003, Tuomas Lukka wrote:
> > > > >     class Colorable "interface"
> > > > >         methods
> > > > >           +Colorable cloneColored(List colors)
> > > > >           +List getColors()
> > > > Now that it's immutable, I'm actually leaning slightly towards Color[] 
> > > > colors...
> > The reason is performance: arrays perform much better than lists, especially
> > in kaffe where garbage collection is relatively inefficient.
> 
> Well, using Color[] implies additional parameter to provide the amount of 
> colors in that array.
> 
>      class Colorable "interface"
>         methods
>           +Colorable cloneColored(Color[] colors, int ncolors)
>           +Color[] getColors()
> 
> Or additionally reading Color[] stops at the first null (is an 
> array always formatted with nulls in Java?).

Initialized? Yes. Java is very careful about that sort of thing - if it weren't,
hostile code executing in the sandbox might be able to read your private
information left over by some other class's use of the memory.

I think first null would be ok.

> Should we now add to AbstractColorableVob a static help function to help 
> handling Color[]?
> 
>     int addColor(Color[] colors, int ncolors, Color color)
>     // if colors is null, creates a new array, if colors.size > ncolors, 
>     // creates a new bigger array, otherwise places color to
>     // colors[ncolors] and adds one to ncolors. Returns ncolors.
> 
> Uh, that seems complex. And also the naming of those color 
> attrivutes is confusing :/

I don't really like this; it doesn't belong there. If you want to use a list
when building it up, you can and call list.toArray

        Tuomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]