using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using FBPVerbs;
using FBPLib;

namespace MergeAndSort
{

    public class MergeAndSort : Network
    {

        /* *
          * Copyright 2007, 2008, J. Paul Morrison.  At your option, you may copy, 
          * distribute, or make derivative works under the terms of the Clarified Artistic License, 
          * based on the Everything Development Company's Artistic License.  A document describing 
          * this License may be found at http://www.jpaulmorrison.com/fbp/artistic2.htm. 
          * THERE IS NO WARRANTY; USE THIS PRODUCT AT YOUR OWN RISK.
          * */

        public override void Define() /* throws Throwable */ {


            Component("Generate", typeof(Generate));

            Connect(Component("Generate"),
                Port("OUT"),
                Component("Sort", typeof(Sort)),
                Port("IN"));


            Initialize("10",
                Component("Generate"),
                Port("COUNT"));

            Connect(Component("Generate2", typeof(Generate)),
                Port("OUT"),
                Component("Sort"),
                Port("IN"));

            Initialize("12",
                Component("Generate2"),
                Port("COUNT"));

            Connect(Component("Sort"),
                Port("OUT"),
                Component("Write", typeof(WriteText)),
                Port("IN"));

            Stream st = Console.OpenStandardOutput();
            Initialize(st,
                Component("Write"),
                Port("DESTINATION"));

        }

        static void Main(String[] argv)
        {
            new MergeAndSort().Go();
        }
    }

}



