RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
PrefixTrie.java
1
/*
2
* Copyright (C) 2018-2021 Niels Basjes
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
* https://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
17
package
org.wpilib.util.collections.prefixmap;
18
19
import
java.util.Iterator;
20
import
java.util.Objects;
21
import
java.util.PrimitiveIterator;
22
23
interface
PrefixTrie
<V> {
31
default
V
add
(String prefix, V value) {
32
Objects.requireNonNull(prefix,
"The prefix may not be null"
);
33
Objects.requireNonNull(value,
"The value may not be null"
);
34
return
add
(prefix.codePoints().iterator(), value);
35
}
36
44
V
add
(PrimitiveIterator.OfInt prefix, V value);
45
46
// ====================================================
47
54
default
V
remove
(String prefix) {
55
Objects.requireNonNull(prefix,
"The prefix may not be null"
);
56
return
remove
(prefix.codePoints().iterator());
57
}
58
65
default
V
remove
(PrimitiveIterator.OfInt prefix) {
66
throw
new
UnsupportedOperationException(
67
"The 'remove(PrimitiveIterator.OfInt prefix)' method has not been implemented in "
68
+ this.getClass().getCanonicalName());
69
}
70
71
// ====================================================
72
79
default
boolean
containsPrefix
(String prefix) {
80
return
get
(prefix) !=
null
;
81
}
82
90
default
boolean
containsPrefix
(PrimitiveIterator.OfInt prefix) {
91
return
get
(prefix) !=
null
;
92
}
93
94
// ====================================================
95
105
default
V
get
(String input) {
106
Objects.requireNonNull(input,
"The input may not be null"
);
107
return
get
(input.codePoints().iterator());
108
}
109
120
V
get
(PrimitiveIterator.OfInt input);
121
122
// ====================================================
123
133
default
V
getShortestMatch
(String input) {
134
Objects.requireNonNull(input,
"The input may not be null"
);
135
return
getShortestMatch
(input.codePoints().iterator());
136
}
137
147
V
getShortestMatch
(PrimitiveIterator.OfInt input);
148
149
// ====================================================
150
160
default
V
getLongestMatch
(String input) {
161
Objects.requireNonNull(input,
"The input may not be null"
);
162
return
getLongestMatch
(input.codePoints().iterator());
163
}
164
174
V
getLongestMatch
(PrimitiveIterator.OfInt input);
175
176
// ====================================================
177
187
default
Iterator<V>
getAllMatches
(String input) {
188
Objects.requireNonNull(input,
"The input may not be null"
);
189
return
getAllMatches
(input.codePoints().iterator());
190
}
191
201
Iterator<V>
getAllMatches
(PrimitiveIterator.OfInt input);
202
203
// ====================================================
204
206
void
clear
();
207
}
org.wpilib.util.collections.prefixmap.PrefixTrie
Definition
PrefixTrie.java:23
org.wpilib.util.collections.prefixmap.PrefixTrie.getShortestMatch
V getShortestMatch(PrimitiveIterator.OfInt input)
org.wpilib.util.collections.prefixmap.PrefixTrie.getLongestMatch
default V getLongestMatch(String input)
Definition
PrefixTrie.java:160
org.wpilib.util.collections.prefixmap.PrefixTrie.clear
void clear()
org.wpilib.util.collections.prefixmap.PrefixTrie.add
default V add(String prefix, V value)
Definition
PrefixTrie.java:31
org.wpilib.util.collections.prefixmap.PrefixTrie.getShortestMatch
default V getShortestMatch(String input)
Definition
PrefixTrie.java:133
org.wpilib.util.collections.prefixmap.PrefixTrie.getLongestMatch
V getLongestMatch(PrimitiveIterator.OfInt input)
org.wpilib.util.collections.prefixmap.PrefixTrie.containsPrefix
default boolean containsPrefix(String prefix)
Definition
PrefixTrie.java:79
org.wpilib.util.collections.prefixmap.PrefixTrie.getAllMatches
default Iterator< V > getAllMatches(String input)
Definition
PrefixTrie.java:187
org.wpilib.util.collections.prefixmap.PrefixTrie.getAllMatches
Iterator< V > getAllMatches(PrimitiveIterator.OfInt input)
org.wpilib.util.collections.prefixmap.PrefixTrie.add
V add(PrimitiveIterator.OfInt prefix, V value)
org.wpilib.util.collections.prefixmap.PrefixTrie.containsPrefix
default boolean containsPrefix(PrimitiveIterator.OfInt prefix)
Definition
PrefixTrie.java:90
org
wpilib
util
collections
prefixmap
PrefixTrie.java
Generated by
1.18.0