Skip to content

Implementations of Range.union misleading #276

@ulrichloup

Description

@ulrichloup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions