Applying my patch, with the obj creation commented out, from COLLECTIONS-285. This makes TreeBidiMap serializable.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@655756 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6965d41836
commit
68d2beaf42
Binary file not shown.
Binary file not shown.
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.collections.bidimap;
|
package org.apache.commons.collections.bidimap;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.AbstractSet;
|
import java.util.AbstractSet;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.ConcurrentModificationException;
|
import java.util.ConcurrentModificationException;
|
||||||
|
@ -73,7 +75,7 @@ import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
|
||||||
* @author Marc Johnson
|
* @author Marc Johnson
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TreeBidiMap implements OrderedBidiMap {
|
public class TreeBidiMap implements OrderedBidiMap, Serializable {
|
||||||
|
|
||||||
private static final int KEY = 0;
|
private static final int KEY = 0;
|
||||||
private static final int VALUE = 1;
|
private static final int VALUE = 1;
|
||||||
|
@ -87,10 +89,11 @@ public class TreeBidiMap implements OrderedBidiMap {
|
||||||
private Node[] rootNode = new Node[2];
|
private Node[] rootNode = new Node[2];
|
||||||
private int nodeCount = 0;
|
private int nodeCount = 0;
|
||||||
private int modifications = 0;
|
private int modifications = 0;
|
||||||
private Set keySet;
|
|
||||||
private Set valuesSet;
|
private transient Set keySet;
|
||||||
private Set entrySet;
|
private transient Set valuesSet;
|
||||||
private TreeBidiMap.Inverse inverse = null;
|
private transient Set entrySet;
|
||||||
|
private transient TreeBidiMap.Inverse inverse = null;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +151,7 @@ public class TreeBidiMap implements OrderedBidiMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether this map contains the a mapping for the specified value.
|
* Checks whether this map contains a mapping for the specified value.
|
||||||
* <p>
|
* <p>
|
||||||
* The value must implement <code>Comparable</code>.
|
* The value must implement <code>Comparable</code>.
|
||||||
*
|
*
|
||||||
|
@ -1707,7 +1710,7 @@ public class TreeBidiMap implements OrderedBidiMap {
|
||||||
/**
|
/**
|
||||||
* A node used to store the data.
|
* A node used to store the data.
|
||||||
*/
|
*/
|
||||||
static class Node implements Map.Entry, KeyValue {
|
static class Node implements Map.Entry, KeyValue, Serializable {
|
||||||
|
|
||||||
private Comparable[] data;
|
private Comparable[] data;
|
||||||
private Node[] leftNode;
|
private Node[] leftNode;
|
||||||
|
|
|
@ -73,4 +73,15 @@ public class TestTreeBidiMap extends AbstractTestOrderedBidiMap {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCompatibilityVersion() {
|
||||||
|
return "3.3";
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void testCreate() throws Exception {
|
||||||
|
// resetEmpty();
|
||||||
|
// writeExternalFormToDisk((java.io.Serializable) map, "/tmp/TreeBidiMap.emptyCollection.version3.3.obj");
|
||||||
|
// resetFull();
|
||||||
|
// writeExternalFormToDisk((java.io.Serializable) map, "/tmp/TreeBidiMap.fullCollection.version3.3.obj");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue