Ticket #2430: 2430_de_fi.patch

File 2430_de_fi.patch, 27.9 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
     
    33import java.util.Random; 
    44 
    55import org.junit.Test; 
     6import org.sophie2.base.commons.util.ImmCollectionUtil; 
    67import org.sophie2.core.logging.SophieLog; 
    78import org.sophie2.core.testing.TestBase; 
    89 
     
    1819         */ 
    1920        @Test 
    2021        public void testHashing() { 
    21                 ImmHashingTree<String> ht = new ImmHashingTree<String>(); 
    22                 ImmTreeList<String> tl = new ImmTreeList<String>(ht); 
     22                ImmTreeList<String> tl = ImmCollectionUtil.<String>createHashingImmList(); 
    2323                final int ITERATIONS = 100000; 
    2424                final int ITER_DATA = 10000; 
    2525                 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/old/OldImmHotTextPersister.java

     
    44 
    55import org.sophie2.base.commons.structures.ImmHashingTree; 
    66import org.sophie2.base.commons.structures.ImmTreeMap; 
     7import org.sophie2.base.commons.util.ImmCollectionUtil; 
    78import org.sophie2.base.commons.util.ImmMap; 
    89import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
    910import org.sophie2.base.model.text.Attachment; 
     
    5758                MasterPersister.persist(styleMapRef, target.child(STYLE_VALUES_CHILD),  
    5859                                options, PersistenceUtil.getStorageR3Schema(ImmTreeMap.class)); 
    5960 
    60                 ImmMap<HotAttr<?>, OldStyleValueSet<?>> textStyleSet = new ImmTreeMap<HotAttr<?>, OldStyleValueSet<?>>( 
    61                                 new ImmHashingTree<ImmEntry<HotAttr<?>, OldStyleValueSet<?>>>(), OldImmHotText.getAttrComparator()); 
     61                ImmMap<HotAttr<?>, OldStyleValueSet<?>> textStyleSet = ImmCollectionUtil.<HotAttr<?>, OldStyleValueSet<?>> createHashingImmMap(OldImmHotText.getAttrComparator()); 
    6262 
    6363                OldImmHotText hotText = OldImmHotText.createPlain(textString); 
    6464 
  • modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmEqualityTest.java

     
    11package org.sophie2.base.commons.structures; 
    22 
    33import org.junit.Test; 
     4import org.sophie2.base.commons.util.ImmCollectionUtil; 
    45import org.sophie2.core.logging.SophieLog; 
    56import org.sophie2.core.testing.TestBase; 
    67 
     
    3031         */ 
    3132        @Test 
    3233        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 = ImmCollectionUtil.<String>createHashingImmList(); 
     35                ImmTreeList<String> list2 = ImmCollectionUtil.<String>createHashingImmList(); 
    3536                assertTrue(list1.equals(list2)); 
    3637                list1 = list1.add(new String("1")); 
    3738                list2 = list2.add(new String("1")); 
     
    4445         */ 
    4546        @Test 
    4647        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 = ImmCollectionUtil.<Object>createHashingImmList(); 
     49                ImmTreeList<Object> list2 = ImmCollectionUtil.<Object>createHashingImmList(); 
    4950                assertTrue(list1.equals(list2)); 
    5051                list1 = list1.add(new Integer(1)); 
    5152                list2 = list2.add(new Long(1L)); 
     
    5859         */ 
    5960        @Test 
    6061        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 = ImmCollectionUtil.<Object>createHashingImmList(); 
     63                ImmTreeList<Object> list2 = ImmCollectionUtil.<Object>createHashingImmList(); 
    6364                assertTrue(list1.equals(list2)); 
    6465                list1 = list1.add(new Integer(1)); 
    6566                list1 = list1.add(0, 2); 
  • modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/StickyTextModel.java

     
    11package org.sophie2.extra.func.annotations.view; 
    22 
    3 import org.sophie2.base.commons.structures.ImmDosTree; 
    43import org.sophie2.base.commons.structures.ImmTreeList; 
     4import org.sophie2.base.commons.util.ImmCollectionUtil; 
    55import org.sophie2.base.commons.util.ImmList; 
    66import org.sophie2.base.commons.util.position.ImmArea; 
    77import org.sophie2.base.commons.util.position.ImmRect; 
     
    4141 
    4242        @Override 
    4343        public ImmList<ImmArea> getAreas() { 
    44                 ImmList<ImmArea> areas = new ImmTreeList<ImmArea>( 
    45                                 new ImmDosTree<ImmArea>()); 
     44                ImmList<ImmArea> areas = ImmCollectionUtil.<ImmArea>createDosImmList(); 
    4645 
    4746                if (this.textView.parent().get() == null) { 
    4847                        return areas;  
  • modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmStructuresTest.java

     
    33import java.util.Random; 
    44 
    55import org.junit.Test; 
     6import org.sophie2.base.commons.util.ImmCollectionUtil; 
    67import org.sophie2.base.commons.util.ImmList; 
    78import org.sophie2.base.commons.util.ImmSet; 
    89import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
     
    2425                System.out.println(); 
    2526                 
    2627                String lastInsert = "Last_Inserted_Elem_13"; 
    27                 ImmSet<String> set = new ImmTreeSet<String>(new ImmDosTree<String>()); 
     28                ImmSet<String> set = ImmCollectionUtil.<String> createDosImmSet(); 
    2829                 
    2930                int next = 1;  
    3031                for (int i = 0; i < 20; i++) { 
     
    7576                System.out.println(); 
    7677                 
    7778                String lastInsert = "Last_Inserted_Elem_13"; 
    78                 ImmList<String> list = new ImmTreeList<String>(new ImmDosTree<String>()); 
     79                ImmList<String> list = ImmCollectionUtil.<String>createDosImmList(); 
    7980                 
    8081                int next = 0;  
    8182                for (int i = 0; i < 20; i++) { 
  • modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/skin/IconsSet.java

     
    33import java.util.HashMap; 
    44import java.util.Map; 
    55 
    6 import org.sophie2.base.commons.structures.ImmDosTree; 
    7 import org.sophie2.base.commons.structures.ImmTreeMap; 
     6import org.sophie2.base.commons.util.ImmCollectionUtil; 
    87import org.sophie2.base.commons.util.ImmImage; 
    98import org.sophie2.base.commons.util.ImmMap; 
    109import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
     
    2524         * Constructor. 
    2625         */ 
    2726        public IconsSet() { 
    28                 this.icons = new ImmTreeMap<IconId, ImmImage>( 
    29                                 new ImmDosTree<ImmEntry<IconId, ImmImage>>()); 
     27                this.icons = ImmCollectionUtil.<IconId, ImmImage> createDosImmMap(); 
    3028        } 
    3129 
    3230        /** 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/rtf/ApplyRtfStylesUtility.java

     
    1111import javax.swing.text.BadLocationException; 
    1212import javax.swing.text.Element; 
    1313 
    14 import org.sophie2.base.commons.structures.ImmDosTree; 
    15 import org.sophie2.base.commons.structures.ImmTreeMap; 
     14import org.sophie2.base.commons.util.ImmCollectionUtil; 
    1615import org.sophie2.base.commons.util.ImmColor; 
    1716import org.sophie2.base.commons.util.ImmMap; 
    18 import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
    1917import org.sophie2.base.model.text.HotAttr; 
    2018import org.sophie2.base.model.text.elements.CommonAttr; 
    2119import org.sophie2.base.model.text.elements.TextAlign; 
    22 import org.sophie2.base.model.text.model.ImmTextInterval; 
    2320import org.sophie2.base.model.text.model.ImmHotText; 
    2421import org.sophie2.base.model.text.model.ImmText; 
     22import org.sophie2.base.model.text.model.ImmTextInterval; 
    2523import org.sophie2.base.model.text.model.ImmTextUtils; 
    2624import org.sophie2.base.model.text.style.HotStyleDef; 
    2725import org.sophie2.main.app.commons.util.AttributedPair; 
     
    4038         * The default constructor 
    4139         */ 
    4240        public ApplyRtfStylesUtility() { 
    43                 this.rtfMap = new ImmTreeMap<String, HotAttr<?>>( 
    44                                 new ImmDosTree<ImmEntry<String, HotAttr<?>>>()); 
     41                this.rtfMap = ImmCollectionUtil.<String, HotAttr<?>> createDosImmMap(); 
    4542                this.rtfMap = this.rtfMap.put("size", CommonAttr.FONT_SIZE); 
    4643                this.rtfMap = this.rtfMap.put("LeftIndent", CommonAttr.PARA_LEFT_INDENT); 
    4744                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

     
    33import java.text.AttributedString; 
    44import java.util.Comparator; 
    55 
    6 import org.sophie2.base.commons.structures.ImmHashingTree; 
    76import org.sophie2.base.commons.structures.ImmTreeList; 
    8 import org.sophie2.base.commons.structures.ImmTreeMap; 
     7import org.sophie2.base.commons.util.ImmCollectionUtil; 
    98import org.sophie2.base.commons.util.ImmList; 
    109import org.sophie2.base.commons.util.ImmMap; 
    11 import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
    1210import org.sophie2.base.model.text.Attachment; 
    1311import org.sophie2.base.model.text.HotAttr; 
    1412import org.sophie2.core.prolib.annot.Immutable; 
     
    3028        private final ElemOp lastOperation; 
    3129        private final OldIndexInterval subSingleInterval;  
    3230 
    33         private ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues = new ImmTreeMap<HotAttr<?>, OldStyleValueSet<?>>( 
    34                         new ImmHashingTree<ImmEntry<HotAttr<?>, OldStyleValueSet<?>>>(), getAttrComparator()); 
     31        private ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues = ImmCollectionUtil 
     32                        .<HotAttr<?>, OldStyleValueSet<?>> createHashingImmMap(getAttrComparator()); 
    3533 
    36         private ImmMap<OldHotInterval, Attachment> attachments = new ImmTreeMap<OldHotInterval, Attachment>( 
    37                         new ImmHashingTree<ImmEntry<OldHotInterval, Attachment>>(), getIntervalComparator()); 
     34        private ImmMap<OldHotInterval, Attachment> attachments = ImmCollectionUtil.<OldHotInterval, Attachment> createHashingImmMap(getIntervalComparator()); 
    3835 
    3936        // Constructors. For internal use only. 
    4037        // Factory methods should be used for creation of text  
     
    6360        private OldImmHotText(String text, OldHotStyleDef style) { 
    6461                assert text != null : "Text must be not null."; 
    6562 
    66                 this.chars = new ImmTreeList<Character>(new ImmHashingTree<Character>()); 
     63                this.chars = ImmCollectionUtil.<Character>createHashingImmList(); 
    6764 
    6865                for (char ch : text.toCharArray()) { 
    6966                        this.chars = this.chars.add(this.chars.size(), ch); 
     
    119116         */ 
    120117        static OldImmHotText create(String text, ImmMap<HotAttr<?>, OldStyleValueSet<?>> styleValues, 
    121118                        ImmMap<OldHotInterval, Attachment> attachments, OldHotInterval lastChangedInterval, long uid) { 
    122                 ImmTreeList<Character> immText = new ImmTreeList<Character>(new ImmHashingTree<Character>()); 
     119                ImmTreeList<Character> immText = ImmCollectionUtil.<Character>createHashingImmList(); 
    123120                for (char ch : text.toCharArray()) { 
    124121                        immText = immText.add(ch); 
    125122                } 
  • modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/util/ImmCollectionUtil.java

     
     1package org.sophie2.base.commons.util; 
     2 
     3import java.util.Collection; 
     4import java.util.Comparator; 
     5 
     6import org.sophie2.base.commons.structures.ImmDosTree; 
     7import org.sophie2.base.commons.structures.ImmHashingTree; 
     8import org.sophie2.base.commons.structures.ImmTreeList; 
     9import org.sophie2.base.commons.structures.ImmTreeMap; 
     10import org.sophie2.base.commons.structures.ImmTreeSet; 
     11import 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 */ 
     21public class ImmCollectionUtil { 
     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.base.model.text/src/main/java/org/sophie2/base/model/text/old/OldHotStyleDef.java

     
    44import java.util.HashMap; 
    55import java.util.Map; 
    66 
    7 import org.sophie2.base.commons.structures.ImmDosTree; 
    8 import org.sophie2.base.commons.structures.ImmTreeList; 
     7import org.sophie2.base.commons.util.ImmCollectionUtil; 
    98import org.sophie2.base.commons.util.ImmList; 
    109import org.sophie2.base.model.text.HotAttr; 
    1110import org.sophie2.core.prolib.annot.Immutable; 
     
    5049         *                      The style's attributes. 
    5150         */ 
    5251        public ImmList<HotAttr<?>> getAttributeKeys() { 
    53                 ImmList<HotAttr<?>> keys = new ImmTreeList<HotAttr<?>>(new ImmDosTree<HotAttr<?>>()); 
     52                ImmList<HotAttr<?>> keys = ImmCollectionUtil.<HotAttr<?>>createDosImmList(); 
    5453                for (HotAttr<?> attr : this.attrValues.keySet()) { 
    5554                        keys = keys.add(attr); 
    5655                } 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/style/StyleValueSet.java

     
    33 */ 
    44package org.sophie2.base.model.text.style; 
    55 
    6 import org.sophie2.base.commons.structures.ImmHashingTree; 
    76import org.sophie2.base.commons.structures.ImmTreeSet; 
    87import org.sophie2.base.commons.util.Hash; 
    98import org.sophie2.base.commons.util.Hashable; 
    109import org.sophie2.base.commons.util.Hasher; 
     10import org.sophie2.base.commons.util.ImmCollectionUtil; 
    1111import org.sophie2.base.commons.util.ImmSet; 
    1212import org.sophie2.base.model.text.HotAttr; 
    1313import org.sophie2.core.prolib.annot.Immutable; 
     
    3131        private ImmSet<HotStyleValue<T>> set; 
    3232 
    3333        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 = ImmCollectionUtil.<HotStyleValue<T>> createHashingImmSet(); 
    3735                this.attr = attr; 
    3836        } 
    3937 
  • modules/org.sophie2.base.commons/src/test/java/org/sophie2/base/commons/structures/ImmDosAndHashingTreeTest.java

     
    88import org.sophie2.base.commons.structures.ImmDosTree.Node; 
    99import org.sophie2.base.commons.structures.ImmHashingTree.HashingNode; 
    1010import org.sophie2.base.commons.util.Hasher; 
    11 import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
     11import org.sophie2.base.commons.util.ImmCollectionUtil; 
    1212import org.sophie2.core.logging.SophieLog; 
    1313import org.sophie2.core.testing.TestBase; 
    1414 
     
    102102         */ 
    103103        @Test 
    104104        public void testDeletingLast() throws Exception { 
    105                 ImmTreeMap<Integer, String> tm = new ImmTreeMap<Integer, String>(new ImmHashingTree<ImmEntry<Integer, String>>()); 
     105                ImmTreeMap<Integer, String> tm = ImmCollectionUtil.<Integer, String> createHashingImmMap(); 
    106106                int next = 0; 
    107107                String element = String.format("Element %d", next); 
    108108                tm = tm.put(next, element); 
  • modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/util/ApplyHtmlStylesUtility.java

     
    1212 
    1313import org.sophie2.base.commons.structures.ImmDosTree; 
    1414import org.sophie2.base.commons.structures.ImmTreeMap; 
     15import org.sophie2.base.commons.util.ImmCollectionUtil; 
    1516import org.sophie2.base.commons.util.ImmColor; 
    1617import org.sophie2.base.commons.util.ImmMap; 
    1718import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
     
    3839         * The default constructor; 
    3940         */ 
    4041        public ApplyHtmlStylesUtility() { 
    41                 this.htmlMap = new ImmTreeMap<String, HotAttr<?>>( 
    42                                 new ImmDosTree<ImmEntry<String, HotAttr<?>>>()); 
     42                this.htmlMap = ImmCollectionUtil.<String, HotAttr<?>> createDosImmMap(); 
    4343                this.htmlMap = this.htmlMap.put("font-size", CommonAttr.FONT_SIZE); 
    4444                this.htmlMap = this.htmlMap.put("margin-left", CommonAttr.PARA_LEFT_INDENT); 
    4545                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

     
    22 
    33import javax.swing.SwingUtilities; 
    44 
    5 import org.sophie2.base.commons.structures.ImmDosTree; 
    65import org.sophie2.base.commons.structures.ImmTreeMap; 
     6import org.sophie2.base.commons.util.ImmCollectionUtil; 
    77import org.sophie2.base.commons.util.ImmList; 
    88import org.sophie2.base.commons.util.ImmMap; 
    99import org.sophie2.base.commons.util.NaiveImmList; 
     
    4949         * @throws Exception 
    5050         */ 
    5151        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 = ImmCollectionUtil.<String, ImmList<String>> createDosImmMap(); 
    5453                testMap.put("testKey", NaiveImmList.<String> create("testValueItem 1", 
    5554                                "testValue 2")); 
    5655                Storage storage = new Storage(); 
  • modules/org.sophie2.base.commons/src/main/java/org/sophie2/base/commons/util/ImmImage.java

     
    3131import javax.swing.Icon; 
    3232import javax.swing.ImageIcon; 
    3333 
    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; 
    3734import org.sophie2.base.commons.util.bindata.BinData; 
    3835import org.sophie2.base.commons.util.bindata.BinDataReferrer; 
    3936import org.sophie2.base.commons.util.bindata.FileBinData; 
     
    486483                } 
    487484        } 
    488485 
    489         private ImmMap<ImageHolder, ImmImage> imageMap = new ImmTreeMap<ImageHolder, ImmImage>( 
    490                         new ImmHashingTree<ImmEntry<ImageHolder, ImmImage>>(), getImmHolderComparator()); 
     486        private ImmMap<ImageHolder, ImmImage> imageMap = ImmCollectionUtil.<ImageHolder, ImmImage> createHashingImmMap(getImmHolderComparator()); 
    491487 
    492488        private Comparator<ImageHolder> getImmHolderComparator() { 
    493489                return new Comparator<ImageHolder>() { 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/style/HotStyleDef.java

     
    44import java.util.Iterator; 
    55import java.util.Map; 
    66 
    7 import org.sophie2.base.commons.structures.ImmDosTree; 
    8 import org.sophie2.base.commons.structures.ImmTreeList; 
    97import org.sophie2.base.commons.structures.ImmTreeMap; 
    108import org.sophie2.base.commons.util.Hash; 
    119import org.sophie2.base.commons.util.Hashable; 
    1210import org.sophie2.base.commons.util.Hasher; 
     11import org.sophie2.base.commons.util.ImmCollectionUtil; 
    1312import org.sophie2.base.commons.util.ImmList; 
    1413import org.sophie2.base.commons.util.ImmMap; 
    1514import org.sophie2.base.commons.util.ImmMap.ImmEntry; 
     
    9291         *                      The style's attributes. 
    9392         */ 
    9493        public ImmList<HotAttr<?>> getAttributeKeys() { 
    95                 ImmList<HotAttr<?>> keys = new ImmTreeList<HotAttr<?>>(new ImmDosTree<HotAttr<?>>()); 
     94                ImmList<HotAttr<?>> keys = ImmCollectionUtil.<HotAttr<?>>createDosImmList(); 
    9695                for (ImmEntry<HotAttr<?>, Object> entry : this.attrValues.asList()) { 
    9796                        keys = keys.add(entry.getKey()); 
    9897                }