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

LearnLib / automatalib / 13138848026

04 Feb 2025 02:53PM UTC coverage: 92.108% (+2.2%) from 89.877%
13138848026

push

github

mtf90
[maven-release-plugin] prepare release automatalib-0.12.0

16609 of 18032 relevant lines covered (92.11%)

1.7 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/moore/dag/StateSignature.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of AutomataLib <https://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.moore.dag;
17

18
import java.util.Objects;
19

20
import net.automatalib.common.util.array.ArrayStorage;
21
import org.checkerframework.checker.nullness.qual.Nullable;
22

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

31
    final ArrayStorage<State<O>> successors;
32
    final O output;
33
    private int hashCode;
34

35
    StateSignature(int numSuccs, O output) {
2✔
36
        this.successors = new ArrayStorage<>(numSuccs);
2✔
37
        this.output = output;
2✔
38
        updateHashCode();
2✔
39
    }
2✔
40

41
    StateSignature(StateSignature<O> other) {
2✔
42
        this.successors = new ArrayStorage<>(other.successors);
2✔
43
        this.output = other.output;
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 + successors.hashCode();
2✔
55
        result = prime * result + Objects.hashCode(output);
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✔
67
            return true;
×
68
        }
69
        if (!(obj instanceof StateSignature)) {
2✔
70
            return false;
×
71
        }
72

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

75
        return hashCode == other.hashCode && Objects.equals(output, other.output) &&
2✔
76
               successors.equals(other.successors);
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

© 2025 Coveralls, Inc