Revision 39047
Added by Marek Horst almost 9 years ago
modules/icm-iis-common/trunk/src/main/java/eu/dnetlib/iis/common/model/extrainfo/citations/BlobCitationEntry.java | ||
---|---|---|
7 | 7 |
import java.util.regex.Pattern; |
8 | 8 |
|
9 | 9 |
import com.thoughtworks.xstream.annotations.XStreamAlias; |
10 |
import com.thoughtworks.xstream.annotations.XStreamAsAttribute; |
|
10 | 11 |
import com.thoughtworks.xstream.annotations.XStreamImplicit; |
11 | 12 |
import com.thoughtworks.xstream.annotations.XStreamOmitField; |
12 | 13 |
|
... | ... | |
19 | 20 |
public class BlobCitationEntry implements Comparable<BlobCitationEntry> { |
20 | 21 |
|
21 | 22 |
/** |
23 |
* Citation position. |
|
24 |
*/ |
|
25 |
@XStreamAsAttribute |
|
26 |
protected int position; |
|
27 |
|
|
28 |
/** |
|
22 | 29 |
* Raw citation text. |
23 | 30 |
*/ |
24 | 31 |
protected String rawText; |
... | ... | |
64 | 71 |
int result = 1; |
65 | 72 |
result = prime * result |
66 | 73 |
+ ((identifiers == null) ? 0 : identifiers.hashCode()); |
74 |
result = prime * result + position; |
|
67 | 75 |
result = prime * result + ((rawText == null) ? 0 : rawText.hashCode()); |
68 | 76 |
return result; |
69 | 77 |
} |
... | ... | |
82 | 90 |
return false; |
83 | 91 |
} else if (!identifiers.equals(other.identifiers)) |
84 | 92 |
return false; |
93 |
if (position != other.position) |
|
94 |
return false; |
|
85 | 95 |
if (rawText == null) { |
86 | 96 |
if (other.rawText != null) |
87 | 97 |
return false; |
... | ... | |
93 | 103 |
@Override |
94 | 104 |
public int compareTo(BlobCitationEntry c2) { |
95 | 105 |
if (c2!=null) { |
96 |
if (this.getRawText()!=null) { |
|
97 |
if (c2.getRawText()!=null) { |
|
98 |
int textCompareResult = compareText(this.getRawText(), c2.getRawText()); |
|
99 |
if (textCompareResult==0) { |
|
100 |
return compareIdentifiers(this.getIdentifiers(), c2.getIdentifiers()); |
|
106 |
if (this.position>c2.position) { |
|
107 |
return 1; |
|
108 |
} else if (this.position<c2.position) { |
|
109 |
return -1; |
|
110 |
} else { |
|
111 |
if (this.getRawText()!=null) { |
|
112 |
if (c2.getRawText()!=null) { |
|
113 |
int textCompareResult = compareText(this.getRawText(), c2.getRawText()); |
|
114 |
if (textCompareResult==0) { |
|
115 |
return compareIdentifiers(this.getIdentifiers(), c2.getIdentifiers()); |
|
116 |
} else { |
|
117 |
return textCompareResult; |
|
118 |
} |
|
119 |
} else { |
|
120 |
return -1; |
|
121 |
} |
|
101 | 122 |
} else { |
102 |
return textCompareResult; |
|
103 |
} |
|
104 |
} else { |
|
105 |
return -1; |
|
106 |
} |
|
107 |
} else { |
|
108 |
if (c2.getRawText()!=null) { |
|
109 |
return 1; |
|
110 |
} else { |
|
111 |
return compareIdentifiers(this.getIdentifiers(), c2.getIdentifiers()); |
|
112 |
} |
|
113 |
} |
|
123 |
if (c2.getRawText()!=null) { |
|
124 |
return 1; |
|
125 |
} else { |
|
126 |
return compareIdentifiers(this.getIdentifiers(), c2.getIdentifiers()); |
|
127 |
} |
|
128 |
} |
|
129 |
|
|
130 |
} |
|
114 | 131 |
} else { |
115 | 132 |
if (this.getRawText()!=null) { |
116 | 133 |
return -1; |
... | ... | |
118 | 135 |
if (this.getIdentifiers()!=null) { |
119 | 136 |
return -1; |
120 | 137 |
} else { |
138 |
// should we check position in any way? |
|
121 | 139 |
return 0; |
122 | 140 |
} |
123 | 141 |
} |
... | ... | |
175 | 193 |
} |
176 | 194 |
return compareValue; |
177 | 195 |
} |
196 |
|
|
197 |
/** |
|
198 |
* @return the position |
|
199 |
*/ |
|
200 |
public int getPosition() { |
|
201 |
return position; |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* @param position the position to set |
|
206 |
*/ |
|
207 |
public void setPosition(int position) { |
|
208 |
this.position = position; |
|
209 |
} |
|
178 | 210 |
} |
Also available in: Unified diff
#1498 introducing major citations related refactoring including new generic direct citation matching moved to processing phase, introduced position field in all citations schemas and updated collapser taking position into account when merging citations details coming from 3 variuos sources: fuzzy citationmatching, direct citationmatching, references metadata