| 53 | * set element |
| 54 | |
| 55 | * remove element |
| 56 | * removeCase1 |
| 57 | * removeCase2 |
| 58 | * removeCase3 |
| 59 | * removeCase4 |
| 60 | * removeCase5 |
| 61 | |
| 62 | |
| 63 | ImmDosTree'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 | {{{ |
| 66 | public 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] |