/src/lib/storage/internal/hashed_bijective_dictionary_node.e
Specman e | 103 lines | 61 code | 14 blank | 28 comment | 0 complexity | a3f7c1935700718d8c5b7a37237deacb MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4class HASHED_BIJECTIVE_DICTIONARY_NODE[V_, K_] 5 -- 6 -- Auxiliary class to implement HASHED_BIJECTIVE_DICTIONARY. 7 -- 8 9inherit 10 ANY_HASHED_BIJECTIVE_DICTIONARY_NODE 11 12create {HASHED_BIJECTIVE_DICTIONARY} 13 make 14 15feature {HASHED_BIJECTIVE_DICTIONARY} 16 val: V_ 17 18 key: K_ 19 20 next_key: like Current 21 -- The forward link to the next `key' in case of hash-code clash. 22 23 next_val: like Current 24 -- The forward link to the next `val' in case of hash-code clash. 25 26 make (v: like val; nv: like next_val; k: like key; nk: like next_key) 27 require 28 v /= Void 29 k /= Void 30 do 31 val := v 32 next_val := nv 33 key := k 34 next_key := nk 35 ensure 36 val = v 37 next_val = nv 38 key = k 39 next_key = nk 40 end 41 42 set_val (v: like val) 43 do 44 val := v 45 ensure 46 val = v 47 end 48 49 set_next_val (nv: like next_val) 50 do 51 next_val := nv 52 ensure 53 next_val = nv 54 end 55 56 set_key (k: like key) 57 do 58 key := k 59 ensure 60 key = k 61 end 62 63 set_next_key (nk: like next_key) 64 do 65 next_key := nk 66 ensure 67 next_key = nk 68 end 69 70 set_val_and_key (v: like val; k: like key) 71 do 72 val := v 73 key := k 74 ensure 75 val = v 76 key = k 77 end 78 79invariant 80 key /= Void 81 val /= Void 82 83end -- class HASHED_BIJECTIVE_DICTIONARY_NODE 84-- 85-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file. 86-- 87-- Permission is hereby granted, free of charge, to any person obtaining a copy 88-- of this software and associated documentation files (the "Software"), to deal 89-- in the Software without restriction, including without limitation the rights 90-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 91-- copies of the Software, and to permit persons to whom the Software is 92-- furnished to do so, subject to the following conditions: 93-- 94-- The above copyright notice and this permission notice shall be included in 95-- all copies or substantial portions of the Software. 96-- 97-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 98-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 99-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 100-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 101-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 102-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 103-- THE SOFTWARE.