[CAST-1773] First attempt to Interval and its unit tests.
[CAST-1773] Intervals implemented.
[CAST-1773] Minor refactoring while review.
[CAST-1773] Code improvements.
[CAST-1773] Code cleanness improvements and refactoring.