compare-returns-four-states

Status: IN

`VectorClock.compare` returns exactly one of `BEFORE`, `AFTER`, `EQUAL`, or `CONCURRENT`, implementing the partial order defined by component-wise comparison.

Source: entries/2026/05/29/vector-clocks-vector_clock.md

Example

def compare(self, other):
    # Returns "BEFORE", "AFTER", "EQUAL", or "CONCURRENT"
    if has_less and has_greater: return "CONCURRENT"
    if has_less: return "BEFORE"
    if has_greater: return "AFTER"
    return "EQUAL"

JSON