Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preprocessing #337

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
67c4148
added SimplePreprocessing ProgramTransformation
mschmutzhart Oct 28, 2021
a100118
added preprocesssing steps in SimplePreprocessing, removal of a liter…
mschmutzhart Dec 14, 2021
aa83c73
refactored SimplePreprocessing loops
mschmutzhart Dec 14, 2021
2a2038c
added SimplePreprocessing ProgramTransformation
mschmutzhart Oct 28, 2021
b959d31
added preprocesssing steps in SimplePreprocessing, removal of a liter…
mschmutzhart Dec 14, 2021
acfd478
refactored SimplePreprocessing loops
mschmutzhart Dec 14, 2021
2950963
Merge remote-tracking branch 'origin/preprocessing' into preprocessing
mschmutzhart Dec 21, 2021
9772daa
Merge branch 'master' into preprocessing
mschmutzhart Dec 21, 2021
bce2837
merged with master branch and fixed merging problems
mschmutzhart Dec 21, 2021
ea34af8
refactored and fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 18, 2022
424cfca
refactored and fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 18, 2022
9958006
fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 25, 2022
fe38c94
fixed bug with constraints in SimplePreprocessing
mschmutzhart Jan 29, 2022
65b74c0
fixed bug with constraints in SimplePreprocessing
mschmutzhart Jan 29, 2022
e3b3d15
limited SimplePreprocessing to basic literals
mschmutzhart Feb 1, 2022
7d98e20
added command line option for preprocessing
mschmutzhart Feb 1, 2022
26f07bd
added tests for command line option for preprocessing
mschmutzhart Feb 8, 2022
2e35223
rebuilt tests to not depend on NormalizeProgramTransformation
mschmutzhart Feb 14, 2022
1fad17f
implemented removal of rules, that have heads that are already facts
mschmutzhart Feb 14, 2022
cd65902
removed unnecessary changes
mschmutzhart Feb 15, 2022
6326ca2
removed unnecessary changes
mschmutzhart Feb 15, 2022
08aa376
added comments
mschmutzhart Mar 22, 2022
0a73d07
added comments
mschmutzhart Mar 22, 2022
6a2975e
doc: Add ConfWS21 paper to README (#339)
lorenzleutgeb Apr 11, 2022
22f2af3
introduce nonterminal numeral to account for negative numbers as part…
madmike200590 Jul 7, 2022
ca3dba1
Fix parsing of interval terms and move implementation to commons module
madmike200590 Jul 19, 2022
faf1e88
improve tesst coverage for IntervalTermImpl
madmike200590 Jul 20, 2022
d4bd8f9
improve test coverage for term implementations
madmike200590 Jul 25, 2022
891d1fb
Update alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/terms/Interv…
madmike200590 Jul 26, 2022
68cc827
improve javadoc
madmike200590 Jul 26, 2022
0b488fc
check for interval bounds not being constants
madmike200590 Jul 26, 2022
e0d4705
Merge pull request #341 from alpha-asp/bugfix-issue-292
madmike200590 Jul 29, 2022
fea4765
add reference to asp-guide
madmike200590 Aug 30, 2022
482ca92
add asp-guide to suggested reading
madmike200590 Aug 30, 2022
4a93e01
Merge pull request #344 from alpha-asp/link-asp-guide
AntoniusW Aug 30, 2022
33cbbaa
Fix SimpleLogger time format
Sep 11, 2022
5f40ea0
Merge pull request #347 from alpha-asp/logger_time_format
madmike200590 Sep 11, 2022
fee81a8
Improve logging output for debugging.
AntoniusW Dec 2, 2022
008a287
Merge pull request #348 from alpha-asp/improve_logging_for_debug
madmike200590 Dec 2, 2022
451fdf3
refactored SimplePreprocessing
mschmutzhart Aug 1, 2023
e9dd860
added SimplePreprocessing ProgramTransformation
mschmutzhart Oct 28, 2021
9cfa9cb
added preprocesssing steps in SimplePreprocessing, removal of a liter…
mschmutzhart Dec 14, 2021
e00e247
refactored SimplePreprocessing loops
mschmutzhart Dec 14, 2021
3bcd281
added SimplePreprocessing ProgramTransformation
mschmutzhart Oct 28, 2021
43f2661
added preprocesssing steps in SimplePreprocessing, removal of a liter…
mschmutzhart Dec 14, 2021
1a60f8c
refactored SimplePreprocessing loops
mschmutzhart Dec 14, 2021
1f8c43b
merged with master branch and fixed merging problems
mschmutzhart Dec 21, 2021
b8ee9db
refactored and fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 18, 2022
d6e4f49
refactored and fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 18, 2022
aff3346
fixed bugs in SimplePreprocessing, added tests
mschmutzhart Jan 25, 2022
c61ee71
fixed bug with constraints in SimplePreprocessing
mschmutzhart Jan 29, 2022
97f23fc
fixed bug with constraints in SimplePreprocessing
mschmutzhart Jan 29, 2022
2e8f6c9
limited SimplePreprocessing to basic literals
mschmutzhart Feb 1, 2022
0900fc0
added command line option for preprocessing
mschmutzhart Feb 1, 2022
7310b0b
added tests for command line option for preprocessing
mschmutzhart Feb 8, 2022
e43d717
rebuilt tests to not depend on NormalizeProgramTransformation
mschmutzhart Feb 14, 2022
7e8ce92
implemented removal of rules, that have heads that are already facts
mschmutzhart Feb 14, 2022
593748b
removed unnecessary changes
mschmutzhart Feb 15, 2022
c0abf4c
removed unnecessary changes
mschmutzhart Feb 15, 2022
d5e959f
added comments
mschmutzhart Mar 22, 2022
1e9160a
added comments
mschmutzhart Mar 22, 2022
f0c239f
refactored SimplePreprocessing
mschmutzhart Aug 1, 2023
9aa03ea
Merge branch 'preprocessing' of https://github.com/alpha-asp/Alpha in…
mschmutzhart Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ gradle-app.setting
/.dbeaver
/Scripts
/.vscode/
workspace.code-workspace
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ $ java -jar alpha.jar -i benchmarks/omiga/omiga-testcases/3col/3col-10-18.txt -f

Note that in this example the path to the input file is relative to the root of this repository. If you have not checked out the repository, you can just [download the example file from GitHub](/benchmarks/omiga/omiga-testcases/3col/3col-10-18.txt).

[A coder's guide to answer set programming](https://madmike200590.github.io/asp-guide/) provides a short and high-level tutorial on Answer Set Programming.

## Building

Alpha uses the [Gradle build automation system](https://gradle.org). Executing
Expand Down Expand Up @@ -73,6 +75,10 @@ run into trouble feel free to file an issue.

## Suggested Reading

### Beginners' Tutorials
* [A coder's guide to answer set programming](https://madmike200590.github.io/asp-guide/)

### Theoretical Background and Language Specification
* [Answer Set Programming: A Primer](http://www.kr.tuwien.ac.at/staff/tkren/pub/2009/rw2009-asp.pdf)
* [ASP-Core-2 Input Language Format](https://www.mat.unical.it/aspcomp2013/files/ASP-CORE-2.01c.pdf)
* [Conflict-Driven Answer Set Solving: From Theory to Practice](http://www.cs.uni-potsdam.de/wv/pdfformat/gekasc12c.pdf)
Expand All @@ -82,6 +88,10 @@ run into trouble feel free to file an issue.

Peer-reviewed publications part of journals, conferences and workshops:

#### 2021

* [Solving Configuration Problems with ASP and Declarative Domain-Specific Heuristics](http://ceur-ws.org/Vol-2945/21-RT-ConfWS21_paper_4.pdf)

#### 2020

* [Conflict Generalisation in ASP: Learning Correct and Effective Non-Ground Constraints](https://doi.org/10.1017/S1471068420000368)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class SystemConfig {
public static final boolean DEFAULT_SORT_ANSWER_SETS = false;
public static final List<Integer> DEFAULT_REPLAY_CHOICES = Collections.emptyList();
public static final boolean DEFAULT_STRATIFIED_EVALUATION = true;
public static final boolean DEFAULT_PREPROCESSING_ENABLED = true;
public static final boolean DEFAULT_DISABLE_NOGOOD_DELETION = false;
public static final String DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS = GrounderHeuristicsConfiguration.STRICT_STRING;
public static final String DEFAULT_GROUNDER_TOLERANCE_RULES = GrounderHeuristicsConfiguration.STRICT_STRING;
Expand All @@ -79,6 +80,7 @@ public class SystemConfig {
private boolean sortAnswerSets = DEFAULT_SORT_ANSWER_SETS;
private List<Integer> replayChoices = DEFAULT_REPLAY_CHOICES;
private boolean evaluateStratifiedPart = DEFAULT_STRATIFIED_EVALUATION;
private boolean enablePreprocessing = DEFAULT_PREPROCESSING_ENABLED;
private boolean disableNoGoodDeletion = DEFAULT_DISABLE_NOGOOD_DELETION;
private String grounderToleranceConstraints = DEFAULT_GROUNDER_TOLERANCE_CONSTRAINTS;
private String grounderToleranceRules = DEFAULT_GROUNDER_TOLERANCE_RULES;
Expand Down Expand Up @@ -232,6 +234,14 @@ public void setEvaluateStratifiedPart(boolean evaluateStratifiedPart) {
this.evaluateStratifiedPart = evaluateStratifiedPart;
}

public boolean isPreprocessingEnabled() {
return this.enablePreprocessing;
}

public void setPreprocessingEnabled(boolean enablePreprocessing) {
this.enablePreprocessing = enablePreprocessing;
}

public boolean isDisableNoGoodDeletion() {
return this.disableNoGoodDeletion;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package at.ac.tuwien.kr.alpha.api.terms;

/**
* A term representing an interval of integers.
* Intervals are syntactic sugar, e.g. the rule "p(X) :- X = 1..2." is a shorthand for
* "p(X) :- X = 1. p(X) :- X = 2.".
*/
public interface IntervalTerm extends Term {

Term getLowerBound();

Term getUpperBound();

}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ public class CommandLineParser {
.desc("a character (sequence) to use as separator for atoms in printed answer sets (default: "
+ SystemConfig.DEFAULT_ATOM_SEPARATOR + ")")
.build();
private static final Option OPT_DISABLE_PROGRAM_PREPROCESSING = Option.builder("dpp").longOpt("disableProgramPreprocessing")
.desc("disable preprocessing of input program")
.build();
//@formatter:on

private static final Options CLI_OPTS = new Options();
Expand Down Expand Up @@ -189,6 +192,7 @@ public class CommandLineParser {
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_GROUNDER_TOLERANCE_RULES);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_GROUNDER_ACCUMULATOR_ENABLED);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_OUTPUT_ATOM_SEPARATOR);
CommandLineParser.CLI_OPTS.addOption(CommandLineParser.OPT_DISABLE_PROGRAM_PREPROCESSING);
}

/*
Expand Down Expand Up @@ -240,12 +244,13 @@ private void initializeGlobalOptionHandlers() {
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_JUSTIFICATION.getOpt(), this::handleNoJustification);
this.globalOptionHandlers.put(CommandLineParser.OPT_AGGREGATES_NO_SORTING_GRID.getOpt(), this::handleDisableSortingGrid);
this.globalOptionHandlers.put(CommandLineParser.OPT_AGGREGATES_NO_NEGATIVE_INTEGERS.getOpt(), this::handleDisableNegativeSumElements);
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_EVAL_STRATIFIED.getOpt(), this::handleDisableStratifedEval);
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_EVAL_STRATIFIED.getOpt(), this::handleDisableStratifiedEval);
this.globalOptionHandlers.put(CommandLineParser.OPT_NO_NOGOOD_DELETION.getOpt(), this::handleNoNoGoodDeletion);
this.globalOptionHandlers.put(CommandLineParser.OPT_GROUNDER_TOLERANCE_CONSTRAINTS.getOpt(), this::handleGrounderToleranceConstraints);
this.globalOptionHandlers.put(CommandLineParser.OPT_GROUNDER_TOLERANCE_RULES.getOpt(), this::handleGrounderToleranceRules);
this.globalOptionHandlers.put(CommandLineParser.OPT_GROUNDER_ACCUMULATOR_ENABLED.getOpt(), this::handleGrounderNoInstanceRemoval);
this.globalOptionHandlers.put(CommandLineParser.OPT_OUTPUT_ATOM_SEPARATOR.getOpt(), this::handleAtomSeparator);
this.globalOptionHandlers.put(CommandLineParser.OPT_DISABLE_PROGRAM_PREPROCESSING.getOpt(), this::handleDisablePreprocessing);
}

private void initializeInputOptionHandlers() {
Expand Down Expand Up @@ -441,7 +446,7 @@ private void handleDisableNegativeSumElements(Option opt, SystemConfig cfg) {
cfg.getAggregateRewritingConfig().setSupportNegativeValuesInSums(false);
}

private void handleDisableStratifedEval(Option opt, SystemConfig cfg) {
private void handleDisableStratifiedEval(Option opt, SystemConfig cfg) {
cfg.setEvaluateStratifiedPart(false);
}

Expand Down Expand Up @@ -470,5 +475,9 @@ private void handleGrounderNoInstanceRemoval(Option opt, SystemConfig cfg) {
private void handleAtomSeparator(Option opt, SystemConfig cfg) {
cfg.setAtomSeparator(StringEscapeUtils.unescapeJava(opt.getValue(SystemConfig.DEFAULT_ATOM_SEPARATOR)));
}

private void handleDisablePreprocessing(Option opt, SystemConfig cfg) {
cfg.setPreprocessingEnabled(false);
}

}
3 changes: 1 addition & 2 deletions alpha-cli-app/src/main/resources/simplelogger.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ org.slf4j.simpleLogger.log.at.ac.tuwien.kr.alpha.core.solver.heuristics.HeapOfAc
org.slf4j.simpleLogger.showDateTime=true

# Format for logged timestamps.
# For Alpha, we use milliseconds since startup
org.slf4j.simpleLogger.dateTimeFormat=S
# For Alpha, we use milliseconds since startup, which is the default time format

# Disable including thread name in logged line since Alpha is currently single-threaded.
org.slf4j.simpleLogger.showThreadName=false
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,11 @@ public void atomSeparator() throws ParseException {
assertEquals("some-string", cfg.getSystemConfig().getAtomSeparator());
}

@Test
public void disableProgramPreprocessing() throws ParseException {
CommandLineParser parser = new CommandLineParser(DEFAULT_COMMAND_LINE, DEFAULT_ABORT_ACTION);
AlphaConfig ctx = parser.parseCommandLine(new String[]{"-str", "aString.", "-dpp"});
assertFalse(ctx.getSystemConfig().isPreprocessingEnabled());
}

}
3 changes: 1 addition & 2 deletions alpha-cli-app/src/test/resources/simplelogger.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ org.slf4j.simpleLogger.log.at.ac.tuwien.kr.alpha.core.solver.heuristics.HeapOfAc
org.slf4j.simpleLogger.showDateTime=true

# Format for logged timestamps.
# For Alpha, we use milliseconds since startup
org.slf4j.simpleLogger.dateTimeFormat=S
# For Alpha, we use milliseconds since startup, which is the default time format

# Disable including thread name in logged line since Alpha is currently single-threaded.
org.slf4j.simpleLogger.showThreadName=false
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@
import java.util.Set;

import at.ac.tuwien.kr.alpha.api.grounder.Substitution;
import at.ac.tuwien.kr.alpha.api.terms.FunctionTerm;
import at.ac.tuwien.kr.alpha.api.terms.IntervalTerm;
import at.ac.tuwien.kr.alpha.api.terms.Term;
import at.ac.tuwien.kr.alpha.api.terms.VariableTerm;
import at.ac.tuwien.kr.alpha.commons.util.Interner;
import at.ac.tuwien.kr.alpha.commons.util.Util;

/**
* An IntervalTerm represents the shorthand notation for a set of rules where all elements in this interval occur once, e.g., fact(2..5).
* An IntervalTerm is a meta-term and the grounder must replace it with its corresponding set of facts or rules.
* Copyright (c) 2017, the Alpha Team.
*/
public class IntervalTerm extends AbstractTerm {
private static final Interner<IntervalTerm> INTERNER = new Interner<>();
class IntervalTermImpl extends AbstractTerm implements IntervalTerm {

private static final Interner<IntervalTermImpl> INTERNER = new Interner<>();
private final Term lowerBoundTerm;
private final Term upperBoundTerm;

private final int lowerBound;
private final int upperBound;

private final boolean ground;

private IntervalTerm(Term lowerBound, Term upperBound) {
private IntervalTermImpl(Term lowerBound, Term upperBound) {
if (lowerBound == null || upperBound == null) {
throw new IllegalArgumentException();
}
Expand All @@ -34,44 +31,22 @@

this.lowerBoundTerm = lowerBound;
this.upperBoundTerm = upperBound;

if (this.ground) {
this.upperBound = Integer.parseInt(upperBoundTerm.toString());
this.lowerBound = Integer.parseInt(lowerBoundTerm.toString());
} else {
this.upperBound = -1;
this.lowerBound = -1;
}
}

public static IntervalTerm getInstance(Term lowerBound, Term upperBound) {
return INTERNER.intern(new IntervalTerm(lowerBound, upperBound));
static IntervalTermImpl getInstance(Term lowerBound, Term upperBound) {
return INTERNER.intern(new IntervalTermImpl(lowerBound, upperBound));
}

@Override
public boolean isGround() {
return this.ground;
}

public int getLowerBound() {
if (!isGround()) {
throw Util.oops("Cannot get the lower bound of non-ground interval");
}
return this.lowerBound;
}

public int getUpperBound() {
if (!isGround()) {
throw Util.oops("Cannot get the upper bound of non-ground interval");
}
return this.upperBound;
}

public Term getLowerBoundTerm() {
public Term getLowerBound() {
return lowerBoundTerm;
}

public Term getUpperBoundTerm() {
public Term getUpperBound() {
return upperBoundTerm;
}

Expand All @@ -88,11 +63,11 @@
}

@Override
public IntervalTerm substitute(Substitution substitution) {
public IntervalTermImpl substitute(Substitution substitution) {
if (isGround()) {
return this;
}
return new IntervalTerm(lowerBoundTerm.substitute(substitution), upperBoundTerm.substitute(substitution));
return new IntervalTermImpl(lowerBoundTerm.substitute(substitution), upperBoundTerm.substitute(substitution));
}

@Override
Expand All @@ -109,7 +84,7 @@
return false;
}

IntervalTerm that = (IntervalTerm) o;
IntervalTermImpl that = (IntervalTermImpl) o;

if (!lowerBoundTerm.equals(that.lowerBoundTerm)) {
return false;
Expand All @@ -130,41 +105,14 @@

@Override
public Term renameVariables(String renamePrefix) {
return new IntervalTerm(lowerBoundTerm.renameVariables(renamePrefix), upperBoundTerm.renameVariables(renamePrefix));
return new IntervalTermImpl(lowerBoundTerm.renameVariables(renamePrefix), upperBoundTerm.renameVariables(renamePrefix));

Check warning on line 108 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/IntervalTermImpl.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/IntervalTermImpl.java#L108

Added line #L108 was not covered by tests
}

@Override
public Term normalizeVariables(String renamePrefix, Term.RenameCounter counter) {
return IntervalTerm.getInstance(
return IntervalTermImpl.getInstance(

Check warning on line 113 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/IntervalTermImpl.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/IntervalTermImpl.java#L113

Added line #L113 was not covered by tests
lowerBoundTerm.normalizeVariables(renamePrefix, counter),
upperBoundTerm.normalizeVariables(renamePrefix, counter));
}

/**
* Returns true if the term contains (or is) some IntervalTerm.
* @param term the term to test
* @return true iff an IntervalTerm occurs in term.
*/
public static boolean termContainsIntervalTerm(Term term) {
if (term instanceof IntervalTerm) {
return true;
} else if (term instanceof FunctionTermImpl) {
return functionTermContainsIntervals((FunctionTermImpl) term);
} else {
return false;
}
}

public static boolean functionTermContainsIntervals(FunctionTerm functionTerm) {
// Test whether a function term contains an interval term (recursively).
for (Term term : functionTerm.getTerms()) {
if (term instanceof IntervalTerm) {
return true;
}
if (term instanceof FunctionTermImpl && functionTermContainsIntervals((FunctionTerm) term)) {
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import at.ac.tuwien.kr.alpha.api.terms.ArithmeticTerm;
import at.ac.tuwien.kr.alpha.api.terms.ConstantTerm;
import at.ac.tuwien.kr.alpha.api.terms.FunctionTerm;
import at.ac.tuwien.kr.alpha.api.terms.IntervalTerm;
import at.ac.tuwien.kr.alpha.api.terms.Term;
import at.ac.tuwien.kr.alpha.api.terms.VariableTerm;
import at.ac.tuwien.kr.alpha.commons.substitutions.Unifier;
Expand Down Expand Up @@ -65,6 +66,10 @@
return MinusTerm.getInstance(negatedTerm);
}

public static IntervalTerm newIntervalTerm(Term lowerBound, Term upperBound) {
return IntervalTermImpl.getInstance(lowerBound, upperBound);
}

@SafeVarargs
public static <T extends Comparable<T>> List<ConstantTerm<T>> asTermList(T... values) {
List<ConstantTerm<T>> retVal = new ArrayList<>();
Expand Down Expand Up @@ -117,4 +122,36 @@
}
}

/**
* Returns true if the term contains (or is) some IntervalTerm.
* @param term the term to test
* @return true iff an IntervalTerm occurs in term.
*/
public static boolean termContainsIntervalTerm(Term term) {
if (term instanceof IntervalTermImpl) {
return true;

Check warning on line 132 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L132

Added line #L132 was not covered by tests
} else if (term instanceof FunctionTermImpl) {
return functionTermContainsIntervals((FunctionTermImpl) term);

Check warning on line 134 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L134

Added line #L134 was not covered by tests
} else {
return false;

Check warning on line 136 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L136

Added line #L136 was not covered by tests
}
}

/**
* Returns true if the given {@link FunctionTerm} contains some IntervalTerm.
* @param functionTerm the term to test
* @return true iff an IntervalTerm occurs in functionTerm.
*/
public static boolean functionTermContainsIntervals(FunctionTerm functionTerm) {
for (Term term : functionTerm.getTerms()) {
if (term instanceof IntervalTermImpl) {
return true;

Check warning on line 148 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L148

Added line #L148 was not covered by tests
}
if (term instanceof FunctionTermImpl && functionTermContainsIntervals((FunctionTerm) term)) {
return true;

Check warning on line 151 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L151

Added line #L151 was not covered by tests
}
}
return false;

Check warning on line 154 in alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java

View check run for this annotation

Codecov / codecov/patch

alpha-commons/src/main/java/at/ac/tuwien/kr/alpha/commons/terms/Terms.java#L153-L154

Added lines #L153 - L154 were not covered by tests
}

}
Loading
Loading