Ticket #2430: 2430_im_fi.patch
File 2430_im_fi.patch, 28.1 KB (added by stefan, 15 years ago) |
---|
-
modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmHashingTreePerformanceTest.java
### Eclipse Workspace Patch 1.0 #P sophie
3 3 import java.util.Random; 4 4 5 5 import org.junit.Test; 6 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 6 7 import org.sophie2.core.logging.SophieLog; 7 8 import org.sophie2.core.testing.TestBase; 8 9 … … 18 19 */ 19 20 @Test 20 21 public void testHashing() { 21 ImmHashingTree<String> ht = new ImmHashingTree<String>(); 22 ImmTreeList<String> tl = new ImmTreeList<String>(ht); 22 ImmTreeList<String> tl = AccessCreateCollectionUtil.<String>createHashingImmList(); 23 23 final int ITERATIONS = 100000; 24 24 final int ITER_DATA = 10000; 25 25 -
modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/old/OldImmHotTextPersister.java
4 4 5 5 import org.sophie2.base.commons.structures.ImmHashingTree; 6 6 import org.sophie2.base.commons.structures.ImmTreeMap; 7 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 7 8 import org.sophie2.base.commons.util.ImmMap; 8 9 import org.sophie2.base.commons.util.ImmMap.ImmEntry; 9 10 import org.sophie2.base.model.text.Attachment; … … 57 58 MasterPersister.persist(styleMapRef, target.child(STYLE_VALUES_CHILD), 58 59 options, PersistenceUtil.getStorageR3Schema(ImmTreeMap.class)); 59 60 60 ImmMap<HotAttr<?>, OldStyleValueSet<?>> textStyleSet = new ImmTreeMap<HotAttr<?>, OldStyleValueSet<?>>( 61 new ImmHashingTree<ImmEntry<HotAttr<?>, OldStyleValueSet<?>>>(), OldImmHotText.getAttrComparator()); 61 ImmMap<HotAttr<?>, OldStyleValueSet<?>> textStyleSet = AccessCreateCollectionUtil.<HotAttr<?>, OldStyleValueSet<?>> createHashingImmMap(OldImmHotText.getAttrComparator()); 62 62 63 63 OldImmHotText hotText = OldImmHotText.createPlain(textString); 64 64 -
modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmEqualityTest.java
1 1 package org.sophie2.base.commons.structures; 2 2 3 3 import org.junit.Test; 4 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 4 5 import org.sophie2.core.logging.SophieLog; 5 6 import org.sophie2.core.testing.TestBase; 6 7 … … 30 31 */ 31 32 @Test 32 33 public void testEqualHashCollection() { 33 ImmTreeList<String> list1 = new ImmTreeList<String>(new ImmHashingTree<String>());34 ImmTreeList<String> list2 = new ImmTreeList<String>(new ImmHashingTree<String>());34 ImmTreeList<String> list1 = AccessCreateCollectionUtil.<String>createHashingImmList(); 35 ImmTreeList<String> list2 = AccessCreateCollectionUtil.<String>createHashingImmList(); 35 36 assertTrue(list1.equals(list2)); 36 37 list1 = list1.add(new String("1")); 37 38 list2 = list2.add(new String("1")); … … 44 45 */ 45 46 @Test 46 47 public void testEqualHashColision() { 47 ImmTreeList<Object> list1 = new ImmTreeList<Object>(new ImmHashingTree<Object>());48 ImmTreeList<Object> list2 = new ImmTreeList<Object>(new ImmHashingTree<Object>());48 ImmTreeList<Object> list1 = AccessCreateCollectionUtil.<Object>createHashingImmList(); 49 ImmTreeList<Object> list2 = AccessCreateCollectionUtil.<Object>createHashingImmList(); 49 50 assertTrue(list1.equals(list2)); 50 51 list1 = list1.add(new Integer(1)); 51 52 list2 = list2.add(new Long(1L)); … … 58 59 */ 59 60 @Test 60 61 public void testEqualHashList() { 61 ImmTreeList<Object> list1 = new ImmTreeList<Object>(new ImmHashingTree<Object>());62 ImmTreeList<Object> list2 = new ImmTreeList<Object>(new ImmHashingTree<Object>());62 ImmTreeList<Object> list1 = AccessCreateCollectionUtil.<Object>createHashingImmList(); 63 ImmTreeList<Object> list2 = AccessCreateCollectionUtil.<Object>createHashingImmList(); 63 64 assertTrue(list1.equals(list2)); 64 65 list1 = list1.add(new Integer(1)); 65 66 list1 = list1.add(0, 2); -
modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/util/AccessCreateCollectionUtil.java
1 package org.sophie2.base.commons.util; 2 3 import java.util.Collection; 4 import java.util.Comparator; 5 6 import org.sophie2.base.commons.structures.ImmDosTree; 7 import org.sophie2.base.commons.structures.ImmHashingTree; 8 import org.sophie2.base.commons.structures.ImmTreeList; 9 import org.sophie2.base.commons.structures.ImmTreeMap; 10 import org.sophie2.base.commons.structures.ImmTreeSet; 11 import org.sophie2.base.commons.util.ImmMap.ImmEntry; 12 13 /** 14 * Utility class that contains methods which are {@link ImmCollection} related. 15 * Purpose of this class is, all of the "slow" methods that are related to 16 * Sophies's immutable collections to be gathered in one place. 17 * 18 * @author stefan 19 * 20 */ 21 public class AccessCreateCollectionUtil { 22 /** 23 * Factory method for creating empty {@link ImmTreeList}. 24 * 25 * @param <E> 26 * Type of the list. 27 * 28 * @return Empty {@link ImmTreeList}. 29 */ 30 public static <E> ImmTreeList<E> createDosImmList() { 31 return ImmTreeList.empty(); 32 } 33 34 /** 35 * Factory method for creating empty {@link ImmTreeSet}. 36 * 37 * @param <E> 38 * Type of the set's elements. 39 * 40 * @return Empty {@link ImmTreeSet}. 41 */ 42 public static <E> ImmTreeSet<E> createDosImmSet() { 43 return ImmTreeSet.empty(); 44 } 45 46 /** 47 * Factory method for creating empty {@link ImmTreeMap}. 48 * 49 * @param <K> 50 * Type of the map's key. 51 * @param <V> 52 * Type of the map's value. 53 * 54 * @return Empty {@link ImmTreeMap}. 55 */ 56 public static <K, V> ImmTreeMap<K, V> createDosImmMap() { 57 return ImmTreeMap.empty(); 58 } 59 60 /** 61 * Factory method for creating empty hashing {@link ImmTreeList}. 62 * 63 * @param <E> 64 * Type of the list's elements. 65 * 66 * @return Empty hashing {@link ImmTreeList}. 67 */ 68 public static <E> ImmTreeList<E> createHashingImmList() { 69 return new ImmTreeList<E>(new ImmHashingTree<E>()); 70 } 71 72 /** 73 * Factory method for creating empty hashing {@link ImmTreeSet}. 74 * 75 * @param <E> 76 * Type of the set's elements. 77 * 78 * @return Empty hashing {@link ImmTreeSet}. 79 */ 80 public static <E> ImmTreeSet<E> createHashingImmSet() { 81 return new ImmTreeSet<E>(new ImmHashingTree<E>()); 82 } 83 84 /** 85 * Factory method for creating empty {@link ImmTreeSet}. 86 * 87 * @param <K> 88 * Type of the map's key. 89 * @param <V> 90 * Type of the map's value. 91 * 92 * @return Empty hashing {@link ImmTreeMap}. 93 */ 94 public static <K, V> ImmTreeMap<K, V> createHashingImmMap() { 95 return new ImmTreeMap<K, V>(new ImmHashingTree<ImmEntry<K, V>>()); 96 } 97 98 /** 99 * Factory method for creating empty {@link ImmTreeSet} with specific 100 * comparator. 101 * 102 * @param <K> 103 * Type of the map's key. 104 * @param <V> 105 * Type of the map's value. 106 * @param comparator 107 * a key comparator. 108 * @return Empty hashing {@link ImmTreeMap}. 109 */ 110 public static <K, V> ImmTreeMap<K, V> createHashingImmMap(Comparator<K> comparator) { 111 return new ImmTreeMap<K, V>(new ImmHashingTree<ImmEntry<K, V>>(), comparator); 112 } 113 114 /** 115 * Factory method for creating empty {@link ImmTreeMap}. 116 * 117 * @param <K> 118 * Type of the map's key. 119 * @param <V> 120 * Type of the map's value. 121 * @param comparator 122 * a key comparator 123 * @return Empty {@link ImmTreeMap}. 124 */ 125 public static <K, V> ImmTreeMap<K, V> createDosImmMap(Comparator<K> comparator) { 126 return new ImmTreeMap<K, V>(ImmDosTree.<ImmEntry<K, V>> empty(), comparator); 127 } 128 129 /** 130 * Utility method for accessing index of a specific element. Returns first 131 * appearance of the element. 132 * 133 * @param <E> 134 * type of the element of the collection. 135 * @param collection 136 * the {@link ImmCollection}. 137 * @param element 138 * the element that we need index of. 139 * @return the index of the element, -1 if it doesn't occur in the 140 * collection. 141 */ 142 public static <E> int indexOf(ImmCollection<E> collection, E element) { 143 int i = 0; 144 for (E e : collection) { 145 if (element.equals(e)) { 146 return i; 147 } 148 i++; 149 } 150 return -1; 151 } 152 153 /** 154 * Create {@link ImmList} out of JCF {@link Collection}. 155 * 156 * @param <E> 157 * type of the element. 158 * @param collection 159 * the collection of which list will be constructed. 160 * @param hashing 161 * flag for choosing whether list should be hashing or not. 162 * @return {@link ImmList} constructed by given {@link Collection} 163 */ 164 public static <E> ImmList<E> createImmListOfCollection(Collection<E> collection, boolean hashing) { 165 ImmTreeList<E> list; 166 if (hashing) { 167 list = createHashingImmList(); 168 } else { 169 list = createDosImmList(); 170 } 171 172 for (E e : collection) { 173 list = list.add(e); 174 } 175 return list; 176 } 177 178 /** 179 * Create {@link ImmSet} out of JCF {@link Collection}. 180 * 181 * @param <E> 182 * type of the element. 183 * @param collection 184 * the collection of which set will be constructed. 185 * @param hashing 186 * flag for choosing whether list should be hashing or not. 187 * @return {@link ImmList} constructed by given {@link Collection} 188 */ 189 public static <E> ImmSet<E> createImmSetOfCollection(Collection<E> collection, boolean hashing) { 190 ImmSet<E> set; 191 if (hashing) { 192 set = createHashingImmSet(); 193 } else { 194 set = createDosImmSet(); 195 } 196 197 for (E e : collection) { 198 set = set.put(e); 199 } 200 return set; 201 } 202 203 } -
modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/StickyTextModel.java
1 1 package org.sophie2.extra.func.annotations.view; 2 2 3 import org.sophie2.base.commons.structures.ImmDosTree;4 3 import org.sophie2.base.commons.structures.ImmTreeList; 4 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 5 5 import org.sophie2.base.commons.util.ImmList; 6 6 import org.sophie2.base.commons.util.position.ImmArea; 7 7 import org.sophie2.base.commons.util.position.ImmRect; … … 41 41 42 42 @Override 43 43 public ImmList<ImmArea> getAreas() { 44 ImmList<ImmArea> areas = new ImmTreeList<ImmArea>( 45 new ImmDosTree<ImmArea>()); 44 ImmList<ImmArea> areas = AccessCreateCollectionUtil.<ImmArea>createDosImmList(); 46 45 47 46 if (this.textView.parent().get() == null) { 48 47 return areas; -
modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmStructuresTest.java
3 3 import java.util.Random; 4 4 5 5 import org.junit.Test; 6 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 6 7 import org.sophie2.base.commons.util.ImmList; 7 8 import org.sophie2.base.commons.util.ImmSet; 8 9 import org.sophie2.base.commons.util.ImmMap.ImmEntry; … … 24 25 System.out.println(); 25 26 26 27 String lastInsert = "Last_Inserted_Elem_13"; 27 ImmSet<String> set = new ImmTreeSet<String>(new ImmDosTree<String>());28 ImmSet<String> set = AccessCreateCollectionUtil.<String> createDosImmSet(); 28 29 29 30 int next = 1; 30 31 for (int i = 0; i < 20; i++) { … … 75 76 System.out.println(); 76 77 77 78 String lastInsert = "Last_Inserted_Elem_13"; 78 ImmList<String> list = new ImmTreeList<String>(new ImmDosTree<String>());79 ImmList<String> list = AccessCreateCollectionUtil.<String>createDosImmList(); 79 80 80 81 int next = 0; 81 82 for (int i = 0; i < 20; i++) { -
modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/skin/IconsSet.java
3 3 import java.util.HashMap; 4 4 import java.util.Map; 5 5 6 import org.sophie2.base.commons.structures.ImmDosTree; 7 import org.sophie2.base.commons.structures.ImmTreeMap; 6 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 8 7 import org.sophie2.base.commons.util.ImmImage; 9 8 import org.sophie2.base.commons.util.ImmMap; 10 9 import org.sophie2.base.commons.util.ImmMap.ImmEntry; … … 25 24 * Constructor. 26 25 */ 27 26 public IconsSet() { 28 this.icons = new ImmTreeMap<IconId, ImmImage>( 29 new ImmDosTree<ImmEntry<IconId, ImmImage>>()); 27 this.icons = AccessCreateCollectionUtil.<IconId, ImmImage> createDosImmMap(); 30 28 } 31 29 32 30 /** -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/rtf/ApplyRtfStylesUtility.java
11 11 import javax.swing.text.BadLocationException; 12 12 import javax.swing.text.Element; 13 13 14 import org.sophie2.base.commons.structures.ImmDosTree; 15 import org.sophie2.base.commons.structures.ImmTreeMap; 14 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 16 15 import org.sophie2.base.commons.util.ImmColor; 17 16 import org.sophie2.base.commons.util.ImmMap; 18 import org.sophie2.base.commons.util.ImmMap.ImmEntry;19 17 import org.sophie2.base.model.text.HotAttr; 20 18 import org.sophie2.base.model.text.elements.CommonAttr; 21 19 import org.sophie2.base.model.text.elements.TextAlign; 22 import org.sophie2.base.model.text.model.ImmTextInterval;23 20 import org.sophie2.base.model.text.model.ImmHotText; 24 21 import org.sophie2.base.model.text.model.ImmText; 22 import org.sophie2.base.model.text.model.ImmTextInterval; 25 23 import org.sophie2.base.model.text.model.ImmTextUtils; 26 24 import org.sophie2.base.model.text.style.HotStyleDef; 27 25 import org.sophie2.main.app.commons.util.AttributedPair; … … 40 38 * The default constructor 41 39 */ 42 40 public ApplyRtfStylesUtility() { 43 this.rtfMap = new ImmTreeMap<String, HotAttr<?>>( 44 new ImmDosTree<ImmEntry<String, HotAttr<?>>>()); 41 this.rtfMap = AccessCreateCollectionUtil.<String, HotAttr<?>> createDosImmMap(); 45 42 this.rtfMap = this.rtfMap.put("size", CommonAttr.FONT_SIZE); 46 43 this.rtfMap = this.rtfMap.put("LeftIndent", CommonAttr.PARA_LEFT_INDENT); 47 44 this.rtfMap = this.rtfMap.put("RightIndent", CommonAttr.PARA_RIGHT_INDENT); -
modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/old/OldImmHotText.java
3 3 import java.text.AttributedString; 4 4 import java.util.Comparator; 5 5 6 import org.sophie2.base.commons.structures.ImmHashingTree;7 6 import org.sophie2.base.commons.structures.ImmTreeList; 8 import org.sophie2.base.commons. structures.ImmTreeMap;7 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 9 8 import org.sophie2.base.commons.util.ImmList; 10 9 import org.sophie2.base.commons.util.ImmMap; 11 import org.sophie2.base.commons.util.ImmMap.ImmEntry;12 10 import org.sophie2.base.model.text.Attachment; 13 11 import org.sophie2.base.model.text.HotAttr; 14 12 import org.sophie2.core.prolib.annot.Immutable; … … 30 28 private final ElemOp lastOperation; 31 29 private final OldIndexInterval subSingleInterval; 32 30 33 private ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues = new ImmTreeMap<HotAttr<?>, OldStyleValueSet<?>>(34 new ImmHashingTree<ImmEntry<HotAttr<?>, OldStyleValueSet<?>>>(),getAttrComparator());31 private ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues = AccessCreateCollectionUtil 32 .<HotAttr<?>, OldStyleValueSet<?>> createHashingImmMap(getAttrComparator()); 35 33 36 private ImmMap<OldHotInterval, Attachment> attachments = new ImmTreeMap<OldHotInterval, Attachment>( 37 new ImmHashingTree<ImmEntry<OldHotInterval, Attachment>>(), getIntervalComparator()); 34 private ImmMap<OldHotInterval, Attachment> attachments = AccessCreateCollectionUtil.<OldHotInterval, Attachment> createHashingImmMap(getIntervalComparator()); 38 35 39 36 // Constructors. For internal use only. 40 37 // Factory methods should be used for creation of text … … 63 60 private OldImmHotText(String text, OldHotStyleDef style) { 64 61 assert text != null : "Text must be not null."; 65 62 66 this.chars = new ImmTreeList<Character>(new ImmHashingTree<Character>());63 this.chars = AccessCreateCollectionUtil.<Character>createHashingImmList(); 67 64 68 65 for (char ch : text.toCharArray()) { 69 66 this.chars = this.chars.add(this.chars.size(), ch); … … 119 116 */ 120 117 static OldImmHotText create(String text, ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues, 121 118 ImmMap<OldHotInterval, Attachment> attachments, OldHotInterval lastChangedInterval, long uid) { 122 ImmTreeList<Character> immText = new ImmTreeList<Character>(new ImmHashingTree<Character>());119 ImmTreeList<Character> immText = AccessCreateCollectionUtil.<Character>createHashingImmList(); 123 120 for (char ch : text.toCharArray()) { 124 121 immText = immText.add(ch); 125 122 } -
modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/old/OldHotStyleDef.java
4 4 import java.util.HashMap; 5 5 import java.util.Map; 6 6 7 import org.sophie2.base.commons.structures.ImmDosTree; 8 import org.sophie2.base.commons.structures.ImmTreeList; 7 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 9 8 import org.sophie2.base.commons.util.ImmList; 10 9 import org.sophie2.base.model.text.HotAttr; 11 10 import org.sophie2.core.prolib.annot.Immutable; … … 50 49 * The style's attributes. 51 50 */ 52 51 public ImmList<HotAttr<?>> getAttributeKeys() { 53 ImmList<HotAttr<?>> keys = new ImmTreeList<HotAttr<?>>(new ImmDosTree<HotAttr<?>>());52 ImmList<HotAttr<?>> keys = AccessCreateCollectionUtil.<HotAttr<?>>createDosImmList(); 54 53 for (HotAttr<?> attr : this.attrValues.keySet()) { 55 54 keys = keys.add(attr); 56 55 } -
modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/style/StyleValueSet.java
3 3 */ 4 4 package org.sophie2.base.model.text.style; 5 5 6 import org.sophie2.base.commons.structures.ImmHashingTree;7 6 import org.sophie2.base.commons.structures.ImmTreeSet; 8 7 import org.sophie2.base.commons.util.Hash; 9 8 import org.sophie2.base.commons.util.Hashable; 10 9 import org.sophie2.base.commons.util.Hasher; 10 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 11 11 import org.sophie2.base.commons.util.ImmSet; 12 12 import org.sophie2.base.model.text.HotAttr; 13 13 import org.sophie2.core.prolib.annot.Immutable; … … 31 31 private ImmSet<HotStyleValue<T>> set; 32 32 33 33 private StyleValueSet(HotAttr<T> attr) { 34 ImmHashingTree<HotStyleValue<T>> ht = new ImmHashingTree<HotStyleValue<T>>(); 35 36 this.set = new ImmTreeSet<HotStyleValue<T>>(ht); 34 this.set = AccessCreateCollectionUtil.<HotStyleValue<T>> createHashingImmSet(); 37 35 this.attr = attr; 38 36 } 39 37 -
modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmDosAndHashingTreeTest.java
8 8 import org.sophie2.base.commons.structures.ImmDosTree.Node; 9 9 import org.sophie2.base.commons.structures.ImmHashingTree.HashingNode; 10 10 import org.sophie2.base.commons.util.Hasher; 11 import org.sophie2.base.commons.util. ImmMap.ImmEntry;11 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 12 12 import org.sophie2.core.logging.SophieLog; 13 13 import org.sophie2.core.testing.TestBase; 14 14 … … 102 102 */ 103 103 @Test 104 104 public void testDeletingLast() throws Exception { 105 ImmTreeMap<Integer, String> tm = new ImmTreeMap<Integer, String>(new ImmHashingTree<ImmEntry<Integer, String>>());105 ImmTreeMap<Integer, String> tm = AccessCreateCollectionUtil.<Integer, String> createHashingImmMap(); 106 106 int next = 0; 107 107 String element = String.format("Element %d", next); 108 108 tm = tm.put(next, element); -
modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/util/ApplyHtmlStylesUtility.java
12 12 13 13 import org.sophie2.base.commons.structures.ImmDosTree; 14 14 import org.sophie2.base.commons.structures.ImmTreeMap; 15 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 15 16 import org.sophie2.base.commons.util.ImmColor; 16 17 import org.sophie2.base.commons.util.ImmMap; 17 18 import org.sophie2.base.commons.util.ImmMap.ImmEntry; … … 38 39 * The default constructor; 39 40 */ 40 41 public ApplyHtmlStylesUtility() { 41 this.htmlMap = new ImmTreeMap<String, HotAttr<?>>( 42 new ImmDosTree<ImmEntry<String, HotAttr<?>>>()); 42 this.htmlMap = AccessCreateCollectionUtil.<String, HotAttr<?>> createDosImmMap(); 43 43 this.htmlMap = this.htmlMap.put("font-size", CommonAttr.FONT_SIZE); 44 44 this.htmlMap = this.htmlMap.put("margin-left", CommonAttr.PARA_LEFT_INDENT); 45 45 this.htmlMap = this.htmlMap.put("margin-right", CommonAttr.PARA_RIGHT_INDENT); -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/immutables/ImmTreeMapPersisterTest.java
2 2 3 3 import javax.swing.SwingUtilities; 4 4 5 import org.sophie2.base.commons.structures.ImmDosTree;6 5 import org.sophie2.base.commons.structures.ImmTreeMap; 6 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 7 7 import org.sophie2.base.commons.util.ImmList; 8 8 import org.sophie2.base.commons.util.ImmMap; 9 9 import org.sophie2.base.commons.util.NaiveImmList; … … 49 49 * @throws Exception 50 50 */ 51 51 public void testPersistence() throws Exception { 52 final ImmTreeMap<String, ImmList<String>> testMap = new ImmTreeMap<String, ImmList<String>>( 53 new ImmDosTree<ImmMap.ImmEntry<String, ImmList<String>>>()); 52 final ImmTreeMap<String, ImmList<String>> testMap = AccessCreateCollectionUtil.<String, ImmList<String>> createDosImmMap(); 54 53 testMap.put("testKey", NaiveImmList.<String> create("testValueItem 1", 55 54 "testValue 2")); 56 55 Storage storage = new Storage(); -
modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/util/ImmImage.java
31 31 import javax.swing.Icon; 32 32 import javax.swing.ImageIcon; 33 33 34 import org.sophie2.base.commons.structures.ImmHashingTree;35 import org.sophie2.base.commons.structures.ImmTreeMap;36 import org.sophie2.base.commons.util.ImmMap.ImmEntry;37 34 import org.sophie2.base.commons.util.bindata.BinData; 38 35 import org.sophie2.base.commons.util.bindata.BinDataReferrer; 39 36 import org.sophie2.base.commons.util.bindata.FileBinData; … … 486 483 } 487 484 } 488 485 489 private ImmMap<ImageHolder, ImmImage> imageMap = new ImmTreeMap<ImageHolder, ImmImage>( 490 new ImmHashingTree<ImmEntry<ImageHolder, ImmImage>>(), getImmHolderComparator()); 486 private ImmMap<ImageHolder, ImmImage> imageMap = AccessCreateCollectionUtil.<ImageHolder, ImmImage> createHashingImmMap(getImmHolderComparator()); 491 487 492 488 private Comparator<ImageHolder> getImmHolderComparator() { 493 489 return new Comparator<ImageHolder>() { -
modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/style/HotStyleDef.java
4 4 import java.util.Iterator; 5 5 import java.util.Map; 6 6 7 import org.sophie2.base.commons.structures.ImmDosTree;8 import org.sophie2.base.commons.structures.ImmTreeList;9 7 import org.sophie2.base.commons.structures.ImmTreeMap; 10 8 import org.sophie2.base.commons.util.Hash; 11 9 import org.sophie2.base.commons.util.Hashable; 12 10 import org.sophie2.base.commons.util.Hasher; 11 import org.sophie2.base.commons.util.AccessCreateCollectionUtil; 13 12 import org.sophie2.base.commons.util.ImmList; 14 13 import org.sophie2.base.commons.util.ImmMap; 15 14 import org.sophie2.base.commons.util.ImmMap.ImmEntry; … … 93 92 * The style's attributes. 94 93 */ 95 94 public ImmList<HotAttr<?>> getAttributeKeys() { 96 ImmList<HotAttr<?>> keys = new ImmTreeList<HotAttr<?>>(new ImmDosTree<HotAttr<?>>());95 ImmList<HotAttr<?>> keys = AccessCreateCollectionUtil.<HotAttr<?>>createDosImmList(); 97 96 for (ImmEntry<HotAttr<?>, Object> entry : this.attrValues.asList()) { 98 97 keys = keys.add(entry.getKey()); 99 98 }