Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: "Tests and Analysis (JDK: ${{ matrix.jdk }})"
strategy:
matrix:
jdk: [ 11, 17, 21 ]
jdk: [ 17, 21, 25 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
needs: [ tests-and-analysis ]
strategy:
matrix:
jdk: [ 11, 17, 21 ]
jdk: [ 17, 21, 25 ]
os: [ ubuntu-latest, windows-latest, macos-13, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
java-version: 17
- name: Set up cache
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
java-version: 17
- name: Set up cache
uses: actions/cache@v4
with:
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

* AutomataLib now requires Java 11 at runtime.
* AutomataLib now requires Java 17 at runtime.
* The following classes have been refactored to `record`s:
* `BricsTransitionProperty`
* `TransitionEdge{,.Property}`
* `ProbabilisticOutput`
* `LTSminVersion`
* The following class hierarchies have been made `sealed`:
* `CommonAttrs`
* `CommonStyles`
* `ProcessUtil#invokeProcess` now handles consumers for stdout and stderr separately.

### Removed

* `IOUtil#copy(Reader, Writer)` has been removed. Use `Reader#transferTo(Writer)` instead.
* `JVMUtil` has been removed. Use `Runtime.version().feature()` for its previously (only) provided method.

### Fixed

* `SPAConverter.ConversionResult` is now publicly accessible.


## [0.12.1] - 2025-03-11

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Contributions -- whether it is in the form of new features, better documentation

For simply using AutomataLib you may use the Maven artifacts which are available in the [Maven Central repository][maven-central].
It is also possible to download a bundled [distribution artifact][maven-central-distr] if you want to use AutomataLib without Maven support.
Note that AutomataLib requires Java 11 (or newer) to build and run.
Note that AutomataLib requires Java 17 (or newer) to build and run.

#### Building development versions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
package net.automatalib.brics;

import dk.brics.automaton.Transition;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* The properties of an edge in a Brics automaton.
*
* @param min
* lower bound of the character range.
* @param max
* upper bound of the character range.
*/
public class BricsTransitionProperty {

private final char min;
private final char max;
public record BricsTransitionProperty(char min, char max) {

/**
* Constructor. Constructs the property from a Brics {@link Transition}.
Expand All @@ -36,41 +37,6 @@ public BricsTransitionProperty(Transition trans) {
this(trans.getMin(), trans.getMax());
}

/**
* Constructor.
*
* @param min
* lower bound of the character range.
* @param max
* upper bound of the character range.
*/
public BricsTransitionProperty(char min, char max) {
this.min = min;
this.max = max;
}

/**
* Retrieves the lower bound of the character range.
*
* @return the lower bound of the character range
*
* @see Transition#getMin()
*/
public char getMin() {
return min;
}

/**
* Retrieves the upper bound of the character range.
*
* @return the upper bound of the character range
*
* @see Transition#getMax()
*/
public char getMax() {
return max;
}

@Override
public String toString() {
return toString(min, max);
Expand All @@ -84,25 +50,4 @@ public static String toString(char min, char max) {
}
return sb.toString();
}

@Override
public final boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (!(o instanceof BricsTransitionProperty)) {
return false;
}

final BricsTransitionProperty that = (BricsTransitionProperty) o;
return min == that.min && max == that.max;
}

@Override
public final int hashCode() {
int result = 1;
result = 31 * result + Character.hashCode(min);
result = 31 * result + Character.hashCode(max);
return result;
}
}
4 changes: 2 additions & 2 deletions api/src/main/java/net/automatalib/alphabet/Alphabet.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ default boolean containsSymbol(I symbol) {
* if {@code this} alphabet does not implement {@link GrowingAlphabet}
*/
default GrowingAlphabet<I> asGrowingAlphabetOrThrowException() {
if (this instanceof GrowingAlphabet) {
return (GrowingAlphabet<I>) this;
if (this instanceof GrowingAlphabet<I> result) {
return result;
} else {
throw new GrowingAlphabetNotSupportedException(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @param <I>
* input alphabet type
*/
@FunctionalInterface
public interface SupportsGrowingAlphabet<I> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* {@link SimpleAutomaton}). For example, push-down systems can have infinitely many states but may be representable
* with a finite amount of locations.
*/
@FunctionalInterface
public interface FiniteRepresentation {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import net.automatalib.alphabet.Alphabet;

@FunctionalInterface
public interface InputAlphabetHolder<I> {

Alphabet<I> getInputAlphabet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
* @param <D>
* output domain type
*/
@FunctionalInterface
public interface Output<I, D> {

D computeOutput(Iterable<? extends I> input);

static <T> WordBuilder<T> getBuilderFor(Iterable<?> iterable) {
if (iterable instanceof Word) {
return new WordBuilder<>(((Word<?>) iterable).length());
} else if (iterable instanceof Collection) {
return new WordBuilder<>(((Collection<?>) iterable).size());
if (iterable instanceof Word<?> w) {
return new WordBuilder<>(w.length());
} else if (iterable instanceof Collection<?> c) {
return new WordBuilder<>(c.size());
} else {
return new WordBuilder<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package net.automatalib.automaton.concept;

@FunctionalInterface
public interface Probabilistic<T> {

float getTransitionProbability(T transition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @param <I>
* input symbol type
*/
@FunctionalInterface
public interface StateLocalInput<S, I> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @param <O>
* output class.
*/
@FunctionalInterface
public interface StateOutput<S, O> {

O getStateOutput(S state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @param <D>
* output domain type
*/
@FunctionalInterface
public interface SuffixOutput<I, D> extends Output<I, D> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @param <O>
* output class.
*/
@FunctionalInterface
public interface TransitionOutput<T, O> {

O getTransitionOutput(T transition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static <S, I, T> Collection<TransitionEdge<I, T>> createTransitionEdges(A

@Override
public S getTarget(TransitionEdge<I, T> edge) {
return automaton.getSuccessor(edge.getTransition());
return automaton.getSuccessor(edge.transition());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,91 +15,13 @@
*/
package net.automatalib.automaton.graph;

import java.util.Objects;

import net.automatalib.ts.UniversalTransitionSystem;
import org.checkerframework.checker.nullness.qual.Nullable;

public final class TransitionEdge<I, T> {

private final I input;
private final T transition;

public TransitionEdge(I input, T transition) {
this.input = input;
this.transition = transition;
}

public I getInput() {
return input;
}

public T getTransition() {
return transition;
}
public record TransitionEdge<I, T>(I input, T transition) {

public <TP> Property<I, TP> property(UniversalTransitionSystem<?, ?, T, ?, TP> uts) {
return new Property<>(input, uts.getTransitionProperty(transition));
}

@Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TransitionEdge)) {
return false;
}

final TransitionEdge<?, ?> that = (TransitionEdge<?, ?>) o;
return Objects.equals(input, that.input) && Objects.equals(transition, that.transition);
}

@Override
public int hashCode() {
int result = 1;
result = 31 * result + Objects.hashCode(input);
result = 31 * result + Objects.hashCode(transition);
return result;
}

public static final class Property<I, TP> {

private final I input;
private final TP property;

public Property(I input, TP property) {
this.input = input;
this.property = property;
}

public I getInput() {
return input;
}

public TP getProperty() {
return property;
}

@Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Property)) {
return false;
}

final Property<?, ?> that = (Property<?, ?>) o;
return Objects.equals(input, that.input) && Objects.equals(property, that.property);
}

@Override
public int hashCode() {
int result = 1;
result = 31 * result + Objects.hashCode(input);
result = 31 * result + Objects.hashCode(property);
return result;
}
}
public record Property<I, TP>(I input, TP property) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public SP getNodeProperty(S node) {

@Override
public Property<I, TP> getEdgeProperty(TransitionEdge<I, T> edge) {
return new TransitionEdge.Property<>(edge.getInput(), automaton.getTransitionProperty(edge.getTransition()));
return new TransitionEdge.Property<>(edge.input(), automaton.getTransitionProperty(edge.transition()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ default Void getStateProperty(S state) {

@Override
default float getTransitionProbability(T transition) {
return getTransitionProperty(transition).getProbability();
return getTransitionProperty(transition).probability();
}

@Override
default O getTransitionOutput(T transition) {
return getTransitionProperty(transition).getOutput();
return getTransitionProperty(transition).output();
}
}
Loading
Loading