Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add new advanced records for integer and floating point ranges #45

Open
1 of 2 issues completed
Open
Assignees
Labels
acceptedIssue will be actioned enhancementNew feature or request in progressWork has started on this issue
@delphidabbler

Description

In issue #44 it became apparent that functions to work with ranges would be useful, including adding functions to get the length of a range.

After playing around with the existing simple structure and the TRangeEx advanced record it seems that newer advanced records would be useful.

We can't adapt TRangeEx because its constructor doesn't normalise the range so that the smallest value is the lowest. Changing the behaviour of that constructor isn't viable since doing that could break existing code.

So two new advanced records are proposed: TDoubleRange and TIntegerRange.

Each should have the following attributes and methods:

  • The range should be normalised so that the lower bound <= the upper bound. This should be enforced by the constructor.
  • The range should be immutable => the fields should be hidden and accessed via read-only properties.
  • There should be a Contains method.
  • There should be a Length method.
  • There should be a Constrain method to ensure a value fits into range.

We will allow a range of zero length where the upper and lower bounds are the same.

Question: should we have an enumeration that allows us to specify whether the bounds and inclusive or exclusive? If so should that be an immutable property of the range or should it just be passed to relevant functions. Should such a property only be applied to real ranges and not to integer ranges.

Sub-issues

Metadata

Metadata

Labels

acceptedIssue will be actioned enhancementNew feature or request in progressWork has started on this issue

Projects

Status

In progress

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /