CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / CollectionTemplate.h
blobc3c66c485cc803b86c8a35c30e359e2698b57982
1 // Pair-of-tries class template
2 // Copyright © 2009 The University of Chicago
3 #ifndef COLLECTIONTEMPLATE_H
4 #define COLLECTIONTEMPLATE_H
6 #include "Trie.h"
8 #include <QString>
9 #include "generaldefinitions.h"
11 class CMiniLexicon;
12 class CLexicon;
13 class CPrefix;
14 class CLParse;
15 class CParse;
16 class CSuffixCollection;
17 class CPrefixCollection;
18 class CStemCollection;
20 template<class T> class TCollection : public CTrie {
21 protected:
22 int m_CorpusCount;
23 bool m_DeletePointers;
24 int* m_DeletionArray;
25 bool m_HashHasChangedFlag;
26 QString m_MemberName;
27 T** m_PointerArray;
28 CLexicon* m_pLexicon;
29 CMiniLexicon* m_pMiniLex;
30 CTrie* m_pReverseTrie;
31 CNode** m_pTerminalNodeArray;
32 T** m_SortArray;
33 bool m_SortValidFlag;
34 enum eSortStyle m_SortStyle;
35 double m_TotalUseCount;
36 public:
37 // construction/destruction.
39 TCollection();
40 TCollection(CMiniLexicon* Mini, QString MemberName = QString());
41 TCollection(CLexicon* Lex, QString MemberName = QString());
42 ~TCollection();
44 // disable copy
45 private:
46 TCollection(const TCollection& x);
47 TCollection& operator=(const TCollection& x);
48 public:
50 T* operator<< ( CParse* );
51 T* operator<< ( CStringSurrogate );
52 T* operator<< ( QString );
53 T* operator^= ( CParse* );
54 T* operator^= ( CStringSurrogate );
55 T* operator^= ( QString );
56 T* operator[] ( uint n );
58 void AddPointer( T* );
59 T* AddToCollection( const CParse& );
60 T* AddToCollection( const CStringSurrogate& );
61 bool Contains( CStringSurrogate& );
62 void CreatePointerArray();
63 void CreateReverseTrie();
64 void DeleteMarkedMembers();
65 void DoNotDeletePointers();
66 void DumpVisibleToLogFile();
67 void DumpVisibleWords( CWordCollection* );
68 void Empty();
69 CStringSurrogate FindMaximalMajorityPrefix();
70 void FindMemberExtensions ( int, TCollection<CLParse>& );
71 T* GetAt( uint );
72 CStringSurrogate GetAt_SS( int );
73 T* GetAtSort( int n );
74 CStringSurrogate GetAtSort_SS( int );
75 int GetCorpusCount() const;
76 CLexicon* GetLexicon();
77 CMiniLexicon* GetMiniLexicon();
78 CTrie* GetReverseTrie();
79 int GetSortValidFlag();
80 int GetTotalUseCount() { return m_TotalUseCount; }
81 CTrie* GetTrie();
82 int GetWidth( CStringSurrogate ); // i.e., from Trie
83 void IncrementCorpusCount( int n = 1 );
84 void MarkForDeletion( int );
85 void RecomputeCorpusCount();
86 bool Remove( T* ); // doesn't delete T*
87 void RemoveAll();
88 bool RemoveMember( T* ); // deletes T*
89 bool RemoveMember( const CStringSurrogate& ); // deletes T*
90 bool RemoveMember( const CStringSurrogate&, bool ); // FSA
91 CLParse* SeekChain( T*, CLParse*, int );
92 void SetKey( T*, CParse& );
93 void SetKey( T*, QString );
94 void SetSortStyle( eSortStyle );
95 void SetSortValidFlag(bool value);
96 void Sort( eSortStyle );
97 void T_PredecessorFrequency( eSuccessorFrequencyMode,
98 CStemCollection* Stems = NULL,
99 CPrefixCollection* Suffixes = NULL,
100 int MaxNeighborPredecessorCount = 1,
101 int MaximumPrefixLength = 5,
102 int MinimumStemLength = 3,
103 int LeftMargin = -1,
104 int RightMargin = -1 );
105 void T_SuccessorFrequency( eSuccessorFrequencyMode,
106 CStemCollection* Stems = NULL,
107 CSuffixCollection* Suffixes = NULL,
108 int MaxNeighborSuccessorCount = 1,
109 int MaximumSuffixLength = 5,
110 int MinimumStemLength = 3,
111 int LeftMargin = -1,
112 int RightMargin = -1 );
115 #include "CollectionTemplate.tcc"
117 #endif // COLLECTIONTEMPLATE_H