r26586 - trunk/freenet/src/freenet/support

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-07 04:45:09 +0000 (Tue, 07 Apr 2009)
New Revision: 26586

Modified:
   trunk/freenet/src/freenet/support/TimeSortedHashtable.java
Log:
Values after/before should be exclusive

Modified: trunk/freenet/src/freenet/support/TimeSortedHashtable.java
===================================================================
--- trunk/freenet/src/freenet/support/TimeSortedHashtable.java	2009-04-07 04:44:48 UTC (rev 26585)
+++ trunk/freenet/src/freenet/support/TimeSortedHashtable.java	2009-04-07 04:45:09 UTC (rev 26586)
@@ -9,7 +9,7 @@
 /**
  * Variant on LRUHashtable which provides an efficient how-many-since-time-T operation.
  */
-public class TimeSortedHashtable<T extends Comparable> implements Cloneable {
+public class TimeSortedHashtable<T extends Comparable<?>> implements Cloneable {
 	public TimeSortedHashtable() {
 		this.elements = new TreeSet<Comparable>(new MyComparator());
 		this.valueToElement = new HashMap<T, Element<T>>();
@@ -152,7 +152,7 @@
      * @return The set of times after the given time.
      */
     public final synchronized Long[] timesAfter(long t) {
-    	Set<Comparable> s = elements.tailSet(t);
+    	Set<Comparable> s = elements.tailSet(t, false);
     	
     	Long[] times = new Long[s.size()];
     	int x = 0;
@@ -167,7 +167,7 @@
      * @return The set of values after the given time.
      */
     public final synchronized <E extends Comparable> E[] valuesAfter(long t, E[] values) {
-    	Set<Comparable> s = elements.tailSet(t);
+    	Set<Comparable> s = elements.tailSet(t, false);
     	
     	int x = 0;
     	for(Iterator<Comparable> i = s.iterator();i.hasNext();) {
@@ -178,7 +178,7 @@
     }
 
 	public synchronized int countValuesAfter(long t) {
-    	Set<Comparable> s = elements.tailSet(t);
+    	Set<Comparable> s = elements.tailSet(t, false);
     	
     	return s.size();
 	}
@@ -188,7 +188,7 @@
      */
 	public final synchronized void removeBefore(long t) {
     	assert(elements.size() == valueToElement.size());
-    	Set<Comparable> s = elements.headSet(t);
+    	Set<Comparable> s = elements.headSet(t, false);
     	
     	for(Iterator<Comparable> i = s.iterator();i.hasNext();) {
     		Element<T> e = (Element<T>) i.next();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.