Skip to content

Commit d213088

Browse files
committed
ctrl + f
1 parent fd1f4d7 commit d213088

File tree

7 files changed

+30
-42
lines changed

7 files changed

+30
-42
lines changed

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/CoreRow.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
import net.automatalib.word.Word;
2424

2525
/**
26-
* Each core row represents some hypothesis state
27-
* and stores its outputs for all table suffixes.
26+
* Each core row represents some hypothesis state and stores its outputs for all table suffixes.
2827
*/
2928
class CoreRow<S, I, O> extends Row<S, I, O> {
3029

@@ -34,8 +33,7 @@ class CoreRow<S, I, O> extends Row<S, I, O> {
3433
final S state;
3534

3635
/**
37-
* Index of this row in the core row list.
38-
* Used as a unique address.
36+
* Index of this row in the core row list. Used as a unique address.
3937
*/
4038
final int idx;
4139

@@ -45,8 +43,7 @@ class CoreRow<S, I, O> extends Row<S, I, O> {
4543
final Map<Word<I>, Word<O>> sufToOut;
4644

4745
/**
48-
* Identifiers of all suffix-output pairs in this row,
49-
* used for fast compatibility checking.
46+
* Identifiers of all suffix-output pairs in this row, used for fast compatibility checking.
5047
*/
5148
final Set<Integer> cellIds;
5249

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/FringeRow.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
import net.automatalib.word.Word;
1919

2020
/**
21-
* Each fringe row represents some hypothesis transition
22-
* outside the spanning tree defined by the core prefixes.
21+
* Each fringe row represents some hypothesis transition outside the spanning tree defined by the core prefixes.
2322
*
2423
* @param <S>
2524
* state type
@@ -46,9 +45,8 @@ class FringeRow<S, I, O> extends Row<S, I, O> {
4645
O transOut;
4746

4847
/**
49-
* For compression, fringe rows do not store observations directly.
50-
* Instead, they point to some leaf in a tree encoding their classification history.
51-
* This trick avoids redundantly storing identical observations.
48+
* For compression, fringe rows do not store observations directly. Instead, they point to some leaf in a tree
49+
* encoding their classification history. This trick avoids redundantly storing identical observations.
5250
*/
5351
Leaf<S, I, O> leaf;
5452

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/GenericSparseLearner.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class GenericSparseLearner<S, I, O> implements MealyLearner<I, O> {
6262
private final Map<Word<I>, FringeRow<S, I, O>> prefToFringe;
6363

6464
/**
65-
* List of unique suffix-output pairs, addressable by index.
66-
* Used for table compression: table entries only hold cell index.
65+
* List of unique suffix-output pairs, addressable by index. Used for table compression: table entries only hold
66+
* cell index.
6767
*/
6868
private final List<Pair<Word<I>, Word<O>>> cells;
6969

@@ -257,8 +257,7 @@ private Word<O> query(Row<S, I, O> r, Word<I> suf) {
257257
}
258258

259259
/**
260-
* Adds suffix-output pair to index if not yet contained,
261-
* and returns a unique identifier representing the pair.
260+
* Adds suffix-output pair to index if not yet contained, and returns a unique identifier representing the pair.
262261
*/
263262
private int getUniqueCellIdx(Word<I> suf, Word<O> out) {
264263
assert suf.length() == out.length();
@@ -296,8 +295,8 @@ private int moveToCore(FringeRow<S, I, O> f, List<Integer> cellIds) {
296295
}
297296

298297
/**
299-
* Takes fringe row and its observations, queries the missing entries,
300-
* and returns a list containing the observations for all suffixes.
298+
* Takes fringe row and its observations, queries the missing entries, and returns a list containing the
299+
* observations for all suffixes.
301300
*/
302301
private List<Integer> completeRowObservations(FringeRow<S, I, O> f, List<Integer> cellIds) {
303302
final List<Word<I>> sufsPresent = cellIds.stream().map(c -> this.cells.get(c).getFirst()).toList();

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/Leaf.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,25 @@
2121
import org.checkerframework.checker.nullness.qual.Nullable;
2222

2323
/**
24-
* Leaves can be split or unsplit.
25-
* An unsplit leaf has a single compatible core row to which it points.
26-
* As new core rows emerge, the observations of the leaf may not suffice
27-
* anymore to uniquely assign it to some core row. Then, it becomes split.
28-
* Split leaves cache suffix selection by reference to separators.
29-
* Leaves remember how many core rows and suffixes existed at their last visit.
30-
* This information is used as a logical timestamp to check
31-
* if the separator is still known to be optimal
32-
* or if it needs to be recomputed.
24+
* Leaves can be split or unsplit. An unsplit leaf has a single compatible core row to which it points. As new core rows
25+
* emerge, the observations of the leaf may not suffice anymore to uniquely assign it to some core row. Then, it becomes
26+
* split. Split leaves cache suffix selection by reference to separators. Leaves remember how many core rows and
27+
* suffixes existed at their last visit. This information is used as a logical timestamp to check if the separator is
28+
* still known to be optimal or if it needs to be recomputed.
3329
*/
3430
class Leaf<S, I, O> extends Node<S, I, O> {
3531

3632
/**
3733
* Core row associated with this leaf (null if split, see {@link Leaf}).
3834
*/
39-
@Nullable CoreRow<S, I, O> cRow;
35+
@Nullable
36+
CoreRow<S, I, O> cRow;
4037

4138
/**
4239
* Separator cached by this leaf (see {@link Leaf}).
4340
*/
44-
@Nullable Separator<S, I, O> sep;
41+
@Nullable
42+
Separator<S, I, O> sep;
4543

4644
private int lastNumCRows;
4745
private int lastNumSufs;
@@ -62,8 +60,7 @@ private Leaf(int numCRows, int numSufs, List<Integer> cellIds) {
6260
}
6361

6462
/**
65-
* Creates unsplit leaf associated with the given core row and observations
66-
* (see {@link Leaf}).
63+
* Creates unsplit leaf associated with the given core row and observations (see {@link Leaf}).
6764
*/
6865
Leaf(CoreRow<S, I, O> cRow, int numCRows, int numSufs, List<Integer> cellIds) {
6966
this(numCRows, numSufs, cellIds);

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/Node.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
import java.util.List;
2020

2121
/**
22-
* For table compression and to cache suffix selection,
23-
* fringe rows do not store observations, but instead map to some node.
24-
* Each node is associated with a set of suffix-output pairs,
25-
* potentially representing multiple rows with identical observations.
26-
* Nodes are either leaves or separators.
22+
* For table compression and to cache suffix selection, fringe rows do not store observations, but instead map to some
23+
* node. Each node is associated with a set of suffix-output pairs, potentially representing multiple rows with
24+
* identical observations. Nodes are either leaves or separators.
2725
*/
2826
class Node<S, I, O> { // type parameters required for safe casting
2927

@@ -33,9 +31,8 @@ class Node<S, I, O> { // type parameters required for safe casting
3331
final List<Integer> cellIds;
3432

3533
/**
36-
* Bit vector encoding which core rows remain compatible
37-
* with the observations at this node.
38-
* Rows are represented by their index.
34+
* Bit vector encoding which core rows remain compatible with the observations at this node. Rows are represented by
35+
* their index.
3936
*/
4037
final BitSet remRows;
4138

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/Row.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import net.automatalib.word.Word;
1919

2020
class Row<S, I, O> { // type parameters required for safe casting
21+
2122
final Word<I> prefix;
2223

2324
protected Row(Word<I> prefix) {

algorithms/active/sparse/src/main/java/de/learnlib/algorithm/sparse/Separator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
import net.automatalib.word.Word;
2424

2525
/**
26-
* Separators guide the classification of fringe prefixes.
27-
* A separator holds a suffix and a branch map.
28-
* The map points to the next node,
29-
* depending on the output produced by the suffix.
26+
* Separators guide the classification of fringe prefixes. A separator holds a suffix and a branch map. The map points
27+
* to the next node, depending on the output produced by the suffix.
3028
*/
3129
class Separator<S, I, O> extends Node<S, I, O> {
30+
3231
final Word<I> suffix;
3332
final Map<Word<O>, Node<S, I, O>> branchMap;
3433

0 commit comments

Comments
 (0)