oops--fwding to list: --- Matt Benson <[EMAIL PROTECTED]> wrote:
> Date: Thu, 4 Jan 2007 11:29:44 -0800 (PST) > From: Matt Benson <[EMAIL PROTECTED]> > Subject: RE: Resource Collections in 1.7 > To: "Rebo, Alex" <[EMAIL PROTECTED]> > > > --- "Rebo, Alex" <[EMAIL PROTECTED]> wrote: > > > No problem :) And for the future references, the > > answer is "no". > > > > So, to get a number of elements in the collection, > > say, fileset, > > I have to create an "empty" set (let's refer to it > > as fs2) and: > > <resourcecount> > > <difference> > > <fileset refid="fs1" /> > > <fileset refid="fs2" /> > > </difference> > > </resourcecount> > > > > ? > > > > That's sure one way to do things. > > However, looking at <resources>, implementing > > ResourceCollection, > > I noticed that it exposes a common "collection" > > behavior: > > > > iterator, size. > > The ResourceCollection interface defines the > iterator() and size() methods, thus all > ResourceCollections implement these. <resources> is > what you use: > > 1. when you just want to contain a bunch of other > resource collections, or > 2. when you want to refer to another resource > collection by refid (and you don't know its type). > > > > > Q.: how can I refer to these features of the > > fileset? > > Again, the most direct way to refer to the size() > method in an Ant buildfile is via the > <resourcecount> > task. Likewise, the most direct way to refer to the > iterator() contents would be via ant-contrib's <for> > task, which automatically deals with any type that > returns an Iterator from an iterator() method. Most > of Ant's built-in tasks also deal with resource > collections, so there should be quite a bit of power > already available to you. > > HTH, > Matt > > > > > <resources refid="fs1"> > > <???/> > > </resources> > > > > Many thanks! > > > > -----Original Message----- > > From: Matt Benson [mailto:[EMAIL PROTECTED] > > Sent: Thursday, January 04, 2007 13:34 > > To: Ant Users List > > Subject: Re: Resource Collections in 1.7 > > > > > > --- "Rebo, Alex" <[EMAIL PROTECTED]> wrote: > > > > Any relation to Max? (sorry, couldn't resist...) > > > > > > > > >Hello, > > > > > > > >Could you, please, help me to understand how to > > > utilize Resource > > > >Collections? > > > > > > > >As an example, please, consider illustrating > how > > > Ant task may verify the > > > >proper # of elements in a particular collection > > > (say, number of files in a > > > >fileset) or > > > >operate only on a subset of elements that > > different > > > from the list obtained > > > >in an earlier step (i.e., contents of some > other > > > directory, represented, > > > >say, by a fileset). > > > > > > > > What? You want to know how many elements of one > > fileset are not in another fileset? Given > filesets > > f1 > > and f2: > > > > <resourcecount> > > <difference> > > <fileset refid="fs1" /> > > <fileset refid="fs2" /> > > </difference> > > </resourcecount> > > > > Does that answer your question? > > > > -Matt > > > > > >Honestly tried to figure it out from the > manual, > > > but ... > > > > > > > >Many thanks! > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > > protection around > > http://mail.yahoo.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
