On Tue, Jul 10, 2012 at 2:59 AM, Andrea Aime <andrea.a...@geo-solutions.it> wrote: > On Mon, Jul 9, 2012 at 11:08 PM, Gabriel Roldan <grol...@opengeo.org> wrote: >> Alright, thanks all for the comments. >> A separate interface was my preference as well but for some reason I >> thought it would bring higher hesitation. Glad it doesn't. >> So, for the time being I can go with InternalFunction as a marker interface. >> I don't quite see the need for a clone like method, as it's purpose is >> to easily allow for anonymous inner classes to be used as function and >> hence I can't think of a use case where such an object wouldn't be >> immutable given there's no FilterFactory that would return a different >> implementation or anything like that? > > The problem is not the immutability of the object itself, but the one of its > parameters. During simplification one might notice one of the parameters > is a constant and replace it with it, but if the function itself has to > be managed as immutable that simplification would be impossible.
right, but my use case doesn't involve any parameters at all. It's just a convenience to write an arbitrary expression in-place. So that new Predicate<LayerInfo>(){ public boolean apply(LayerInfo li){ return something; } } becomes: ff.equals(Boolean.TRUE, new InternalFunction(){ public Object evaluate(Object o){ return something; } } ); If you still consider InternalFunction should work against its parameters, I'd like to see an example. In any case I've no strong position on whether to make it "cloneable" or not by means of a custom method like Jody proposed, just doesn't fit with what I have in mind, but could go with it if it seems generally useful for others. Cheers, Gabriel > > This in turn might have runtime consequences, as constant value does > not mean no computation, for example, think of calling the cross filtering > functions over a layer, if you call them repeatedly they will do > a full data access for each call > > Cheers > Andrea > > > -- > Ing. Andrea Aime > GeoSolutions S.A.S. > Tech lead > > Via Poggio alle Viti 1187 > 55054 Massarosa (LU) > Italy > > phone: +39 0584 962313 > fax: +39 0584 962313 > mob: +39 339 8844549 > > http://www.geo-solutions.it > http://geo-solutions.blogspot.com/ > http://www.youtube.com/user/GeoSolutionsIT > http://www.linkedin.com/in/andreaaime > http://twitter.com/geowolf -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel