0
|
1 package de.mpiwg.indexmeta.utils;
|
|
2
|
|
3 public class QuadKey<F, S, T> {
|
|
4 private F firstKey;
|
|
5 private S secondKey;
|
|
6 private T thirdKey;
|
|
7 private Object ownKey;
|
|
8 /*
|
|
9 public QuadKey(Long firstKey, Long secondKey, Long thirdKey, Long ownKey){
|
|
10 this.firstKey = firstKey;
|
|
11 this.secondKey = secondKey;
|
|
12 this.thirdKey = thirdKey;
|
|
13 this.ownKey = ownKey;
|
|
14 }*/
|
|
15
|
|
16 public QuadKey(F firstKey, S secondKey, T thirdKey, Long ownKey){
|
|
17 this.firstKey = firstKey;
|
|
18 this.secondKey = secondKey;
|
|
19 this.thirdKey = thirdKey;
|
|
20 this.ownKey = ownKey;
|
|
21 }
|
|
22
|
|
23 /*
|
|
24 public boolean containsKey(Object key){
|
|
25 if(key != null){
|
|
26 if(key.equals(firstKey) || key.equals(secondKey) || key.equals(ownKey)){
|
|
27 return true;
|
|
28 }
|
|
29 }
|
|
30 return false;
|
|
31 }*/
|
|
32
|
|
33
|
|
34 public boolean equalsFirstKey(Object key){
|
|
35 if(firstKey != null && key != null){
|
|
36 return firstKey.equals(key);
|
|
37 }else if(firstKey == null && key == null){
|
|
38 return true;
|
|
39 }
|
|
40 return false;
|
|
41 }
|
|
42
|
|
43 public boolean equalsSecondKey(Object key){
|
|
44 if(secondKey != null && key != null){
|
|
45 return secondKey.equals(key);
|
|
46 }else if(secondKey == null && key == null){
|
|
47 return true;
|
|
48 }
|
|
49 return false;
|
|
50 }
|
|
51
|
|
52 public boolean equalsThirdKey(Object key){
|
|
53 if(thirdKey != null && key != null){
|
|
54 return thirdKey.equals(key);
|
|
55 }else if(thirdKey == null && key == null){
|
|
56 return true;
|
|
57 }
|
|
58 return false;
|
|
59 }
|
|
60
|
|
61 public boolean equalsOwnKey(Object key){
|
|
62 if(ownKey != null && key != null){
|
|
63 return ownKey.equals(key);
|
|
64 }else if(ownKey == null && key == null){
|
|
65 return true;
|
|
66 }
|
|
67 return false;
|
|
68 }
|
|
69
|
|
70 public Object getFirstKey() {
|
|
71 return firstKey;
|
|
72 }
|
|
73
|
|
74 public void setFirstKey(F firstKey) {
|
|
75 this.firstKey = firstKey;
|
|
76 }
|
|
77
|
|
78 public Object getSecondKey() {
|
|
79 return secondKey;
|
|
80 }
|
|
81
|
|
82 public void setSecondKey(S secondKey) {
|
|
83 this.secondKey = secondKey;
|
|
84 }
|
|
85
|
|
86 public Object getOwnKey() {
|
|
87 return ownKey;
|
|
88 }
|
|
89
|
|
90 public void setOwnKey(Object ownKey) {
|
|
91 this.ownKey = ownKey;
|
|
92 }
|
|
93
|
|
94 public Object getThirdKey() {
|
|
95 return thirdKey;
|
|
96 }
|
|
97
|
|
98 public void setThirdKey(T thirdKey) {
|
|
99 this.thirdKey = thirdKey;
|
|
100 }
|
|
101
|
|
102 @Override
|
|
103 public boolean equals(Object o){
|
|
104 if(o instanceof QuadKey){
|
|
105 QuadKey other = (QuadKey)o;
|
|
106
|
|
107 if(this.equalsOwnKey(other.getOwnKey()) &&
|
|
108 this.equalsFirstKey(other.getFirstKey()) &&
|
|
109 this.equalsSecondKey(other.getSecondKey()) &&
|
|
110 this.equalsThirdKey(other.getThirdKey())){
|
|
111 return true;
|
|
112 }
|
|
113 }
|
|
114 return false;
|
|
115 }
|
|
116 }
|