<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c7edcc>
<DIV><FONT size=2>Patch of LoadFromStep7:</FONT></DIV>
<DIV><FONT size=2>implement LoadFrom() in CongtiguousSegmentation, </FONT></DIV>
<DIV><FONT size=2>and pass unittests.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV><FONT size=2>Patch of LoadFromStep6:<BR>add 
  UnsizedSegmentation::addArray(marks, marks+nMarks); and pass test. and 
  confirmed<BR>that UnsizedSegmentation s(200,marks,marks+nMarks); is equivalent 
  to <BR>UnsizedSegmentation s(200); s.addArray(marks, 
  marks+nMarks);</FONT></DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV><FONT size=2></FONT><BR></DIV>
    <DIV><FONT size=2>Patch of LoadFromStep5:<BR>to test whether 
    DiscontinuousSegmentation s(200,marks,marks+nMarks); is equivalent to 
    <BR>DiscontinuousSegmentation s(200); s.addArray(marks, 
    marks+nMarks);<BR>Not only in testStoreOn(), but also other related 
    tests.</FONT></DIV>
    <BLOCKQUOTE dir=ltr 
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
      <DIV><FONT size=2>Patch of LoadFromStep4:<BR>add 
      DiscontinuousSegmentation::addArray(marks, marks+nMarks); and pass 
      test</FONT></DIV>
      <BLOCKQUOTE dir=ltr 
      style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
        <DIV style="FONT: 9pt 宋体"><FONT size=2>Patch of LoadFromStep3:<BR>to 
        test whether ContiguousSegmentation 
        s(200,marks,marks+nMarks);</FONT></DIV>
        <DIV><FONT size=2> is equivalent to <BR>ContiguousSegmetation 
        s(200); s.addArray(marks, marks+nMarks);<BR>Not only in testStoreOn() 
        but also in other related tests.</FONT></DIV>
        <BLOCKQUOTE dir=ltr 
        style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
          <DIV><FONT size=2>Patch of LoadFromStep2:<BR>to test whether 
          ContiguousSegmentation s(200,marks,marks+nMarks); is equivalent to 
          <BR>ContiguousSegmetation s(200); s.addArray(marks, 
          marks+nMarks);</FONT></DIV>
          <DIV><FONT size=2></FONT> </DIV>
          <DIV><FONT size=2>Bests,</FONT></DIV>
          <DIV><FONT size=2>June</FONT></DIV>
          <BLOCKQUOTE dir=ltr 
          style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
            <DIV style="FONT: 9pt 宋体">----- Original Message ----- </DIV>
            <DIV 
            style="BACKGROUND: #e4e4e4; FONT: 9pt 宋体; font-color: black"><B>From:</B> 
            <A title=wangjun@dsp.ac.cn 
            href="mailto:wangjun@dsp.ac.cn">JunJun</A> </DIV>
            <DIV style="FONT: 9pt 宋体"><B>To:</B> <A title=dgarcia@iua.upf.edu 
            href="mailto:dgarcia@iua.upf.edu">David García Garzón</A> </DIV>
            <DIV style="FONT: 9pt 宋体"><B>Cc:</B> <A 
            title=clam-devel@llistes.projectes.lafarga.org 
            href="mailto:clam-devel@llistes.projectes.lafarga.org">clam-devel@llistes.projectes.lafarga.org</A> 
            </DIV>
            <DIV style="FONT: 9pt 宋体"><B>Sent:</B> Sunday, June 15, 2008 10:39 
            PM</DIV>
            <DIV style="FONT: 9pt 宋体"><B>Subject:</B> Patch for Steps of 
            LoadFrom </DIV>
            <DIV><BR></DIV>
            <DIV><FONT size=2>> Take just ContiguousSgmentation:</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> We would like to have a virtual function that 
            receives the array. But current <BR>> implementation does not 
            receive a CLAM::Array but it is templated as <BR>> iterators 
            which is very convenient for other uses (tests). But template and 
            <BR>> virtual are incompatible, the first refactoring would be to 
            turn the template <BR>> constructor into a constructor receiving 
            just TData* which i think is <BR>> compatible with any current 
            use. Just in case, compile, both the annotator <BR>> and the 
            tests and pass the tests.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> Once we turned the constructor into a 
            templateless one, lets do an 'Extract <BR>> method' refactoring 
            from the constructor for the data filling part. So, for <BR>> 
            each Segmentation add the following method:<BR>> void 
            takeArray(TData * begin, TData * iterator end)<BR>> 
            {<BR>>  // copy here the filling code from the 
            constructor<BR>> }<BR>> Then substitute the copied code at the 
            constructor by a call to such method.<BR>> All the test should be 
            working.</FONT></DIV>
            <DIV><FONT size=2></FONT> </DIV>
            <DIV><FONT size=2>The patch is of the step above.</FONT></DIV>
            <DIV><FONT size=2>Notice that to make the test pass, I made a 
            forced type change (Iterator->TData), and changed the related 
            </FONT><FONT size=2>type (double->float) of the unittests. 
            That is ugly and requires the "Iterator" 
            datatype must be consistent with "TData".</FONT></DIV>
            <DIV><FONT size=2></FONT> </DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> No proceed the same with the rest of the 
            Segmentations sending patches at the <BR>> same 
            points.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> Create a virtual method takeArray on base 
            Segmentation. Should still compile.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> On SegmentationPane, intead of using the 
            three parameters constructor use the <BR>> one parameter one and 
            let's call the takeArray method after the switch. All <BR>> the 
            segmentations should still work so try them at Annotator as we did 
            some <BR>> days ago.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> Now, those refactoring have prepared the way 
            for our desired red, the LoadFrom <BR>> test. Some hints: you can 
            define an std::istreamstream("With some xml content <BR>> to be 
            read") and see how previous tests use the boundsAsString method to 
            get <BR>> the actual segmentation content as string.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> Now you'll try to use the load but now we 
            have a problem: We are missing the <BR>> audioDuration parameter. 
            By now, just set it on the constructor. Here we <BR>> would need 
            to change the XML format to add such a bound as part of the XML, 
            <BR>> this can break a lot of things so this is the perfect point 
            to have a <BR>> meeting.</FONT></DIV>
            <DIV><FONT size=2>> </FONT></DIV>
            <DIV><FONT size=2>> <BR>> -- <BR>> David García 
            Garzón<BR>> (Work) dgarcia at iua dot upf anotherdot es<BR>> 
            <A 
            href="http://www.iua.upf.edu/~dgarcia">http://www.iua.upf.edu/~dgarcia</A></FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>