⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mset__vat_8h-source.html

📁 这是一个用于数据挖掘的常用算法的模板库(数据挖掘的C++模板库for UNIX)
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<a name="l00115"></a>00115     _idlist.clear();<a name="l00116"></a>00116   }<a name="l00117"></a>00117   <a name="l00118"></a>00118   <a name="l00129"></a>00129   <span class="keyword">template</span>&lt;<span class="keyword">class</span> PAT&gt;<a name="l00130"></a><a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#09f52714e2a9935d3aa9ad502d3266de">00130</a>     <span class="keyword">static</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>** intersection(<span class="keyword">const</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>* <span class="keyword">const</span>&amp; vat_i, <span class="keyword">const</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>* <span class="keyword">const</span>&amp; vat_j, <a class="code" href="classpattern__support.html">PAT_SUP</a>** cand_sups, PAT**, <span class="keywordtype">bool</span>&amp; is_l2) {<a name="l00131"></a>00131     <a name="l00132"></a>00132     <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>** cand_vats = <span class="keyword">new</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>*[1]; <span class="comment">// This memory is reclaimed in count() routine of count_support.h file</span><a name="l00133"></a>00133     cand_vats[0] = <span class="keyword">new</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a>();      <span class="comment">// This memory is reclaimed in count() routine of count_support.h file, only if the </span><a name="l00134"></a>00134     <span class="comment">// corresponding pattern is NOT frequent, otherwise, Storage Manager get a hold of this</span><a name="l00135"></a>00135     <span class="comment">// VAT.</span><a name="l00136"></a>00136     <a name="l00137"></a>00137     <span class="keywordflow">if</span>(cand_sups[0] == 0) { <span class="comment">// No pattern_support class associated to return support value, ERROR</span><a name="l00138"></a>00138       <span class="keyword">delete</span> cand_vats[0];<a name="l00139"></a>00139       <span class="keyword">delete</span>[] cand_vats;<a name="l00140"></a>00140       <a name="l00141"></a>00141       cerr &lt;&lt; <span class="stringliteral">"mset_vat: No candidates VATs to be generated."</span> &lt;&lt; endl;<a name="l00142"></a>00142       <span class="keywordflow">return</span> NULL;<a name="l00143"></a>00143     }<a name="l00144"></a>00144     <a name="l00145"></a>00145     CONST_IT it_i=vat_i-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#9f5573d29f7209f260e55dcaddf79892">begin</a>(), it_j=vat_j-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#9f5573d29f7209f260e55dcaddf79892">begin</a>();<a name="l00146"></a>00146     <a name="l00147"></a>00147     <span class="keywordflow">while</span>(it_i!=vat_i-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#e4491bc411d45d8df0a29c35755a9131">end</a>() &amp;&amp; it_j!=vat_j-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#e4491bc411d45d8df0a29c35755a9131">end</a>()) {<a name="l00148"></a>00148       <span class="keywordflow">if</span>((*it_i).first &lt; (*it_j).first) {<a name="l00149"></a>00149         it_i++;<a name="l00150"></a>00150         <span class="keywordflow">continue</span>;<a name="l00151"></a>00151       }<a name="l00152"></a>00152       <a name="l00153"></a>00153       <span class="keywordflow">if</span>((*it_j).first &lt; (*it_i).first) {<a name="l00154"></a>00154         it_j++;<a name="l00155"></a>00155         <span class="keywordflow">continue</span>;<a name="l00156"></a>00156       }<a name="l00157"></a>00157      <a name="l00158"></a>00158       <span class="keywordflow">if</span>(vat_i == vat_j) {  <span class="comment">// Intersecting the same pattern.</span><a name="l00159"></a>00159         <span class="keywordflow">if</span>((*it_i).second &gt; 1)<a name="l00160"></a>00160           cand_vats[0]-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#96707cab123a7e507bbc79c7f686d85f">push_back</a>(make_pair((*it_i).first, (*it_i).second-1));<a name="l00161"></a>00161       } <span class="keywordflow">else</span> {<a name="l00162"></a>00162         cand_vats[0]-&gt;<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#96707cab123a7e507bbc79c7f686d85f">push_back</a>(make_pair((*it_i).first, (*it_j).second));<a name="l00163"></a>00163       }<a name="l00164"></a>00164 <a name="l00165"></a>00165       it_i++;<a name="l00166"></a>00166       it_j++;<a name="l00167"></a>00167     }<span class="comment">//end while</span><a name="l00168"></a>00168     <a name="l00169"></a>00169     <span class="comment">// setting the support value that will be checked in the count method of count_support class.</span><a name="l00170"></a>00170     cand_sups[0]-&gt;<a class="code" href="classpattern__support.html#ceb8296801b8f94ae5ec5e00f0867b9d">set_sup</a>(make_pair(cand_vats[0]-&gt;size(), cand_vats[0]-&gt;size()));<a name="l00171"></a>00171     <a name="l00172"></a>00172     <span class="keywordflow">return</span> cand_vats;<a name="l00173"></a>00173   }<a name="l00174"></a>00174   <a name="l00179"></a><a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#a20458f207e21bd8acbf502eed2f442e">00179</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size()<span class="keyword"> const </span>{<a name="l00180"></a>00180     <span class="keywordflow">return</span> _idlist.<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#9de5878903d23b64f268b3b947317d9f">size</a>();<a name="l00181"></a>00181   }<a name="l00182"></a>00182 <a name="l00186"></a><a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#337da4fb9a0d6e491ccae87b8eaed2e7">00186</a>   <a class="code" href="classvat.html">vat</a>(<span class="keyword">const</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a> &amp;orig) {<a name="l00187"></a>00187     *<span class="keyword">this</span>= orig;<a name="l00188"></a>00188   }<a name="l00189"></a>00189 <a name="l00190"></a>00190   ~<a class="code" href="classvat.html">vat</a>(){<a name="l00191"></a>00191     _idlist.<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#a8a6205b57ac665e29fdd4a66a773e8d">clear</a>();<a name="l00192"></a>00192   }<a name="l00193"></a>00193   <a name="l00197"></a><a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#f7c46f53c2c928abdfb6e0fbc6dcae31">00197</a>   <span class="keyword">const</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a> &amp;operator=(<span class="keyword">const</span> <a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html">VAT</a> &amp;right) {<a name="l00198"></a>00198     <span class="keywordflow">if</span> ( &amp;right != <span class="keyword">this</span> ) {         <span class="comment">// avoid self assignment</span><a name="l00199"></a>00199       _idlist=right.<a class="code" href="classvat_3_01MSET__PROP_00_01V__Fkk__MINE__PROP_00_01ALLOC_00_01ST_01_4.html#76e2fa381d59c79f6f61d1068dacf2ef">_idlist</a>;<a name="l00200"></a>00200     }<a name="l00201"></a>00201     <span class="keywordflow">else</span><a name="l00202"></a>00202       cout &lt;&lt; <span class="stringliteral">"Attempted assignment of a Vat to itself\n"</span>;<a name="l00203"></a>00203     <a name="l00204"></a>00204     <span class="keywordflow">return</span> *<span class="keyword">this</span>;   <span class="comment">// enables cascaded assignments</span><a name="l00205"></a>00205   }<a name="l00206"></a>00206   <a name="l00207"></a>00207   <span class="comment">// Return Vat length</span><a name="l00208"></a>00208   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> byte_size()<span class="keyword"> const </span>{<a name="l00209"></a>00209     <a name="l00210"></a>00210     <span class="keywordflow">return</span> _idlist.size()* <span class="keyword">sizeof</span>(int);<a name="l00211"></a>00211   }<a name="l00212"></a>00212  <a name="l00241"></a>00241   <span class="keyword">friend</span> ostream&amp; operator&lt;&lt; &lt;&gt;(ostream&amp; , <span class="keyword">const</span> VAT&amp;);<a name="l00242"></a>00242   <a name="l00243"></a>00243   <span class="keyword">friend</span> istream&amp; operator&gt;&gt; &lt;&gt;(istream&amp; , VAT&amp;);<a name="l00244"></a>00244   <a name="l00245"></a>00245  <span class="keyword">private</span>:<a name="l00246"></a>00246   IDLIST_T _idlist;<a name="l00247"></a>00247   <a name="l00248"></a>00248 };<a name="l00249"></a>00249 <a name="l00250"></a>00250 <a name="l00251"></a>00251 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T, <span class="keyword">class</span> MP, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>ALLOC, <span class="keyword">template</span> &lt;<span class="keyword">typename</span> P, <span class="keyword">typename</span>&gt; <span class="keyword">class </span>ST &gt;<a name="l00252"></a>00252 ostream&amp; operator&lt;&lt;(ostream&amp; output, vat&lt;T, MP, ALLOC, ST&gt; <span class="keyword">const</span>&amp; orig) {<a name="l00253"></a>00253   std::ostream_iterator&lt;int&gt; out(output, <span class="stringliteral">" "</span>);<a name="l00254"></a>00254   std::copy(orig.begin(), orig.end(), out);<a name="l00255"></a>00255   output &lt;&lt;<span class="charliteral">'\n'</span>;<a name="l00256"></a>00256   <span class="keywordflow">return</span> output;   <span class="comment">// enables cascading</span><a name="l00257"></a>00257 }<a name="l00258"></a>00258 <a name="l00259"></a>00259 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T, <span class="keyword">class</span> MP, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>ALLOC, <span class="keyword">template</span> &lt;<span class="keyword">typename</span> P, <span class="keyword">typename</span>&gt; <span class="keyword">class </span>ST &gt;<a name="l00260"></a>00260 istream&amp; operator&gt;&gt;(istream&amp; input,  <a class="code" href="classvat.html">vat&lt;T, MP, ALLOC, ST &gt;</a>&amp; orig) {<a name="l00261"></a>00261   <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAXLINE=20000;<a name="l00262"></a>00262   <span class="keywordtype">char</span> line[MAXLINE];<a name="l00263"></a>00263   input.getline(line,MAXLINE);<a name="l00264"></a>00264   stringstream s(line);<a name="l00265"></a>00265   std::istream_iterator&lt;int&gt; in(s);<a name="l00266"></a>00266   std::istream_iterator&lt;int&gt; eof;<a name="l00267"></a>00267   <a name="l00268"></a>00268   orig._idlist.clear();<a name="l00269"></a>00269   std::copy (in,eof, std::back_inserter(orig._idlist));<a name="l00270"></a>00270   <span class="keywordflow">return</span> input;   <span class="comment">// enables cascading</span><a name="l00271"></a>00271 }<a name="l00272"></a>00272 <a name="l00273"></a>00273 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Jul 26 14:01:08 2006 for DMTL by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -