Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo-MG authored Jun 23, 2023
2 parents 76787f8 + f9a12dc commit 7a57c35
Show file tree
Hide file tree
Showing 127 changed files with 1,725 additions and 3,194 deletions.
53 changes: 31 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
Expand All @@ -11,7 +12,7 @@
<parent>
<groupId>com.bernardomg.maven</groupId>
<artifactId>base-pom</artifactId>
<version>1.5.3</version>
<version>1.5.4</version>
</parent>

<!-- ********************************************** -->
Expand All @@ -20,7 +21,7 @@

<groupId>com.bernardomg.tabletop</groupId>
<artifactId>dice</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<packaging>jar</packaging>

<name>Dice Notation Tools for Java</name>
Expand Down Expand Up @@ -181,18 +182,18 @@
<!-- ============================================== -->
<!-- =========== DEPENDENCIES VERSIONS ============ -->
<!-- ============================================== -->
<antlr.version>4.11.1</antlr.version>
<junit.jupiter.version>5.9.2</junit.jupiter.version>
<lombok.version>1.18.26</lombok.version>
<mockito.version>5.1.1</mockito.version>
<log4j.version>2.19.0</log4j.version>
<slf4j.version>2.0.6</slf4j.version>
<antlr.version>4.13.0</antlr.version>
<assertj.version>3.24.2</assertj.version>
<junit.jupiter.version>5.9.3</junit.jupiter.version>
<lombok.version>1.18.28</lombok.version>
<mockito.version>5.4.0</mockito.version>
<log4j.version>2.20.0</log4j.version>
<slf4j.version>2.0.7</slf4j.version>
<!-- ============================================== -->
<!-- ============== PLUGINS VERSIONS ============== -->
<!-- ============================================== -->
<plugin.antlr.version>${antlr.version}</plugin.antlr.version>
<plugin.antlr.test.version>1.22</plugin.antlr.test.version>
<plugin.buildhelp.version>3.3.0</plugin.buildhelp.version>
<!-- ============================================== -->
<!-- ============ PLUGIN CONFIGURATION ============ -->
<!-- ============================================== -->
Expand All @@ -205,7 +206,7 @@
<!-- ============================================== -->
<!-- ================= MAVEN SITE ================= -->
<!-- ============================================== -->
<site.skin.version>2.3.1</site.skin.version>
<site.skin.version>2.3.2</site.skin.version>
<mavenURL>http://mvnrepository.com/artifact/com.bernardomg.tabletop/dice</mavenURL>
<githubArtifactURL><![CDATA[https://github.com/Bernardo-MG?tab=packages&amp;repo_name=dice-notation-java]]></githubArtifactURL>
</properties>
Expand Down Expand Up @@ -277,9 +278,16 @@
<scope>test</scope>
</dependency>
<dependency>
<!-- JUnit Jupiter Platform -->
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<!-- JUnit Jupiter Params -->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<!-- AssertJ -->
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -289,6 +297,13 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- Mockito JUnit -->
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- ********************************************** -->
Expand All @@ -313,13 +328,6 @@
<artifactId>antlr4test-maven-plugin</artifactId>
<version>${plugin.antlr.test.version}</version>
</plugin>
<plugin>
<!-- Build helper -->
<!-- Adds the generated files to the Maven classpath -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.buildhelp.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -449,7 +457,8 @@
</plugin>
<plugin>
<!-- PMD -->
<!-- Checks that the code complies with a series of code quality rules -->
<!-- Checks that the code complies with a series of code quality
rules -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
Expand Down
8 changes: 8 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,13 @@
Updated dependencies.
</action>
</release>
<release version="2.2.4" date="2023-06-23" description="Updated dependencies">
<action dev="bmg" type="update">
Updated dependencies.
</action>
<action dev="bmg" type="update">
Updated grammar to match the copy on ANTLR repo.
</action>
</release>
</body>
</document>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand All @@ -19,13 +19,15 @@
*
* This is the notation which RPGs and other tabletop games use to represent operations with dice.
*/
grammar DiceNotation;
parser grammar DiceNotationParser;

options { tokenVocab=DiceNotationLexer; }

/**
* Rules.
*/

file_ : notation EOF ;

notation
:
Expand Down Expand Up @@ -59,4 +61,4 @@ dice
number
:
ADDOPERATOR? DIGIT
;
;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bernardomg/tabletop/dice/Dice.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand All @@ -18,15 +18,14 @@

import java.util.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.bernardomg.tabletop.dice.notation.DiceNotationExpression;
import com.bernardomg.tabletop.dice.notation.operand.ConstantOperand;
import com.bernardomg.tabletop.dice.notation.operand.DiceOperand;
import com.bernardomg.tabletop.dice.notation.operation.BinaryOperation;
import com.bernardomg.tabletop.dice.visitor.NotationAccumulator;

import lombok.extern.slf4j.Slf4j;

/**
* An interpreter which can be customized.
* <p>
Expand All @@ -39,14 +38,9 @@
* @param <V>
* type of the generated object
*/
@Slf4j
public final class ConfigurableInterpreter<V> implements DiceInterpreter<V> {

/**
* Logger.
*/
private static final Logger LOGGER = LoggerFactory
.getLogger(ConfigurableInterpreter.class);

/**
* Accumulator for generating the final result.
*/
Expand Down Expand Up @@ -80,17 +74,17 @@ public final V transform(final DiceNotationExpression expression) {

Objects.requireNonNull(expression, "Received a null pointer as expression");

LOGGER.debug("Root expression {}", expression);
log.debug("Root expression {}", expression);

// The expression is broken down
exps = traverser.transform(expression);

LOGGER.trace("Traversed root into {}", exps);
log.trace("Traversed root into {}", exps);

// The expressions are filtered, taking all the dice
result = process(exps);

LOGGER.trace("Processed expressions into {}", result);
log.trace("Processed expressions into {}", result);

return result;
}
Expand All @@ -107,15 +101,15 @@ private final V process(final Iterable<DiceNotationExpression> nodes) {
accumulator.reset();

for (final DiceNotationExpression current : nodes) {
LOGGER.debug("Current expression: {}", current);
log.debug("Current expression: {}", current);
if (current instanceof BinaryOperation) {
accumulator.binaryOperation((BinaryOperation) current);
} else if (current instanceof ConstantOperand) {
accumulator.constantOperand((ConstantOperand) current);
} else if (current instanceof DiceOperand) {
accumulator.diceOperand((DiceOperand) current);
} else {
LOGGER.warn("Unsupported expression of type {}", current.getClass());
log.warn("Unsupported expression of type {}", current.getClass());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand All @@ -17,6 +17,7 @@
package com.bernardomg.tabletop.dice.interpreter;

import java.util.function.Function;
import java.util.function.UnaryOperator;

import com.bernardomg.tabletop.dice.Dice;
import com.bernardomg.tabletop.dice.history.RollHistory;
Expand Down Expand Up @@ -78,7 +79,7 @@ public DiceRoller(final Function<Dice, RollResult> roller) {
* @param transformer
* transformer to apply
*/
public DiceRoller(final Function<Dice, RollResult> roller, final Function<RollResult, RollResult> transformer) {
public DiceRoller(final Function<Dice, RollResult> roller, final UnaryOperator<RollResult> transformer) {
super();

final Function<Dice, RollResult> finalRoller;
Expand Down Expand Up @@ -107,7 +108,7 @@ public DiceRoller(final NumberGenerator generator) {
* @param transformer
* transformer to apply
*/
public DiceRoller(final NumberGenerator generator, final Function<RollResult, RollResult> transformer) {
public DiceRoller(final NumberGenerator generator, final UnaryOperator<RollResult> transformer) {
super();

final Function<Dice, RollResult> finalRoller;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2022 the original author or authors
* Copyright 2014-2023 the original author or authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down
Loading

0 comments on commit 7a57c35

Please sign in to comment.