On 10/10/2012 12:04 AM, Gilles Sadowski wrote:
> Hi.
>
>> [...]
>>
>> public interface ConvexHull<S extends Space> {
>> Vector<S>[] generate(Vector<S>[] points);
>> }
>
> I think that you should use "List" instead of arrays (even "Iterable"
> whenever possible); it will be plainly more flexible. Just a little
> thought...
I have now several implementations of at least 2D algorithms with this
interface:
Iterable<Vector2D> generate(Iterable<Vector2D> points)
which works, but I find it quite cumbersome for the following reasons:
* Iterable obviously does not provide a size() method which is quite
handy in the algorithms
* the addAll() method of collections is not defined for Iterable, but
only for Collection
So I would better opt for an interface like:
Iterable<Vector2D> generate(Collection<Vector2D> points)
The output may be an Iterable as it is ordered, a Collection might give
a wrong impression to the user (a Collection is not sorted per se,
although the same is true for Iterable, hmm)
What do you think?
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]