diff options
author | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-08-15 02:03:26 +0200 |
---|---|---|
committer | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-08-15 02:03:26 +0200 |
commit | 09082a37c4e25c567a5f948423310b178ee20f28 (patch) | |
tree | 796302591968f64815ca9603b9c6adc72c35b0c7 /Framework | |
parent | Merge branch 'master' of https://github.com/viatra/VIATRA-Generator (diff) | |
download | VIATRA-Generator-09082a37c4e25c567a5f948423310b178ee20f28.tar.gz VIATRA-Generator-09082a37c4e25c567a5f948423310b178ee20f28.tar.zst VIATRA-Generator-09082a37c4e25c567a5f948423310b178ee20f28.zip |
Type scope cleanup
Diffstat (limited to 'Framework')
-rw-r--r-- | Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend | 167 |
1 files changed, 4 insertions, 163 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend index fa277dbf..22bbb2e2 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend | |||
@@ -5,11 +5,6 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult | |||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult |
6 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace | 6 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace |
7 | import java.util.List | 7 | import java.util.List |
8 | import java.util.SortedSet | ||
9 | import java.util.TreeSet | ||
10 | import com.google.thirdparty.publicsuffix.PublicSuffixPatterns | ||
11 | import javax.xml.ws.soap.AddressingFeature.Responses | ||
12 | import java.util.Collection | ||
13 | 8 | ||
14 | abstract class LogicReasoner { | 9 | abstract class LogicReasoner { |
15 | def abstract LogicResult solve(LogicProblem problem, LogicSolverConfiguration configuration, | 10 | def abstract LogicResult solve(LogicProblem problem, LogicSolverConfiguration configuration, |
@@ -32,101 +27,6 @@ public class LogicReasonerException extends Exception { | |||
32 | } | 27 | } |
33 | } | 28 | } |
34 | 29 | ||
35 | /** | ||
36 | * Creates an interval. If the lowerLimit is greater than the upperLimit, the values will be swapped. | ||
37 | */ | ||
38 | class IntegerInterval { | ||
39 | private var int lowerLimit; | ||
40 | private var int upperLimit; | ||
41 | |||
42 | new(int lowerLimit, int upperLimit) { | ||
43 | if (lowerLimit <= upperLimit) { | ||
44 | this.lowerLimit = lowerLimit; | ||
45 | this.upperLimit = upperLimit; | ||
46 | } else { | ||
47 | this.upperLimit = lowerLimit; | ||
48 | this.lowerLimit = upperLimit; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | def boolean equals(IntegerInterval interval) { | ||
53 | if (interval.lowerLimit == this.lowerLimit && interval.upperLimit == this.upperLimit) | ||
54 | return true | ||
55 | return false | ||
56 | } | ||
57 | |||
58 | def public int getLowerLimit() { | ||
59 | return lowerLimit; | ||
60 | } | ||
61 | |||
62 | def public int getUpperLimit() { | ||
63 | return upperLimit; | ||
64 | } | ||
65 | |||
66 | def public void setLimits(int lowerLimit, int upperLimit) { | ||
67 | if (lowerLimit <= upperLimit) { | ||
68 | this.lowerLimit = lowerLimit; | ||
69 | this.upperLimit = upperLimit; | ||
70 | } else { | ||
71 | this.upperLimit = lowerLimit; | ||
72 | this.lowerLimit = upperLimit; | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * Creates a range which represents the minimum and maximum length allowed for Strings. | ||
79 | * If the input for minimumLength is lower than 0, then the minimumLength will be set to 0. | ||
80 | * If the input for maximumLength is lower than 0, then the maximumLength will be set to 0. | ||
81 | * If minimumLength is greater than maximumLength, the values will be swapped | ||
82 | */ | ||
83 | class StringLengthInterval { | ||
84 | private var int minimumLength; | ||
85 | private var int maximumLength; | ||
86 | |||
87 | new(int minimumLength, int maximumLength) { | ||
88 | if (minimumLength < 0) { | ||
89 | this.minimumLength = 0 | ||
90 | } else if (maximumLength < 0) { | ||
91 | this.maximumLength = 0 | ||
92 | } else if (minimumLength >= maximumLength) { | ||
93 | this.maximumLength = minimumLength; | ||
94 | this.minimumLength = maximumLength; | ||
95 | } else { | ||
96 | this.maximumLength = maximumLength; | ||
97 | this.minimumLength = minimumLength; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | def boolean equals(StringLengthInterval interval) { | ||
102 | if (interval.minimumLength == this.minimumLength && interval.maximumLength == this.maximumLength) | ||
103 | return true | ||
104 | return false | ||
105 | } | ||
106 | |||
107 | def public int getMinimumLength() { | ||
108 | return minimumLength; | ||
109 | } | ||
110 | |||
111 | def public int getMaximumLength() { | ||
112 | return maximumLength; | ||
113 | } | ||
114 | |||
115 | def public void setLimits(int minimumLength, int maximumLength) { | ||
116 | if (minimumLength < 0) { | ||
117 | this.minimumLength = 0 | ||
118 | } else if (maximumLength < 0) { | ||
119 | this.maximumLength = 0 | ||
120 | } else if (minimumLength >= maximumLength) { | ||
121 | this.maximumLength = minimumLength; | ||
122 | this.minimumLength = maximumLength; | ||
123 | } else { | ||
124 | this.maximumLength = maximumLength; | ||
125 | this.minimumLength = minimumLength; | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | |||
130 | abstract class LogicSolverConfiguration { | 30 | abstract class LogicSolverConfiguration { |
131 | public static val Unlimited = -1; | 31 | public static val Unlimited = -1; |
132 | public static val String UndefinedPath = null | 32 | public static val String UndefinedPath = null |
@@ -148,78 +48,19 @@ abstract class LogicSolverConfiguration { | |||
148 | public class TypeScopes { | 48 | public class TypeScopes { |
149 | public static val Unlimited = -1; | 49 | public static val Unlimited = -1; |
150 | public var boolean ignoreIdDuringGeneration = true | 50 | public var boolean ignoreIdDuringGeneration = true |
151 | |||
152 | /** | ||
153 | * The domain of integers from which we can choose | ||
154 | */ | ||
155 | public var IntegerInterval intervalOfIntegers | ||
156 | /** | ||
157 | * The maximal and minimal length of strings | ||
158 | */ | ||
159 | public var StringLengthInterval intervalOfStrings | ||
160 | /** | ||
161 | * A set containing the integers that can be used to solve the problem. | ||
162 | */ | ||
163 | public TreeSet<Integer> allIntegers = new TreeSet<Integer> { | ||
164 | override boolean add(Integer element) { | ||
165 | if (element < intervalOfIntegers.lowerLimit || element > intervalOfIntegers.upperLimit) { | ||
166 | return false | ||
167 | } else { | ||
168 | return super.add(element) | ||
169 | } | ||
170 | } | ||
171 | |||
172 | override boolean addAll(Collection<? extends Integer> collectionToAdd) { | ||
173 | var boolean hasBeenModified = false | ||
174 | for (element : collectionToAdd) { | ||
175 | hasBeenModified = this.add(element); | ||
176 | } | ||
177 | return hasBeenModified | ||
178 | } | ||
179 | |||
180 | } | ||
181 | |||
182 | /** | 51 | /** |
183 | * A set containing the strings that can be used to solve the problem. | 52 | * Sets the number of Integers that has to be used to solve the problem. |
184 | */ | 53 | */ |
185 | public TreeSet<String> allStrings = new TreeSet<String> { | 54 | public var numberOfUseableIntegers = Unlimited |
186 | override boolean add(String string) { | ||
187 | if (string.length < intervalOfStrings.minimumLength || string.length > intervalOfStrings.maximumLength) { | ||
188 | return false | ||
189 | } else { | ||
190 | return super.add(string) | ||
191 | } | ||
192 | } | ||
193 | |||
194 | override boolean addAll(Collection<? extends String> collectionToAdd) { | ||
195 | var boolean hasBeenModified = false | ||
196 | for (element : collectionToAdd) { | ||
197 | if (!(element.length < intervalOfStrings.minimumLength || | ||
198 | element.length > intervalOfStrings.maximumLength)) { | ||
199 | hasBeenModified = super.add(element); | ||
200 | } | ||
201 | } | ||
202 | return hasBeenModified | ||
203 | } | ||
204 | } | ||
205 | |||
206 | /** | 55 | /** |
207 | * A set containing the doubles that can be used to solve the problem. | 56 | * Sets the number of Integers that has to be used to solve the problem. |
208 | */ | 57 | */ |
209 | public TreeSet<Double> allDoubles = new TreeSet<Double> | 58 | public var numberOfUseableReals = Unlimited |
210 | /** | 59 | /** |
211 | * Sets the number of Strings that has to be used to solve the problem. | 60 | * Sets the number of Strings that has to be used to solve the problem. |
212 | */ | 61 | */ |
213 | public var numberOfUseableStrings = Unlimited | 62 | public var numberOfUseableStrings = Unlimited |
214 | /** | 63 | /** |
215 | * Sets the number of Integers that has to be used to solve the problem. | ||
216 | */ | ||
217 | public var numberOfUseableIntegers = Unlimited | ||
218 | /** | ||
219 | * Defines a limit for integers in the logic problem. | ||
220 | */ | ||
221 | public var maxIntScope = Unlimited | ||
222 | /** | ||
223 | * Defines the minimal number of newly added elements. Default value is 0. | 64 | * Defines the minimal number of newly added elements. Default value is 0. |
224 | */ | 65 | */ |
225 | public var minNewElements = 0 | 66 | public var minNewElements = 0 |