1 // Implemenation of CDatum, CDatumListViewItem methods
2 // Copyright © 2009 The University of Chicago
8 CDatumListViewItem::CDatumListViewItem( Q3ListView
*parent
)
9 : Q3ListViewItem( parent
)
13 CDatumListViewItem::CDatumListViewItem( Q3ListView
*parent
,
16 : Q3ListViewItem( parent
, affix
)
22 CDatumListViewItem::CDatumListViewItem( Q3ListViewItem
*parent
,
25 : Q3ListViewItem( parent
, affix
)
31 QString
CDatumListViewItem::key( int column
, bool ascending
) const
36 return QString("%1").arg( m_datum
->m_Count
, 10 );
38 return QString("%1").arg( m_datum
->m_Frequency
, 10 );
40 return Q3ListViewItem::key( column
, ascending
);
45 QString
CDatumListViewItem::text( int column
) const
50 return QString("%1").arg( m_datum
->m_Count
);
52 return QString("%1").arg( m_datum
->m_Frequency
);
54 return Q3ListViewItem::text( column
);
58 CDatum::CDatum() : CParse()
65 CDatum::CDatum( CParse
& parse
) : CParse( parse
)
72 CDatum::CDatum ( QChar c
) : CParse ( c
)
78 CDatum::CDatum( CSS
& ssString
) : CParse( ssString
)
85 void CDatum::SetFrequency( float f
) { m_Frequency
=f
; }
88 double CDatum::GetCount() { return m_Count
; }
91 //CString CDatum::GetKey() { return Key; }
94 void CDatum::SetCount( double f
) { m_Count
= f
; }
97 void CDatum::IncrementCount( CVeryLong
& VL
)
99 m_Count
= m_Count
+ VL
.ToDouble();
102 void CDatum::IncrementCount()
108 // this is normally found in MiniLexicon_deMarcken, which is temporarily not included.
110 CDatum* CMiniLexicon::LookUp ( QString s )
112 if( m_DataMap.contains( s ) )
114 StringToDatum::Iterator it = m_DataMap.find( s );
123 /* todo: put this back
124 double CDatum::GetInformationContent( CMiniLexicon* lexicon )
126 double info = -1 * log( m_Frequency ) / log( 2 ),
133 for( int i = 0; i < key.GetLength(); i++ )
136 pLetter = lexicon->LookUp( letter );
137 letterInfo = -1 * log( pLetter->m_Frequency ) / log(2);
142 return info * m_Count;