|
@@ -1,100 +0,0 @@
|
1
|
|
-/*
|
2
|
|
- * Copyright (c) 2006-2015 DMDirc Developers
|
3
|
|
- *
|
4
|
|
- * Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
|
- * of this software and associated documentation files (the "Software"), to deal
|
6
|
|
- * in the Software without restriction, including without limitation the rights
|
7
|
|
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
|
- * copies of the Software, and to permit persons to whom the Software is
|
9
|
|
- * furnished to do so, subject to the following conditions:
|
10
|
|
- *
|
11
|
|
- * The above copyright notice and this permission notice shall be included in
|
12
|
|
- * all copies or substantial portions of the Software.
|
13
|
|
- *
|
14
|
|
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
|
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
|
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
|
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
|
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
|
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
|
- * SOFTWARE.
|
21
|
|
- */
|
22
|
|
-
|
23
|
|
-package com.dmdirc.ui.input;
|
24
|
|
-
|
25
|
|
-import java.util.ArrayList;
|
26
|
|
-import java.util.Collections;
|
27
|
|
-import java.util.List;
|
28
|
|
-
|
29
|
|
-/**
|
30
|
|
- * Describes a set of matches from a tab completion attempt.
|
31
|
|
- *
|
32
|
|
- * @deprecated This class is dumb. Just use a List.
|
33
|
|
- */
|
34
|
|
-@Deprecated
|
35
|
|
-public class TabCompletionMatches extends ArrayList<String> {
|
36
|
|
-
|
37
|
|
- /**
|
38
|
|
- * Adds a result to this result set.
|
39
|
|
- *
|
40
|
|
- * @param result The result to be added
|
41
|
|
- */
|
42
|
|
- public void addResult(final String result) {
|
43
|
|
- add(result);
|
44
|
|
- }
|
45
|
|
-
|
46
|
|
- /**
|
47
|
|
- * Determines if this result set contains the specified result.
|
48
|
|
- *
|
49
|
|
- * @param result The result to be tested
|
50
|
|
- *
|
51
|
|
- * @return True if this set contains the specified result, false otherwise
|
52
|
|
- */
|
53
|
|
- public boolean hasResult(final String result) {
|
54
|
|
- return contains(result);
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- /**
|
58
|
|
- * Merges the specified additional results with this result set.
|
59
|
|
- *
|
60
|
|
- * @param additional The results to merge
|
61
|
|
- */
|
62
|
|
- public void merge(final TabCompletionMatches additional) {
|
63
|
|
- additional.getResults().stream().filter(result -> !hasResult(result))
|
64
|
|
- .forEach(this::addResult);
|
65
|
|
- }
|
66
|
|
-
|
67
|
|
- /**
|
68
|
|
- * Gets the total size of this result set.
|
69
|
|
- *
|
70
|
|
- * @return the size of this result set
|
71
|
|
- */
|
72
|
|
- public int getResultCount() {
|
73
|
|
- return size();
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- /**
|
77
|
|
- * Retrieves the list of results that this set contains.
|
78
|
|
- *
|
79
|
|
- * @return An unmodifiable list containing the results
|
80
|
|
- */
|
81
|
|
- public List<String> getResults() {
|
82
|
|
- return Collections.unmodifiableList(this);
|
83
|
|
- }
|
84
|
|
-
|
85
|
|
- @Override
|
86
|
|
- public String toString() {
|
87
|
|
- final StringBuilder buff = new StringBuilder();
|
88
|
|
-
|
89
|
|
- for (String entry : this) {
|
90
|
|
- if (buff.length() > 0) {
|
91
|
|
- buff.append(", ");
|
92
|
|
- }
|
93
|
|
-
|
94
|
|
- buff.append(entry);
|
95
|
|
- }
|
96
|
|
-
|
97
|
|
- return buff.toString();
|
98
|
|
- }
|
99
|
|
-
|
100
|
|
-}
|