compareSpecificityTo

fun compareSpecificityTo(other: StylePattern): AbstractNumberDescriptor.Order

Determine the relative specificity of the receiver and the argument. The relative specificity of two patterns is determined according to the following criteria:

  • If two patterns are equal, then they are equally specific.

  • All exact matches are mutually incomparable.

  • Any exact match is more specific than any inexact match.

  • For inexact matches, given two patternsP and Q, the following rules are applied in order:

    • If P contains Q, then P is more specific.

    • If |successions(P)| = |successions(Q)|, where successions computes the successions of its argument, and every succession of P is more specific than the corresponding succession of Q, then P is more specific.

    • If |successions(P)| = 1 and |successions(Q)| > 1, then P and Q are incomparable.

    • If every succession of P occurs within Q, preserving order and advancing monotonically, and |P| ≤ |Q|, then Q is more specific.

    • Otherwise, P and Q are incomparable.

Return

The relation of the two patterns with respect to specificity.

Parameters

other

The pattern to check specificity against.