Skip to content

Commit

Permalink
Merge pull request #44 from logic-ng/release/v2.4
Browse files Browse the repository at this point in the history
Release/v2.4
  • Loading branch information
czengler authored Dec 1, 2022
2 parents 3e2dfe7 + 2b6d23c commit 38e007c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

LogicNG uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.1] - 2022-12-01

### Changed

- Allowing symbol `#` in variable names for the `PropositionalParser` and the `PseudoBooleanParser`.
- Set the Java Jigsaw automatic module name to `logicng` in the manifest.

## [2.4.0] - 2022-11-24

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ An extensive white paper with a lot of interesting use cases of LogicNG for conf

## Philosophy

The most important philosophy of the library is to avoid unnecessary object creation. Therefore formulas can only be generated via formula factories. A formula
The most important philosophy of the library is to avoid unnecessary object creation. Therefore, formulas can only be generated via formula factories. A formula
factory assures that a formula is only created once in memory. If another instance of the same formula is created by the user, the already existing one is
returned by the factory. This leads to a small memory footprint and fast execution of algorithms. Formulas can cache the results of algorithms executed on them
and since every formula is hold only once in memory it is assured that the same algorithm on the same formula is also executed only once.
Expand All @@ -34,7 +34,7 @@ LogicNG is released in the Maven Central Repository. To include it just add
<dependency>
<groupId>org.logicng</groupId>
<artifactId>logicng</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
</dependency>
```

Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.logicng</groupId>
<artifactId>logicng</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<packaging>bundle</packaging>

<name>LogicNG</name>
Expand Down Expand Up @@ -124,7 +124,7 @@
</executions>
</plugin>

<!-- Store POM version in application manifest -->
<!-- Store POM version in application manifest and set Jigsaw module name-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -138,6 +138,7 @@
</manifest>
<manifestEntries>
<Built-By>BooleWorks GmbH</Built-By>
<Automatic-Module-Name>logicng</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion src/main/antlr/LogicNGPropositional.g4
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ equiv returns [Formula f]
@init{Formula[] operands = new Formula[2];}
: a = impl {operands[0] =$a.f;} (EQUIV b = equiv {operands[1] = $b.f;})? {$f = operands[1] == null ? operands[0] : f.equivalence(operands[0], operands[1]);};

VARIABLE : [A-Za-z0-9_@][A-Za-z0-9_]*;
VARIABLE : [A-Za-z0-9_@#][A-Za-z0-9_#]*;
TRUE : '$true';
FALSE : '$false';
LBR : '(';
Expand Down
2 changes: 1 addition & 1 deletion src/main/antlr/LogicNGPseudoBoolean.g4
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ add returns [List<Literal> literals, List<Integer> coeffs]


NUMBER : [\-]?[0-9]+;
LITERAL : [~]?[A-Za-z0-9_@][A-Za-z0-9_]*;
LITERAL : [~]?[A-Za-z0-9_@#][A-Za-z0-9_#]*;
TRUE : '$true';
FALSE : '$false';
LBR : '(';
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/logicng/io/parsers/PropositionalParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
* </ul>
* Brackets are {@code (} and {@code )}. For variable names, there are the following rules:
* <ul>
* <li>must begin with a alphabetic character, {@code _} or {@code @}</li>
* <li>can only contain alphanumerical character, or {@code _}</li>
* <li>must begin with a alphabetic character, {@code _}, {@code @}, or {@code #}</li>
* <li>can only contain alphanumerical character, {@code _}, or {@code #}</li>
* <li>{@code @} is only allowed at the beginning of the variable name and is reserved for special internal variables</li>
* </ul>
* @version 1.2
* @version 2.4.1
* @since 1.0
*/
public final class PropositionalParser extends FormulaParser {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/logicng/io/parsers/PseudoBooleanParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
* </ul>
* Brackets are {@code (} and {@code )}. For variable names, there are the following rules:
* <ul>
* <li>must begin with a alphabetic character, {@code _} or {@code @}</li>
* <li>can only contain alphanumerical character, or {@code _}</li>
* <li>must begin with a alphabetic character, {@code _}, {@code @}, or {@code #}</li>
* <li>can only contain alphanumerical character, {@code _}, or {@code #}</li>
* <li>{@code @} is only allowed at the beginning of the variable name and is reserved for special internal variables</li>
* </ul>
* <p>
* A valid pseudo Boolean expression is of the form {@code c_1 * l_1 + ... + c_n * l_n R k} where the {@code c_i} are coefficients,
* {@code l_i} are literals, and {@code R} is one of {@code =, >, >=, <, <=}.
* @version 1.2
* @version 2.4.1
* @since 1.0
*/
public final class PseudoBooleanParser extends FormulaParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

/**
* Unit Tests for the class {@link PropositionalParser}.
* @version 2.0.0
* @version 2.4.1
* @since 1.0
*/
public class PropositionalParserTest extends TestWithExampleFormulas {
Expand Down Expand Up @@ -72,6 +72,13 @@ public void testParseLiterals() throws ParserException {
assertThat(parser.parse("~a1")).isEqualTo(this.f.literal("a1", false));
assertThat(parser.parse("~aA_Bb_Cc_12_3")).isEqualTo(this.f.literal("aA_Bb_Cc_12_3", false));
assertThat(parser.parse("~@aA_Bb_Cc_12_3")).isEqualTo(this.f.literal("@aA_Bb_Cc_12_3", false));
assertThat(parser.parse("#")).isEqualTo(this.f.literal("#", true));
assertThat(parser.parse("~#")).isEqualTo(this.f.literal("#", false));
assertThat(parser.parse("~A#B")).isEqualTo(this.f.literal("A#B", false));
assertThat(parser.parse("A#B")).isEqualTo(this.f.literal("A#B", true));
assertThat(parser.parse("~A#B")).isEqualTo(this.f.literal("A#B", false));
assertThat(parser.parse("#A#B_")).isEqualTo(this.f.literal("#A#B_", true));
assertThat(parser.parse("~#A#B_")).isEqualTo(this.f.literal("#A#B_", false));
}

@Test
Expand Down Expand Up @@ -250,7 +257,7 @@ public void testIllegalFormula8() {

@Test
public void testIllegalFormula9() {
final String string = "#";
final String string = "@A@B";
final InputStream stream = new ByteArrayInputStream(string.getBytes(StandardCharsets.UTF_8));
assertThatThrownBy(() -> new PropositionalParser(this.f).parse(stream)).isInstanceOf(ParserException.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

/**
* Unit Tests for the class {@link PseudoBooleanParser}.
* @version 2.0.0
* @version 4.4.1
* @since 1.0
*/
public class PseudoBooleanParserTest extends TestWithExampleFormulas {
Expand Down Expand Up @@ -69,6 +69,13 @@ public void testParseLiterals() throws ParserException {
assertThat(parser.parse("~A")).isEqualTo(this.f.literal("A", false));
assertThat(parser.parse("~a")).isEqualTo(this.f.literal("a", false));
assertThat(parser.parse("~aA_Bb_Cc_12_3")).isEqualTo(this.f.literal("aA_Bb_Cc_12_3", false));
assertThat(parser.parse("#")).isEqualTo(this.f.literal("#", true));
assertThat(parser.parse("~#")).isEqualTo(this.f.literal("#", false));
assertThat(parser.parse("~A#B")).isEqualTo(this.f.literal("A#B", false));
assertThat(parser.parse("A#B")).isEqualTo(this.f.literal("A#B", true));
assertThat(parser.parse("~A#B")).isEqualTo(this.f.literal("A#B", false));
assertThat(parser.parse("#A#B_")).isEqualTo(this.f.literal("#A#B_", true));
assertThat(parser.parse("~#A#B_")).isEqualTo(this.f.literal("#A#B_", false));
}

@Test
Expand Down

0 comments on commit 38e007c

Please sign in to comment.