diff options
author | 2021-11-05 19:33:25 +0100 | |
---|---|---|
committer | 2021-11-05 20:00:06 +0100 | |
commit | a951628de0ce9902222ed290a1345c145f8af01a (patch) | |
tree | ad8414c17edebe50912bf87a26ed5509feb91683 /language/src | |
parent | Merge pull request #10 from kris7t/cm6-fixes (diff) | |
download | refinery-a951628de0ce9902222ed290a1345c145f8af01a.tar.gz refinery-a951628de0ce9902222ed290a1345c145f8af01a.tar.zst refinery-a951628de0ce9902222ed290a1345c145f8af01a.zip |
chore: rename unique to individual
Suggestion by @vincemolnar to match SysML V2 terminology more closely.
Diffstat (limited to 'language/src')
6 files changed, 27 insertions, 27 deletions
diff --git a/language/src/main/java/tools/refinery/language/Problem.xtext b/language/src/main/java/tools/refinery/language/Problem.xtext index 0fa47d63..b7562759 100644 --- a/language/src/main/java/tools/refinery/language/Problem.xtext +++ b/language/src/main/java/tools/refinery/language/Problem.xtext | |||
@@ -9,7 +9,7 @@ Problem: | |||
9 | 9 | ||
10 | Statement: | 10 | Statement: |
11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | RuleDefinition | Assertion | NodeValueAssertion | ScopeDeclaration | | 11 | ClassDeclaration | EnumDeclaration | PredicateDefinition | RuleDefinition | Assertion | NodeValueAssertion | ScopeDeclaration | |
12 | UniqueDeclaration; | 12 | IndividualDeclaration; |
13 | 13 | ||
14 | ClassDeclaration: | 14 | ClassDeclaration: |
15 | abstract?="abstract"? "class" | 15 | abstract?="abstract"? "class" |
@@ -173,8 +173,8 @@ RangeMultiplicity: | |||
173 | ExactMultiplicity: | 173 | ExactMultiplicity: |
174 | exactValue=INT; | 174 | exactValue=INT; |
175 | 175 | ||
176 | UniqueDeclaration: | 176 | IndividualDeclaration: |
177 | "unique" nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; | 177 | "individual" nodes+=EnumLiteral ("," nodes+=EnumLiteral)* "."; |
178 | 178 | ||
179 | UpperBound returns ecore::EInt: | 179 | UpperBound returns ecore::EInt: |
180 | INT | "*"; | 180 | INT | "*"; |
@@ -184,7 +184,7 @@ QualifiedName hidden(): | |||
184 | 184 | ||
185 | Identifier: | 185 | Identifier: |
186 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | "pred" | | 186 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | "pred" | |
187 | "unique" | "problem" | "new" | "delete"; | 187 | "individual" | "problem" | "new" | "delete" | "direct" | "rule"; |
188 | 188 | ||
189 | Integer returns ecore::EInt hidden(): | 189 | Integer returns ecore::EInt hidden(): |
190 | "-"? INT; | 190 | "-"? INT; |
diff --git a/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java b/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java index b51de05d..7aa75833 100644 --- a/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java +++ b/language/src/main/java/tools/refinery/language/resource/ProblemLocationInFileProvider.java | |||
@@ -21,7 +21,7 @@ public class ProblemLocationInFileProvider extends DefaultLocationInFileProvider | |||
21 | } | 21 | } |
22 | 22 | ||
23 | protected ITextRegion getNodeTextRegion(Node node, RegionDescription query) { | 23 | protected ITextRegion getNodeTextRegion(Node node, RegionDescription query) { |
24 | if (ProblemUtil.isUniqueNode(node)) { | 24 | if (ProblemUtil.isIndividualNode(node)) { |
25 | return super.doGetTextRegion(node, query); | 25 | return super.doGetTextRegion(node, query); |
26 | } | 26 | } |
27 | if (ProblemUtil.isNewNode(node)) { | 27 | if (ProblemUtil.isNewNode(node)) { |
diff --git a/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java b/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java index e745b6a5..f86ebd38 100644 --- a/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java +++ b/language/src/main/java/tools/refinery/language/resource/ProblemResourceDescriptionStrategy.java | |||
@@ -83,7 +83,7 @@ public class ProblemResourceDescriptionStrategy extends DefaultResourceDescripti | |||
83 | } | 83 | } |
84 | if (eObject instanceof Node node) { | 84 | if (eObject instanceof Node node) { |
85 | // Only enum literals and new nodes are visible across problem files. | 85 | // Only enum literals and new nodes are visible across problem files. |
86 | return ProblemUtil.isUniqueNode(node) || ProblemUtil.isNewNode(node); | 86 | return ProblemUtil.isIndividualNode(node) || ProblemUtil.isNewNode(node); |
87 | } | 87 | } |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
diff --git a/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java b/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java index dfd386f5..3c10d39e 100644 --- a/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java +++ b/language/src/main/java/tools/refinery/language/validation/ProblemValidator.java | |||
@@ -27,7 +27,7 @@ public class ProblemValidator extends AbstractProblemValidator { | |||
27 | 27 | ||
28 | public static final String SINGLETON_VARIABLE_ISSUE = ISSUE_PREFIX + "SINGLETON_VARIABLE"; | 28 | public static final String SINGLETON_VARIABLE_ISSUE = ISSUE_PREFIX + "SINGLETON_VARIABLE"; |
29 | 29 | ||
30 | public static final String NON_UNIQUE_NODE_ISSUE = ISSUE_PREFIX + "NON_UNIQUE_NODE"; | 30 | public static final String NON_INDIVIDUAL_NODE_ISSUE = ISSUE_PREFIX + "NON_INDIVIDUAL_NODE"; |
31 | 31 | ||
32 | @Inject | 32 | @Inject |
33 | private ReferenceCounter referenceCounter; | 33 | private ReferenceCounter referenceCounter; |
@@ -51,12 +51,12 @@ public class ProblemValidator extends AbstractProblemValidator { | |||
51 | @Check | 51 | @Check |
52 | public void checkNonUniqueNode(VariableOrNodeArgument argument) { | 52 | public void checkNonUniqueNode(VariableOrNodeArgument argument) { |
53 | var variableOrNode = argument.getVariableOrNode(); | 53 | var variableOrNode = argument.getVariableOrNode(); |
54 | if (variableOrNode instanceof Node node && !ProblemUtil.isUniqueNode(node)) { | 54 | if (variableOrNode instanceof Node node && !ProblemUtil.isIndividualNode(node)) { |
55 | var name = node.getName(); | 55 | var name = node.getName(); |
56 | var message = "Only unique nodes can be referenced in predicates. Mark '%s' as unique with the declaration 'unique %s.'" | 56 | var message = "Only individual nodes can be referenced in predicates. Mark '%s' as individual with the declaration 'individual %s.'" |
57 | .formatted(name, name); | 57 | .formatted(name, name); |
58 | error(message, argument, ProblemPackage.Literals.VARIABLE_OR_NODE_ARGUMENT__VARIABLE_OR_NODE, | 58 | error(message, argument, ProblemPackage.Literals.VARIABLE_OR_NODE_ARGUMENT__VARIABLE_OR_NODE, |
59 | INSIGNIFICANT_INDEX, NON_UNIQUE_NODE_ISSUE); | 59 | INSIGNIFICANT_INDEX, NON_INDIVIDUAL_NODE_ISSUE); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } |
diff --git a/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.xtend b/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.xtend index 99cf0a86..9e357529 100644 --- a/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.xtend +++ b/language/src/test/java/tools/refinery/language/tests/ProblemParsingTest.xtend | |||
@@ -46,7 +46,7 @@ class ProblemParsingTest { | |||
46 | error invalidTaxStatus(Person p) <-> | 46 | error invalidTaxStatus(Person p) <-> |
47 | taxStatus(p, child), children(p, _q). | 47 | taxStatus(p, child), children(p, _q). |
48 | 48 | ||
49 | unique family. | 49 | individual family. |
50 | Family(family). | 50 | Family(family). |
51 | members(family, anne): true. | 51 | members(family, anne): true. |
52 | members(family, bob). | 52 | members(family, bob). |
diff --git a/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.xtend b/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.xtend index 5ff7a2c9..5f669847 100644 --- a/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.xtend +++ b/language/src/test/java/tools/refinery/language/tests/scoping/NodeScopingTest.xtend | |||
@@ -77,50 +77,50 @@ class NodeScopingTest { | |||
77 | } | 77 | } |
78 | 78 | ||
79 | @ParameterizedTest | 79 | @ParameterizedTest |
80 | @MethodSource("uniqueNodeReferenceSource") | 80 | @MethodSource("individualNodeReferenceSource") |
81 | def void uniqueNodeInAssertionTest(String qualifiedNamePrefix, boolean namedProblem) { | 81 | def void individualNodeInAssertionTest(String qualifiedNamePrefix, boolean namedProblem) { |
82 | val it = parseHelper.parse(''' | 82 | val it = parseHelper.parse(''' |
83 | «IF namedProblem»problem test.«ENDIF» | 83 | «IF namedProblem»problem test.«ENDIF» |
84 | unique a, b. | 84 | individual a, b. |
85 | pred predicate(node x, node y) <-> node(x). | 85 | pred predicate(node x, node y) <-> node(x). |
86 | predicate(«qualifiedNamePrefix»a, «qualifiedNamePrefix»a). | 86 | predicate(«qualifiedNamePrefix»a, «qualifiedNamePrefix»a). |
87 | ?predicate(«qualifiedNamePrefix»a, «qualifiedNamePrefix»b). | 87 | ?predicate(«qualifiedNamePrefix»a, «qualifiedNamePrefix»b). |
88 | ''') | 88 | ''') |
89 | assertThat(errors, empty) | 89 | assertThat(errors, empty) |
90 | assertThat(nodeNames, empty) | 90 | assertThat(nodeNames, empty) |
91 | assertThat(assertion(0).arg(0).node, equalTo(uniqueNode('a'))) | 91 | assertThat(assertion(0).arg(0).node, equalTo(individualNode('a'))) |
92 | assertThat(assertion(0).arg(1).node, equalTo(uniqueNode('a'))) | 92 | assertThat(assertion(0).arg(1).node, equalTo(individualNode('a'))) |
93 | assertThat(assertion(1).arg(0).node, equalTo(uniqueNode('a'))) | 93 | assertThat(assertion(1).arg(0).node, equalTo(individualNode('a'))) |
94 | assertThat(assertion(1).arg(1).node, equalTo(uniqueNode('b'))) | 94 | assertThat(assertion(1).arg(1).node, equalTo(individualNode('b'))) |
95 | } | 95 | } |
96 | 96 | ||
97 | @ParameterizedTest | 97 | @ParameterizedTest |
98 | @MethodSource("uniqueNodeReferenceSource") | 98 | @MethodSource("individualNodeReferenceSource") |
99 | def void uniqueNodeInNodeValueAssertionTest(String qualifiedNamePrefix, boolean namedProblem) { | 99 | def void individualNodeInNodeValueAssertionTest(String qualifiedNamePrefix, boolean namedProblem) { |
100 | val it = parseHelper.parse(''' | 100 | val it = parseHelper.parse(''' |
101 | «IF namedProblem»problem test.«ENDIF» | 101 | «IF namedProblem»problem test.«ENDIF» |
102 | unique a. | 102 | individual a. |
103 | «qualifiedNamePrefix»a: 16. | 103 | «qualifiedNamePrefix»a: 16. |
104 | ''') | 104 | ''') |
105 | assertThat(errors, empty) | 105 | assertThat(errors, empty) |
106 | assertThat(nodeNames, empty) | 106 | assertThat(nodeNames, empty) |
107 | assertThat(nodeValueAssertion(0).node, equalTo(uniqueNode('a'))) | 107 | assertThat(nodeValueAssertion(0).node, equalTo(individualNode('a'))) |
108 | } | 108 | } |
109 | 109 | ||
110 | @ParameterizedTest | 110 | @ParameterizedTest |
111 | @MethodSource("uniqueNodeReferenceSource") | 111 | @MethodSource("individualNodeReferenceSource") |
112 | def void uniqueNodeInPredicateTest(String qualifiedNamePrefix, boolean namedProblem) { | 112 | def void individualNodeInPredicateTest(String qualifiedNamePrefix, boolean namedProblem) { |
113 | val it = parseHelper.parse(''' | 113 | val it = parseHelper.parse(''' |
114 | «IF namedProblem»problem test.«ENDIF» | 114 | «IF namedProblem»problem test.«ENDIF» |
115 | unique b. | 115 | individual b. |
116 | pred predicate(node a) <-> node(«qualifiedNamePrefix»b). | 116 | pred predicate(node a) <-> node(«qualifiedNamePrefix»b). |
117 | ''') | 117 | ''') |
118 | assertThat(errors, empty) | 118 | assertThat(errors, empty) |
119 | assertThat(nodeNames, empty) | 119 | assertThat(nodeNames, empty) |
120 | assertThat(pred("predicate").conj(0).lit(0).arg(0).node, equalTo(uniqueNode("b"))) | 120 | assertThat(pred("predicate").conj(0).lit(0).arg(0).node, equalTo(individualNode("b"))) |
121 | } | 121 | } |
122 | 122 | ||
123 | static def uniqueNodeReferenceSource() { | 123 | static def individualNodeReferenceSource() { |
124 | Stream.of( | 124 | Stream.of( |
125 | Arguments.of("", false), | 125 | Arguments.of("", false), |
126 | Arguments.of("", true), | 126 | Arguments.of("", true), |