Exemplo n.º 1
0
        // throws jjtraveler.VisitFailure
        public virtual void testBottomUp()
        {
            Identity id = new Identity();
            Logger expected = new Logger(id, new IVisitable[]{n0, n1, n3, n2, n4} );

            BottomUp  visitor = new BottomUp( logVisitor(id) );

            IVisitable nodeReturned = visitor.visit(n4);
            Assertion.AssertEquals(expected, logger);
            Assertion.AssertEquals(n4, nodeReturned);
        }
Exemplo n.º 2
0
        private void btn_GetW_Click(object sender, EventArgs e)
        {
            int N_LENGTH = Convert.ToInt16(txt_NLength.Text);
            //todo /*Duc*/

            //try
            //{
            //read file
            List <double> stream_data;

            stream_data = IOFuncs.readStreamFile(txt_data_to_calc_W.Text);
            stream_data = MathFuncs.zScoreNorm(stream_data, stream_data.Count);
            //get threshold:
            double threshold = Convert.ToDouble(txt_threshold.Text);


            /*todo*/
            int result = stream_data.Count;
            MinHeap <SegmentNode> segment_heap = null;

            BottomUp.Bottom_Up(stream_data, threshold, ref result, ref segment_heap);
            result = (int)(N_LENGTH / result);


            Segment_Form form2 = new Segment_Form(stream_data, segment_heap);

            //form2.Show();

            /*show the result:*/
            txt_WLength.Text = result.ToString();
            Console.WriteLine("W_LENGTH = " + result);
            //}
            //catch
            //{
            //    MessageBox.Show("re-check the parameters !", "Error", MessageBoxButtons.OK);
            //}
        }