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
62830
pub fn is_all_different_operator(operator: &str) -> bool {
25
62830
    matches!(operator, "allDifferent" | "allDiff")
26
62830
}
27

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

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

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

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