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 10:36:52 +0200
User-agent: Mutt/1.4i

On Tue, Mar 11, 2003 at 10:28:02AM +0200, Asko Soukka wrote:
> Mon, 10 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...
> 
> Why is that? List would be easier to use, if colors are added one 
> by one before sending the whole list to a vob. We currently use 
> Color[] in BgVobs, but then we have a help function for adding 
> colors:
> 
>     public boolean addColor(Color c) {
>       if(solids == null || nsolids >= solids.length) {
>           Color[] n= new Color[nsolids + 10];
>           if(solids != null) System.arraycopy(solids, 0, n, 0, nsolids);
>           solids = n;
>       }
>       solids[nsolids++] = c;
>       return false;
>     }
> 
> Altough, this leaves some null pointers to the end of the array :(

The reason is performance: arrays perform much better than lists, especially
in kaffe where garbage collection is relatively inefficient.

        Tuomas




reply via email to

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