PageRenderTime 60ms CodeModel.GetById 55ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/tutorial/backtracking/logigram/permut.e

http://github.com/tybor/Liberty
Specman e | 49 lines | 27 code | 4 blank | 18 comment | 2 complexity | c18837731dae7ac9b1a60845e4b7cb67 MD5 | raw file
 1-- See the Copyright notice at the end of this file.
 2--
 3class PERMUT
 4
 5inherit
 6	COMPARABLE
 7		undefine copy, is_equal, fill_tagged_out_memory
 8		end
 9	FAST_ARRAY[INTEGER]
10
11creation {ANY}
12	make, from_collection
13
14feature {ANY}
15	infix "<" (other: like Current): BOOLEAN is
16		local
17			i: INTEGER; up: INTEGER
18		do
19			from
20				up := upper.min(other.upper)
21			until
22				i > up or else item(i) /= other.item(i)
23			loop
24				i := i + 1
25			end
26			if i <= up then
27				Result := item(i) < other.item(i)
28			else
29				Result := i <= other.upper
30			end
31		end
32
33end -- class PERMUT
34--
35-- ------------------------------------------------------------------------------------------------------------------------------
36-- Copyright notice below. Please read.
37--
38-- This file is free software, which comes along with SmartEiffel. This software is distributed in the hope that it will be
39-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
40-- You can modify it as you want, provided this footer is kept unaltered, and a notification of the changes is added.
41-- You are allowed to redistribute it and sell it, alone or as a part of another product.
42--
43-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
44-- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
45--
46-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
47--
48-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
49-- ------------------------------------------------------------------------------------------------------------------------------