• 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

73.68
/api/src/main/java/net/automatalib/word/EmptyWord.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.word;
17

18
import java.util.Collections;
19
import java.util.List;
20
import java.util.NoSuchElementException;
21
import java.util.Spliterator;
22
import java.util.Spliterators;
23
import java.util.function.Function;
24

25
import net.automatalib.alphabet.Alphabet;
26
import org.checkerframework.checker.nullness.qual.Nullable;
27

28
/**
29
 * The empty word.
30
 *
31
 * @see Collections#emptyList()
32
 */
33
final class EmptyWord<I> extends Word<I> {
2✔
34

35
    public static final EmptyWord<?> INSTANCE = new EmptyWord<>();
2✔
36

37
    @Override
38
    public int length() {
39
        return 0;
2✔
40
    }
41

42
    @Override
43
    public Spliterator<I> spliterator() {
44
        return Spliterators.emptySpliterator();
×
45
    }
46

47
    @Override
48
    public Word<I> subWordInternal(int fromIndex, int toIndex) {
49
        return this;
2✔
50
    }
51

52
    @Override
53
    public void writeToArray(int offset, @Nullable Object[] array, int tgtOffset, int length) {}
2✔
54

55
    @Override
56
    public I getSymbol(int index) {
57
        throw new IndexOutOfBoundsException(Integer.toString(index));
×
58
    }
59

60
    @Override
61
    public List<I> asList() {
62
        return Collections.emptyList();
2✔
63
    }
64

65
    @Override
66
    public Word<I> canonicalNext(Alphabet<I> sigma) {
67
        return new LetterWord<>(sigma.getSymbol(0));
1✔
68
    }
69

70
    @Override
71
    public I lastSymbol() {
72
        throw new NoSuchElementException();
×
73
    }
74

75
    @Override
76
    public Word<I> append(I symbol) {
77
        return new LetterWord<>(symbol);
2✔
78
    }
79

80
    @Override
81
    public Word<I> prepend(I symbol) {
82
        return append(symbol);
2✔
83
    }
84

85
    @Override
86
    public boolean isPrefixOf(Word<?> other) {
87
        return true;
2✔
88
    }
89

90
    @Override
91
    public Word<I> longestCommonPrefix(Word<?> other) {
92
        return this;
2✔
93
    }
94

95
    @Override
96
    public boolean isSuffixOf(Word<?> other) {
97
        return true;
2✔
98
    }
99

100
    @Override
101
    public Word<I> longestCommonSuffix(Word<?> other) {
102
        return this;
2✔
103
    }
104

105
    @Override
106
    public Word<I> flatten() {
107
        return this;
×
108
    }
109

110
    @Override
111
    public Word<I> trimmed() {
112
        return this;
×
113
    }
114

115
    @Override
116
    @SuppressWarnings("unchecked")
117
    public <T> Word<T> transform(Function<? super I, ? extends T> transformer) {
118
        return (Word<T>) this;
1✔
119
    }
120
}
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