blob: 8c6ec1d938758246724a15bf276bf28c144a08b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package com.intellij.tokenindex;
import org.jetbrains.annotations.NotNull;
import java.util.Set;
/**
* @author Eugene.Kudelevsky
*/
public class TokenIndexKey {
private final Set<String> myLanguages;
private final int myBlockId;
public TokenIndexKey(@NotNull Set<String> languages, int blockId) {
myLanguages = languages;
myBlockId = blockId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TokenIndexKey that = (TokenIndexKey)o;
if (myBlockId != that.myBlockId) return false;
if (!myLanguages.equals(that.myLanguages)) return false;
return true;
}
@Override
public int hashCode() {
int result = myLanguages.hashCode();
result = 31 * result + myBlockId;
return result;
}
@Override
public String toString() {
return myLanguages + ": " + myBlockId;
}
public Set<String> getLanguages() {
return myLanguages;
}
public boolean containsLanguage(String languageId) {
for (String language : myLanguages) {
if (language.contains(languageId)) {
return true;
}
}
return false;
}
public int getBlockId() {
return myBlockId;
}
}
|