Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementations of Range.union misleading #276

Open
ulrichloup opened this issue Dec 6, 2020 · 0 comments
Open

Implementations of Range.union misleading #276

ulrichloup opened this issue Dec 6, 2020 · 0 comments

Comments

@ulrichloup
Copy link

ulrichloup commented Dec 6, 2020

The method Range.union(Range) in the package it.geosolutions.jaiext.range suggests that the resulting range represents the set-theoretic union of the two involved ranges. However, the concrete implementations, e.g. in RangeDouble do only return the smallest gapless range containing the union.

Did I miss a hint in the documentation on how unions of ranges are to be interpreted?
Otherwise, I suggest to extend the implementations of the class Range to support also gaps, e.g., by introducing another container class for sets of ranges. A clue in the documentation or renaming the method union would also solve this problem.

Example
Valid data is between 0 and 100, no-data values are the values from -9999 to 0 and from 100 to 9999 where 0 and 100 are excluded.

Range r1 = RangeFactory.create(-9999, true, 0, false);
Range r2 = RangeFactory.create(100, false, 9999, true);
Range r = r1.union(r2);

The resulting no-data range, however, is RangeInt[-9999, 9999], thus, covering also the valid data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant