Pull request: Allow overriding Range implementation (#224)

7 views
Skip to first unread message

Michael Bedward

unread,
Nov 19, 2013, 8:01:41 PM11/19/13
to jai-...@googlegroups.com
Hi all,

Please see the pull request below and my comment on it. The PR adds
clone and Cloneable which I'm not keen on, so I've suggested adding
either a copy member function or a static factory function to achieve
the same thing.

Any opinions ?

Michael


---------- Forwarded message ----------
From: jdries <notifi...@github.com>
Date: 19 November 2013 19:02
Subject: [jaitools] Allow overriding Range implementation (#224)
To: mbedward/jaitools <jait...@noreply.github.com>


The current implementation uses a copy constructor to create defensive
copies of the Range parameter. The side effect of this approach is
that the Range class can not be overridden. I want to be able to
override it, so I can provide an implementation of 'contains' which is
more efficient for my very specific use case (so the performance
improvement can't be generalized.)

This patch makes Range cloneable, and uses the clone method instead of
a copy constructor, which solves the issue!

________________________________

You can merge this Pull Request by running

git pull https://github.com/jdries/jaitools master

Or view, comment on, or merge it at:

https://github.com/mbedward/jaitools/pull/224

Commit Summary

Update Range.java
Update AbstractProcessor.java
Update StreamingSampleStats.java
Use clone to allow overriding of the Range class for improved performance

File Changes

M operator/zonalstats/src/main/java/org/jaitools/media/jai/zonalstats/ZonalStatsOpImage.java
(4)
M utils/src/main/java/org/jaitools/numeric/AbstractProcessor.java (6)
M utils/src/main/java/org/jaitools/numeric/Range.java (16)
M utils/src/main/java/org/jaitools/numeric/StreamingSampleStats.java (6)

Patch Links:

https://github.com/mbedward/jaitools/pull/224.patch
https://github.com/mbedward/jaitools/pull/224.diff
Reply all
Reply to author
Forward
0 new messages