Author: j16sdiz
Date: 2009-04-07 07:59:01 +0000 (Tue, 07 Apr 2009)
New Revision: 26595
Modified:
trunk/freenet/src/freenet/support/TimeSortedHashtable.java
Log:
Remove unused, not tested methods
Modified: trunk/freenet/src/freenet/support/TimeSortedHashtable.java
===================================================================
--- trunk/freenet/src/freenet/support/TimeSortedHashtable.java 2009-04-07 07:58:39 UTC (rev 26594)
+++ trunk/freenet/src/freenet/support/TimeSortedHashtable.java 2009-04-07 07:59:01 UTC (rev 26595)
@@ -9,17 +9,12 @@
/**
* 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> {
public TimeSortedHashtable() {
this.elements = new TreeSet<Comparable>(new MyComparator());
this.valueToElement = new HashMap<T, Element<T>>();
}
- private TimeSortedHashtable(TimeSortedHashtable<T> c) {
- this.elements = new TreeSet<Comparable>(c.elements);
- this.valueToElement = new HashMap<T, Element<T>>(c.valueToElement);
- }
-
private static class Element<T extends Comparable> implements Comparable<Element<T>> {
Element(long t, T v) {
@@ -67,16 +62,7 @@
private final TreeSet<Comparable> /* <Long || Element<T>> */elements;
private final HashMap<T, Element<T>> valueToElement;
-
- @Override
- public TimeSortedHashtable<T> clone() {
- return new TimeSortedHashtable<T>(this);
- }
- public final void push(T value) {
- push(value, System.currentTimeMillis());
- }
-
/**
* push()ing an object that is already in
* the queue moves that object to the most
@@ -102,25 +88,6 @@
assert(elements.size() == valueToElement.size());
}
- /**
- * Remove and return the least recently pushed value.
- * @return Least recently pushed value.
- */
- public final synchronized T popValue() {
- assert(elements.size() == valueToElement.size());
-
- Element<T> e = (Element<T>) elements.first();
- valueToElement.remove(e.value);
- elements.remove(e);
-
- assert(elements.size() == valueToElement.size());
- return e.value;
- }
-
- public final synchronized T peekValue() {
- return ((Element<T>) elements.first()).value;
- }
-
public final int size() {
return elements.size();
}
@@ -151,7 +118,7 @@
/**
* @return The set of times after the given time.
*/
- public final synchronized Long[] timesAfter(long t) {
+ private final synchronized Long[] timesAfter(long t) {
Set<Comparable> s = elements.tailSet(t);
Long[] times = new Long[s.size()];
@@ -167,7 +134,7 @@
* @return The set of values after the given time.
*/
// FIXME this is broken if timestamp != -1
- public final synchronized <E extends Comparable> E[] valuesAfter(long t, E[] values) {
+ private final synchronized <E extends Comparable> E[] valuesAfter(long t, E[] values) {
Set<Comparable> s = elements.tailSet(t);
int x = 0;
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.