Changes between Version 15 and Version 16 of IMMUTABLE_TREE_R0


Ignore:
Timestamp:
08/25/09 14:46:53 (16 years ago)
Author:
stefan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IMMUTABLE_TREE_R0

    v15 v16  
    4545 
    4646 
    47 Class ImmDosTree will be the implementation of Red-Black indexed tree. It's extension - ImmHashingTree contains hashable Nodes, so, itself is a hashable tree. 
     47Class ImmDosTree will be the implementation of Red-Black indexed tree following methods will be introduced (only description in logical sense): 
    4848 
    49 Following interfaces for List should be implemented: 
     49 * add element 
     50  * addCase1 
     51  * addCase2 
    5052 
     53 * set element 
     54  
     55 * remove element 
     56  * removeCase1 
     57  * removeCase2 
     58  * removeCase3 
     59  * removeCase4 
     60  * removeCase5 
     61 
     62 
     63ImmDosTree's extension - ImmHashingTree contains hashable Nodes. ImmHashingTree contains static method ''getHash'', which in itself invokes a public method in the inner class ''HashingNode'', which calculates :  
     64 
     65{{{ 
     66public static Hash getHash(ImmCollection<?> col, int begin, int end) { 
     67                if(!(col instanceof ImmTreeCollection<?>)) { 
     68                        throw new IllegalArgumentException("Non Hashable Collection - cannot get Hash!"); 
     69                } 
     70                 
     71                ImmTreeCollection<?> treeCol = (ImmTreeCollection<?>)col; 
     72                 
     73                if(!(treeCol.getTree().getRoot() instanceof HashingNode<?>)) { 
     74                        throw new IllegalArgumentException("Non Hashable Tree - cannot get Hash!"); 
     75                } 
     76                 
     77                HashingNode<?> node = (HashingNode<?>)treeCol.getTree().getRoot(); 
     78                 
     79                Hasher res = new Hasher(); 
     80                int count = end - begin; 
     81                 
     82                node.getHash(res, begin + treeCol.getTreeBegin(), count); 
     83                return res.toHash(); 
     84        } 
     85}}} 
     86 
     87 
     88 * List interface should be implemented for the ImmTreeList class. [ImmList.java] 
     89 * Set interface should be implemented for the ImmTreeSet class. [ImmSet.java] 
     90 * Map interface should be implemented for the ImmTreeMap class. [ImmMap.java] 
    5191 
    5292