• 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/moore/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.moore.dag;
17

18
import java.util.Arrays;
19
import java.util.Objects;
20

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

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

32
    final ResizingArrayStorage<State<O>> successors;
33
    final O output;
34
    private int hashCode;
35

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

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

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

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

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

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

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

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

80
}
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