1
//! Canonical names and legacy aliases for global constraint operators.
2
//!
3
//! The `is_*` predicates accept legacy spellings for backwards compatibility with
4
//! older Essence models. We may remove those aliases once downstream models migrate.
5

            
6
/// Canonical Essence name for the all-different global constraint.
7
pub const ALL_DIFFERENT: &str = "allDifferent";
8

            
9
/// Canonical Essence name for the all-different-except global constraint.
10
pub const ALL_DIFFERENT_EXCEPT: &str = "allDifferentExcept";
11

            
12
/// Canonical Essence name for the global cardinality constraint.
13
pub const GLOBAL_CARDINALITY: &str = "globalCardinality";
14

            
15
/// Canonical Essence name for at-least global cardinality.
16
pub const AT_LEAST: &str = "atLeast";
17

            
18
/// Canonical Essence name for at-most global cardinality.
19
pub const AT_MOST: &str = "atMost";
20

            
21
/// Canonical Essence name for element-id lookup.
22
pub const ELEMENT_ID: &str = "elementId";
23

            
24
55849
pub fn is_all_different_operator(operator: &str) -> bool {
25
55849
    matches!(operator, "allDifferent" | "allDiff")
26
55849
}
27

            
28
64632
pub fn is_all_different_except_operator(operator: &str) -> bool {
29
64632
    matches!(
30
64632
        operator,
31
        "allDifferentExcept" | "alldifferent_except" | "alldiff_except" | "allDiffExcept"
32
    )
33
64632
}
34

            
35
79680
pub fn is_at_least_operator(operator: &str) -> bool {
36
79680
    matches!(operator, "atLeast" | "atleast")
37
79680
}
38

            
39
33408
pub fn is_at_most_operator(operator: &str) -> bool {
40
33408
    matches!(operator, "atMost" | "atmost")
41
33408
}
42

            
43
192
pub fn is_global_cardinality_operator(operator: &str) -> bool {
44
192
    matches!(operator, "globalCardinality" | "gcc")
45
192
}