PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/storage/set/ext_avl_set.e

http://github.com/tybor/Liberty
Specman e | 74 lines | 42 code | 9 blank | 23 comment | 0 complexity | 146eb576a44001c9b58f119e1b5da70f MD5 | raw file
 1-- This file is part of a Liberty Eiffel library.
 2-- See the full copyright at the end.
 3--
 4class EXT_AVL_SET[E_]
 5
 6inherit
 7   ABSTRACT_AVL_SET[E_]
 8      rename
 9         make as abs_make,
10         from_collection as abs_from_collection
11      end
12
13create {ANY}
14   make, from_collection
15
16feature {ANY}
17   order: PREDICATE[TUPLE[E_, E_]]
18
19   from_collection (a_order: like order; model: COLLECTION[like item])
20      require
21         a_order /= Void
22         model /= Void
23      do
24         order := a_order
25         abs_from_collection(model)
26      ensure
27         order = a_order
28      end
29
30feature {}
31   ordered (e1, e2: E_): BOOLEAN
32      do
33         Result := order.item([e1, e2])
34      end
35
36   a_new_node: EXT_AVL_SET_NODE[E_]
37      do
38         create Result.make(order)
39      end
40
41   make (a_order: like order)
42      require
43         a_order /= Void
44      do
45         order := a_order
46         abs_make
47      ensure
48         order = a_order
49      end
50
51invariant
52   order /= Void
53
54end -- class EXT_AVL_SET
55--
56-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
57--
58-- Permission is hereby granted, free of charge, to any person obtaining a copy
59-- of this software and associated documentation files (the "Software"), to deal
60-- in the Software without restriction, including without limitation the rights
61-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62-- copies of the Software, and to permit persons to whom the Software is
63-- furnished to do so, subject to the following conditions:
64--
65-- The above copyright notice and this permission notice shall be included in
66-- all copies or substantial portions of the Software.
67--
68-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
74-- THE SOFTWARE.