Service Name: Services::COMPARATOR

The comparator is simply an invokable class that receives two Versions as arguments by implementing ComparatorInterface. The reason its a class is that we preferred to make sure we had control over the comparator’s signature - if we had accepted closures we would have forced implementations to make many unnecessary parameter type-checks.

When invoked, the comparator must return an integer less than, equal to, or greater than 0 (zero) in order to indicate if the first version is earlier than, equal to, or later than the second version (respectively). By earlier/later we refer to the order in which the versions should be executed.

The Comparator is used at different points in the domain logic so its useful to have it as a service.

The default Comparator used by Baleen CLI is an instance of DefaultComparator. The service is registered by default in the TimelineProvider.