• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / automatalib / 6763327895

05 Nov 2023 07:29PM UTC coverage: 89.726% (-0.1%) from 89.868%
6763327895

push

github

mtf90
fix typo

4 of 4 new or added lines in 4 files covered. (100.0%)

99 existing lines in 18 files now uncovered.

15677 of 17472 relevant lines covered (89.73%)

1.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.0
/incremental/src/main/java/net/automatalib/incremental/mealy/dag/StateSignature.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of AutomataLib, http://www.automatalib.net/.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package net.automatalib.incremental.mealy.dag;
17

18
import java.util.Arrays;
19

20
import net.automatalib.common.smartcollection.ResizingArrayStorage;
21
import org.checkerframework.checker.nullness.qual.Nullable;
22

23
/**
24
 * A signature of a DAG state internally used by {@link IncrementalMealyDAGBuilder}.
25
 *
26
 * @param <O>
27
 *         output symbol type
28
 */
29
final class StateSignature<O> {
30

31
    final ResizingArrayStorage<State<O>> successors;
32
    final ResizingArrayStorage<O> outputs;
33
    private int hashCode;
34

35
    StateSignature(int numSuccs) {
2✔
36
        this.successors = new ResizingArrayStorage<>(State.class, numSuccs);
2✔
37
        this.outputs = new ResizingArrayStorage<>(Object.class, numSuccs);
2✔
38
        updateHashCode();
2✔
39
    }
2✔
40

41
    StateSignature(StateSignature<O> other) {
2✔
42
        this.successors = new ResizingArrayStorage<>(other.successors);
2✔
43
        this.outputs = new ResizingArrayStorage<>(other.outputs);
2✔
44
        updateHashCode();
2✔
45
    }
2✔
46

47
    StateSignature<O> duplicate() {
48
        return new StateSignature<>(this);
2✔
49
    }
50

51
    void updateHashCode() {
52
        final int prime = 31;
2✔
53
        int result = 1;
2✔
54
        result = prime * result + Arrays.hashCode(outputs.array);
2✔
55
        result = prime * result + Arrays.hashCode(successors.array);
2✔
56
        hashCode = result;
2✔
57
    }
2✔
58

59
    @Override
60
    public int hashCode() {
61
        return hashCode;
2✔
62
    }
63

64
    @Override
65
    public boolean equals(@Nullable Object obj) {
66
        if (this == obj) {
2✔
UNCOV
67
            return true;
×
68
        }
69
        if (!(obj instanceof StateSignature)) {
2✔
UNCOV
70
            return false;
×
71
        }
72

73
        final StateSignature<?> other = (StateSignature<?>) obj;
2✔
74

75
        return hashCode == other.hashCode && Arrays.equals(outputs.array, other.outputs.array) &&
2✔
76
               Arrays.equals(successors.array, other.successors.array);
2✔
77
    }
78

79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc