-
Notifications
You must be signed in to change notification settings - Fork 10
/
constraintsFunctions.cfg
executable file
·103 lines (101 loc) · 2.74 KB
/
constraintsFunctions.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Existence constraints
# Existence(M, a),
function Existence {
echo "[^$2]*([$2][^$2]*){$1,}[^$2]*"
}
# Absence(N, a),
function Absence {
local max=`expr $1 - 1`
echo "[^$2]*([$2][^$2]*){0,$max}[^$2]*"
}
# Participation(a),
function Participation {
echo "[^$1]*([$1][^$1]*){1,}[^$1]*"
}
# Uniqueness(a),
function AtMostOne {
echo "[^$1]*([$1][^$1]*){0,1}[^$1]*"
}
# Init(a),
function Init {
echo "[$1].*"
}
# End(a),
function End {
echo ".*[$1]"
}
# Relation constraints
# RespondedExistence(a, b),
function RespondedExistence {
# Update 2013/07/31
# RespondedExistence: [^a]*((a.*b.*)|(b.*a.*))*[^a]* instead of [^a]*((a.*b)|(b.*a))*[^a]*
echo "[^$1]*(([$1].*[$2].*)|([$2].*[$1].*))*[^$1]*"
}
# Response(a, b),
function Response {
echo "[^$1]*([$1].*[$2])*[^$1]*"
}
# AlternateResponse(a, b),
function AlternateResponse {
# Update 2013/07/31
# AlternateResponse: [^a]*(a[^a]*b[^a]*)*[^a]* instead of [^a]*(a[^a]*b)*[^a]*
echo "[^$1]*([$1][^$1]*[$2][^$1]*)*[^$1]*"
}
# ChainResponse(a, b),
function ChainResponse {
# Update 2013/07/31
# ChainResponse: [^a]*(ab[^a]*)*[^a]* instead of [^a]*(ab[^ab]*)*[^a]*
echo "[^$1]*([$1][$2][^$1]*)*[^$1]*"
}
# Precedence(a, b),
function Precedence {
echo "[^$2]*([$1].*[$2])*[^$2]*"
}
# AlternatePrecedence(a, b),
function AlternatePrecedence {
# Update 2013/07/31
# AlternatePrecedence: [^b]*(a[^b]*b[^b]*)*[^b]* instead of [^b]*(a[^b]*b)*[^b]*
echo "[^$2]*([$1][^$2]*[$2][^$2]*)*[^$2]*"
}
# ChainPrecedence(a, b),
function ChainPrecedence {
# Update 2013/07/31
# ChainPrecedence: [^b]*(ab[^b]*)*[^b]* instead of [^b]*(ab[^a^b]*)*[^b]*
echo "[^$2]*([$1][$2][^$2]*)*[^$2]*"
}
# CoExistence(a, b),
function CoExistence {
# Update 2013/07/31
# CoExistence: [^a^b]*((a.*b.*)|(b.*a.*))*[^a^b]* instead of [^a^b]*((a.*b)|(b.*a))*[^a^b]*
echo "[^$1$2]*(([$1].*[$2].*)|([$2].*[$1].*))*[^$1$2]*"
}
# Succession(a, b),
function Succession {
echo "[^$1$2]*([$1].*[$2])*[^$1$2]*"
}
# AlternateSuccession(a, b),
function AlternateSuccession {
# Update 2013/07/31
# AlternateSuccession: [^a^b]*(a[^a^b]*b[^a^b]*)*[^a^b]* instead of [^a^b]*(a[^a^b]*b)*[^a^b]*
echo "[^$1$2]*([$1][^$1$2]*[$2][^$1$2]*)*[^$1$2]*"
}
# ChainSuccession(a, b),
function ChainSuccession {
echo "[^$1$2]*([$1][$2][^$1$2]*)*[^$1$2]*"
}
# Negative relation constraints
# NotChainSuccession(a, b),
function NotChainSuccession {
# Update 2013/07/31
# NotChainSuccession: [^a]*(aa*[^a^b][^a]*)*([^a]*|a) instead of [^a]*(a[^a^b][^a]*)*([^a]*|a)
echo "[^$1]*([$1][$1]*[^$1$2][^$1]*)*([^$1]*|[$1])"
}
# NotSuccession(a, b),
function NotSuccession {
echo "[^$1]*([$1][^$2]*)*[^$1$2]*"
}
# NotCoExistence(a, b),
function NotCoExistence {
echo "[^$1$2]*(([$1][^$2]*)|([$2][^$1]*))?"
}