public PersistentSortedMap newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(true, null); snapshot.readInitializationData(in); if (!snapshot.isInitialized()) return new PersistentSortedMap(null); Comparator<? super Object> comparator = snapshot.newComparator(in); return new PersistentSortedMap(null, new TreeMap<Object, Object>(comparator)); } }
public PersistentSortedSet newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(true, null); snapshot.readInitializationData(in); if (!snapshot.isInitialized()) return new PersistentSortedSet(null); Comparator<? super Object> comparator = snapshot.newComparator(in); return new PersistentSortedSet(null, new TreeSet<Object>(comparator)); } }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super E> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedSet<E> set = new TreeSet<E>(comparator); set.addAll((Collection<? extends E>)snapshot.getElementsAsCollection()); init(set, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super K> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedMap<K, V> map = new TreeMap<K, V>(comparator); map.putAll((Map<K, V>)snapshot.getElementsAsMap()); init(map, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super K> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedMap<K, V> map = new TreeMap<K, V>(comparator); map.putAll((Map<K, V>)snapshot.getElementsAsMap()); init(map, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super K> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedMap<K, V> map = new TreeMap<K, V>(comparator); map.putAll((Map<K, V>)snapshot.getElementsAsMap()); init(map, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super E> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedSet<E> set = new TreeSet<E>(comparator); set.addAll((Collection<? extends E>)snapshot.getElementsAsCollection()); init(set, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) { Comparator<? super E> comparator = null; try { comparator = snapshot.newComparator(in); } catch (Exception e) { throw new RuntimeException("Could not create instance of comparator", e); } SortedSet<E> set = new TreeSet<E>(comparator); set.addAll((Collection<? extends E>)snapshot.getElementsAsCollection()); init(set, snapshot.getDetachedState(), snapshot.isDirty()); } else init(null, snapshot.getDetachedState(), false); }