202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
+
+
+
+
+
+
+
+
+
-
-
+
+
+
|
Corpus_Entry : in String;
Compressed_Size : in out Ada.Streams.Stream_Element_Count;
Counts : in out Dictionary_Counts);
-- Compress all strings of Corpus, returning the total number of
-- compressed bytes and the number of uses for each dictionary
-- element.
function Worst_Index
(Dict : in Dictionary;
Counts : in Dictionary_Counts;
Method : in Methods.Enum;
First, Last : in Ada.Streams.Stream_Element)
return Ada.Streams.Stream_Element
with Pre => Last in First .. Dict.Dict_Last;
-- Return the element with worst score in the whole directionary
function Worst_Index
(Dict : in Dictionary;
Counts : in Dictionary_Counts;
Method : in Methods.Enum)
return Ada.Streams.Stream_Element;
-- Return the element with worst score
return Ada.Streams.Stream_Element
is (Worst_Index (Dict, Counts, Method, 0, Dict.Dict_Last));
-- Return the element with worst score in the whole directionary
type Score_Value is range 0 .. 2 ** 31 - 1;
function Score_Encoded
(Count : in String_Count; Length : in Positive) return Score_Value
is (Score_Value (Count) * Score_Value (Length));
|