| 1 | #ifndef _Index_h_ |
| 2 | #define _Index_h_ |
| 3 | /* Index.h |
| 4 | * |
| 5 | * Copyright (C) 2005-2022 David Weenink |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Collection.h" |
| 22 | #include "NUM2.h" |
| 23 | #include "Strings_.h" |
| 24 | |
| 25 | #include "Index_def.h" |
| 26 | |
| 27 | |
| 28 | /* |
| 29 | An Index is a summary of an array of strings. |
| 30 | It has two parts: |
| 31 | 1 an OrderedSet of the different string classes that occur |
| 32 | 2 an item array with indexes in this OrderedSet |
| 33 | Example: |
| 34 | Suppose we have a Strings with 7 elements/items "u", "o", "a", "u", "u", "o", "a" |
| 35 | The Index derived from this Strings will have 3 elements in its sorted set "a", "o" and "u" |
| 36 | The item array with indices will have the following content: 3, 2, 1, 3, 3, 2, 1 |
| 37 | */ |
| 38 | |
| 39 | void Index_init (Index me, integer numberOfElements); |
| 40 | |
| 41 | autoIndex Index_extractPart (Index me, integer from, integer to); |
| 42 | |
| 43 | integer Index_getClassIndexFromItemIndex (Index me, integer itemIndex); |
| 44 | |
| 45 | autoStringsIndex StringsIndex_create (integer numberOfItems); |
| 46 | |
| 47 | autoStringsIndex StringsIndex_createFromSTRVEC (constSTRVEC const& strvec, kStrings_sorting sorting); |
| 48 | |
| 49 | int StringsIndex_getClassIndexFromClassLabel (StringsIndex me, conststring32 classLabel); |
| 50 | |
| 51 | conststring32 StringsIndex_getClassLabelFromClassIndex (StringsIndex me, integer classNumber); |
| 52 | |
| 53 | conststring32 StringsIndex_getItemLabelFromItemIndex (StringsIndex me, integer itemNumber); |
| 54 | |
| 55 | autoSTRVEC StringsIndex_listAllClasses ( StringsIndex me); |
| 56 | |
| 57 | integer StringsIndex_countItems (StringsIndex me, integer iclas); |
| 58 | |
| 59 | void StringsIndex_sortNumerically (StringsIndex me); |
| 60 | |
| 61 | #endif /* _Index_h_ */ |