Author: j16sdiz
Date: 2008-12-12 00:30:26 +0000 (Fri, 12 Dec 2008)
New Revision: 24220
Modified:
trunk/plugins/XMLSpider/XMLSpider.java
Log:
revert r24197: Integer is good enough
Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java 2008-12-12 00:12:12 UTC (rev
24219)
+++ trunk/plugins/XMLSpider/XMLSpider.java 2008-12-12 00:30:26 UTC (rev
24220)
@@ -181,7 +181,7 @@
// private final HashMap lastPositionByURI = new HashMap(); /* String
(URI) -> Integer */ /* Use to determine word position on each uri */
// private final HashMap positionsByWordByURI = new HashMap(); /* String
(URI) -> HashMap (String (word) -> Integer[] (Positions)) */
- private final HashMap<Long, HashMap<String, Long[]>>
positionsByWordById = new HashMap<Long, HashMap<String, Long[]>>();
+ private final HashMap<Long, HashMap<String, Integer[]>>
positionsByWordById = new HashMap<Long, HashMap<String, Integer[]>>();
// Can have many; this limit only exists to save memory.
private static final int maxParallelRequests = 100;
private int maxShownURIs = 15;
@@ -724,8 +724,8 @@
/* Position by position */
- HashMap<String, Long[]> positionsForGivenWord =
positionsByWordById.get(x);
- Long[] positions =
positionsForGivenWord.get(str);
+ HashMap<String, Integer[]>
positionsForGivenWord = positionsByWordById.get(x);
+ Integer[] positions =
(Integer[])positionsForGivenWord.get(str);
StringBuilder positionList = new
StringBuilder();
for(int k=0; k < positions.length ; k++) {
@@ -1245,7 +1245,7 @@
String[] words = s.split("[^\\p{L}\\{N}]");
if(lastPosition == null)
- lastPosition = 1L;
+ lastPosition = 1;
for (int i = 0; i < words.length; i++) {
String word = words[i];
if ((word == null) || (word.length() == 0))
@@ -1266,7 +1266,7 @@
}
}
- private void addWord(String word, long position, Long id)
throws Exception {
+ private void addWord(String word, int position, Long id) throws
Exception {
synchronized(XMLSpider.this) {
if(word.length() < 3)
return;
@@ -1274,7 +1274,7 @@
Long[] ids = idsByWord.get(word);
/* Word position indexation */
- HashMap<String, Long[]> wordPositionsForOneUri =
positionsByWordById.get(id); /*
+ HashMap<String, Integer[]> wordPositionsForOneUri =
positionsByWordById.get(id); /*
* For
* a
* given
@@ -1291,18 +1291,18 @@
* position
*/
if(wordPositionsForOneUri == null) {
- wordPositionsForOneUri = new HashMap<String,
Long[]>();
- wordPositionsForOneUri.put(word, new Long[] {
position });
+ wordPositionsForOneUri = new HashMap<String,
Integer[]>();
+ wordPositionsForOneUri.put(word, new Integer[]
{ position });
positionsByWordById.put(id,
wordPositionsForOneUri);
}
else {
- Long[] positions =
wordPositionsForOneUri.get(word);
+ Integer[] positions =
wordPositionsForOneUri.get(word);
if(positions == null) {
- positions = new Long[] { position };
+ positions = new Integer[] { position };
wordPositionsForOneUri.put(word,
positions);
}
else {
- Long[] newPositions = new
Long[positions.length + 1];
+ Integer[] newPositions = new
Integer[positions.length + 1];
System.arraycopy(positions, 0,
newPositions, 0, positions.length);
newPositions[positions.length] =
position;
wordPositionsForOneUri.put(word,
newPositions);
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs