From 09082a37c4e25c567a5f948423310b178ee20f28 Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Tue, 15 Aug 2017 02:03:26 +0200 Subject: Type scope cleanup --- .../logic/model/builder/LogicSolver.xtend | 167 +-------------------- 1 file changed, 4 insertions(+), 163 deletions(-) (limited to 'Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic') 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 import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace import java.util.List -import java.util.SortedSet -import java.util.TreeSet -import com.google.thirdparty.publicsuffix.PublicSuffixPatterns -import javax.xml.ws.soap.AddressingFeature.Responses -import java.util.Collection abstract class LogicReasoner { def abstract LogicResult solve(LogicProblem problem, LogicSolverConfiguration configuration, @@ -32,101 +27,6 @@ public class LogicReasonerException extends Exception { } } -/** - * Creates an interval. If the lowerLimit is greater than the upperLimit, the values will be swapped. - */ -class IntegerInterval { - private var int lowerLimit; - private var int upperLimit; - - new(int lowerLimit, int upperLimit) { - if (lowerLimit <= upperLimit) { - this.lowerLimit = lowerLimit; - this.upperLimit = upperLimit; - } else { - this.upperLimit = lowerLimit; - this.lowerLimit = upperLimit; - } - } - - def boolean equals(IntegerInterval interval) { - if (interval.lowerLimit == this.lowerLimit && interval.upperLimit == this.upperLimit) - return true - return false - } - - def public int getLowerLimit() { - return lowerLimit; - } - - def public int getUpperLimit() { - return upperLimit; - } - - def public void setLimits(int lowerLimit, int upperLimit) { - if (lowerLimit <= upperLimit) { - this.lowerLimit = lowerLimit; - this.upperLimit = upperLimit; - } else { - this.upperLimit = lowerLimit; - this.lowerLimit = upperLimit; - } - } -} - -/** - * Creates a range which represents the minimum and maximum length allowed for Strings. - * If the input for minimumLength is lower than 0, then the minimumLength will be set to 0. - * If the input for maximumLength is lower than 0, then the maximumLength will be set to 0. - * If minimumLength is greater than maximumLength, the values will be swapped - */ -class StringLengthInterval { - private var int minimumLength; - private var int maximumLength; - - new(int minimumLength, int maximumLength) { - if (minimumLength < 0) { - this.minimumLength = 0 - } else if (maximumLength < 0) { - this.maximumLength = 0 - } else if (minimumLength >= maximumLength) { - this.maximumLength = minimumLength; - this.minimumLength = maximumLength; - } else { - this.maximumLength = maximumLength; - this.minimumLength = minimumLength; - } - } - - def boolean equals(StringLengthInterval interval) { - if (interval.minimumLength == this.minimumLength && interval.maximumLength == this.maximumLength) - return true - return false - } - - def public int getMinimumLength() { - return minimumLength; - } - - def public int getMaximumLength() { - return maximumLength; - } - - def public void setLimits(int minimumLength, int maximumLength) { - if (minimumLength < 0) { - this.minimumLength = 0 - } else if (maximumLength < 0) { - this.maximumLength = 0 - } else if (minimumLength >= maximumLength) { - this.maximumLength = minimumLength; - this.minimumLength = maximumLength; - } else { - this.maximumLength = maximumLength; - this.minimumLength = minimumLength; - } - } -} - abstract class LogicSolverConfiguration { public static val Unlimited = -1; public static val String UndefinedPath = null @@ -148,77 +48,18 @@ abstract class LogicSolverConfiguration { public class TypeScopes { public static val Unlimited = -1; public var boolean ignoreIdDuringGeneration = true - - /** - * The domain of integers from which we can choose - */ - public var IntegerInterval intervalOfIntegers - /** - * The maximal and minimal length of strings - */ - public var StringLengthInterval intervalOfStrings - /** - * A set containing the integers that can be used to solve the problem. - */ - public TreeSet allIntegers = new TreeSet { - override boolean add(Integer element) { - if (element < intervalOfIntegers.lowerLimit || element > intervalOfIntegers.upperLimit) { - return false - } else { - return super.add(element) - } - } - - override boolean addAll(Collection collectionToAdd) { - var boolean hasBeenModified = false - for (element : collectionToAdd) { - hasBeenModified = this.add(element); - } - return hasBeenModified - } - - } - /** - * A set containing the strings that can be used to solve the problem. + * Sets the number of Integers that has to be used to solve the problem. */ - public TreeSet allStrings = new TreeSet { - override boolean add(String string) { - if (string.length < intervalOfStrings.minimumLength || string.length > intervalOfStrings.maximumLength) { - return false - } else { - return super.add(string) - } - } - - override boolean addAll(Collection collectionToAdd) { - var boolean hasBeenModified = false - for (element : collectionToAdd) { - if (!(element.length < intervalOfStrings.minimumLength || - element.length > intervalOfStrings.maximumLength)) { - hasBeenModified = super.add(element); - } - } - return hasBeenModified - } - } - + public var numberOfUseableIntegers = Unlimited /** - * A set containing the doubles that can be used to solve the problem. + * Sets the number of Integers that has to be used to solve the problem. */ - public TreeSet allDoubles = new TreeSet + public var numberOfUseableReals = Unlimited /** * Sets the number of Strings that has to be used to solve the problem. */ public var numberOfUseableStrings = Unlimited - /** - * Sets the number of Integers that has to be used to solve the problem. - */ - public var numberOfUseableIntegers = Unlimited - /** - * Defines a limit for integers in the logic problem. - */ - public var maxIntScope = Unlimited /** * Defines the minimal number of newly added elements. Default value is 0. */ -- cgit v1.2.3-54-g00ecf