use of org.springframework.util.comparator.ComparableComparator in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newTempDisk.
public static <K extends Comparable<?>, V> Map<K, V> newTempDisk(final Map<K, V> values, PageValueManager<K> keyManager, PageValueManager<V> valueManager) {
final File file = FileUtil.newTempFile("temp", ".bplustree");
final PageManager pageManager = new FilePageManager(file);
if (keyManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<K> serializeableManager = (SerializablePageValueManager<K>) keyManager;
keyManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
if (valueManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<V> serializeableManager = (SerializablePageValueManager<V>) valueManager;
valueManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
final Comparator<K> comparator = new ComparableComparator();
final BPlusTreeMap<K, V> map = new BPlusTreeMap<>(pageManager, comparator, keyManager, valueManager);
map.putAll(values);
return map;
}
use of org.springframework.util.comparator.ComparableComparator in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newInMemory.
public static <K extends Comparable<K>, V> Map<K, V> newInMemory(final PageValueManager<K> keyManager, final PageValueManager<V> valueManager) {
final MemoryPageManager pages = new MemoryPageManager();
final Comparator<K> comparator = new ComparableComparator<>();
return new BPlusTreeMap<>(pages, comparator, keyManager, valueManager);
}
use of org.springframework.util.comparator.ComparableComparator in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newIntSeralizableTempDisk.
public static <V> Map<Integer, V> newIntSeralizableTempDisk(final Map<Integer, V> values) {
final File file = FileUtil.newTempFile("int", ".btree");
final PageManager pageManager = new FilePageManager(file);
final PageValueManager<Integer> keyManager = PageValueManager.INT;
final SerializablePageValueManager<V> valueSerializer = new SerializablePageValueManager<>();
final PageValueManager<V> valueManager = BPlusTreePageValueManager.newPageValueManager(pageManager, valueSerializer);
final Comparator<Integer> comparator = new ComparableComparator<>();
final BPlusTreeMap<Integer, V> map = new BPlusTreeMap<>(pageManager, comparator, keyManager, valueManager);
map.putAll(values);
return map;
}
use of org.springframework.util.comparator.ComparableComparator in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newIntSeralizableTempDisk.
public static <V> Map<Integer, V> newIntSeralizableTempDisk() {
final File file = FileUtil.newTempFile("int", ".btree");
final PageManager pageManager = new FilePageManager(file);
final PageValueManager<Integer> keyManager = PageValueManager.INT;
final SerializablePageValueManager<V> valueSerializer = new SerializablePageValueManager<>();
final PageValueManager<V> valueManager = BPlusTreePageValueManager.newPageValueManager(pageManager, valueSerializer);
final Comparator<Integer> comparator = new ComparableComparator<>();
return new BPlusTreeMap<>(pageManager, comparator, keyManager, valueManager);
}
use of org.springframework.util.comparator.ComparableComparator in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newTempDisk.
public static <K extends Comparable<K>, V> Map<K, V> newTempDisk(PageValueManager<K> keyManager, PageValueManager<V> valueManager) {
final File file = FileUtil.newTempFile("temp", ".bplustree");
final PageManager pageManager = new FileMappedPageManager(file);
if (keyManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<K> serializeableManager = (SerializablePageValueManager<K>) keyManager;
keyManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
if (valueManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<V> serializeableManager = (SerializablePageValueManager<V>) valueManager;
valueManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
final Comparator<K> comparator = new ComparableComparator<>();
final BPlusTreeMap<K, V> map = new BPlusTreeMap<>(pageManager, comparator, keyManager, valueManager);
return map;
}
Aggregations