Ejemplo n.º 1
0
 public void SetUp()
 {
     task = MockRepository.GenerateMock<IWantToBeRun>();
     sleeper = MockRepository.GenerateMock<ISleeper>();
     stopper = MockRepository.GenerateMock<IStopper>();
     timer = new Timer(task, sleeper,stopper);
 }
Ejemplo n.º 2
0
        public void SetUp()
        {
            skype = MockRepository.GenerateMock<ISkype>();
            chat = MockRepository.GenerateMock<IChat>();
            userCollection = MockRepository.GenerateMock<IUserCollection>();
            client = MockRepository.GenerateMock<IClient>();
            user = MockRepository.GenerateMock<IUser>();
            configurationLoader = new ConfigurationLoader();
            httpGet = MockRepository.GenerateMock<IHttpGet>();
            chats = MockRepository.GenerateMock<IChats>();
            messengerClient = new MessengerClient(skype, userCollection, chats);

            buildCollection = MockRepository.GenerateMock<IBuildCollection>();
            loader = new Loader(messengerClient, buildCollection);
            stopper = MockRepository.GenerateMock<IStopper>();
            controller = new Controller();
            controller.Container.Kernel.AddComponentInstance<ISkype>(skype);
            controller.Container.Kernel.AddComponentInstance<IUserCollection>(userCollection);
            controller.Container.Kernel.AddComponentInstance<IStopper>(stopper);
            controller.CcTrayUrl = "http://localhost/Cctray.xml";
            controller.CcTrayUsername = "******";
            controller.CcTrayPassword = "******";
            controller.HttpTimeout = 30;
            controller.Configuration = @"RealUsers.xml";
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the specified player to the collection.
 /// </summary>
 /// <param name="player">The player.</param>
 public void Add(IStopper player)
 {
     lock (_syncRoot)
     {
         player.Disposed += this.Player_Disposed;
         this.Players.Add(player);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Setup Stop, Go, Stemming
        /// </summary>
        private void SetPreferences()
        {
            switch (Preferences.StemmingMode)
            {
            case 1:
                ProgressEvent(this, new ProgressEventArgs(1, "Stemming enabled."));
                _Stemmer = new PorterStemmer();         //Stemmer = new SnowStemming();
                break;

            case 2:
                ProgressEvent(this, new ProgressEventArgs(1, "Stemming enabled."));
                _Stemmer = new PorterStemmer();
                break;

            default:
                ProgressEvent(this, new ProgressEventArgs(1, "Stemming DISabled."));
                _Stemmer = new NoStemming();
                break;
            }
            switch (Preferences.StoppingMode)
            {
            case 1:
                ProgressEvent(this, new ProgressEventArgs(1, "Stop words shorter than 3 chars."));
                _Stopper = new ShortStopper();
                break;

            case 2:
                ProgressEvent(this, new ProgressEventArgs(1, "Stop words from list."));
                _Stopper = new ListStopper();
                break;

            default:
                ProgressEvent(this, new ProgressEventArgs(1, "Stopping DISabled."));
                _Stopper = new NoStopping();
                break;
            }
            switch (Preferences.GoWordMode)
            {
            case 1:
                ProgressEvent(this, new ProgressEventArgs(1, "Go Words enabled."));
                _GoChecker = new ListGoWord();
                break;

            default:
                ProgressEvent(this, new ProgressEventArgs(1, "Go Words DISabled."));
                _GoChecker = new NoGoWord();
                break;
            }
        }
Ejemplo n.º 5
0
 public double GetLength(double t, IStopper stop)
 {
     if (t <= t_start)
     {
         return(0);
     }
     else if (t >= t_finish)
     {
         return(comp.GetLength(t_finish, stop) - comp.GetLength(t_start, stop));
     }
     else
     {
         return(comp.GetLength(t, stop) - comp.GetLength(t_start, stop));
     }
 }
Ejemplo n.º 6
0
 public override double GetLength(double t, IStopper stop)
 {
     if (Count > 0 && t > 0)
     {
         int k = 0;
         for (double i = 0, j = (double)1 / Count; !(t >= i && t <= j) && j < 1; i += (double)1 / Count, j += (double)1 / Count)
         {
             k++;
         }
         return(items.FindAll(curve => items.IndexOf(curve) < k).ToList().Sum(curve => curve.GetLength(1, stop)) + items[k].GetLength((t - (double)k / Count) * Count, stop));
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 7
0
        public double GetT(double len, IStopper stop)
        {
            double t = comp.GetT(len, stop);

            if (t <= t_start)
            {
                return(0);
            }
            else if (t >= t_finish)
            {
                return(1);
            }
            else
            {
                return(t - t_start);
            }
        }
Ejemplo n.º 8
0
 public override double GetT(double len, IStopper stop)
 {
     if (Count > 0 && len > 0)
     {
         IStopper st = new StopLength();
         int      k  = 0;
         double   l1 = 0;
         for (double i = 0, j = (double)1 / Count, l2 = items[k].GetLength(1, st); !(len >= l1 && len <= l2) && j < 1; l1 = l2, l2 += items[k++].GetLength(1, st), i += (double)1 / Count, j += (double)1 / Count)
         {
             ;
         }
         return((double)k / Count + items[k].GetT(len - l1, stop));
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 9
0
 public override double GetLength(double t, IStopper stop)
 {
     if (Count > 0 && t > 0)
     {
         if (t <= 0.5)
         {
             return(items[0].GetLength(t * 2, stop));
         }
         else
         {
             return(items[0].GetLength(1, stop) + items[1].GetLength((t - 0.5) * 2, stop));
         }
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 10
0
 public override double GetT(double len, IStopper stop)
 {
     if (Count > 0 && len > 0)
     {
         double l = items[0].GetLength(1, new StopLength());
         if (len <= l)
         {
             return(items[0].GetT(len, stop));
         }
         else
         {
             return(items[1].GetT(len - l, stop));
         }
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 11
0
        public double GetLength(double t, IStopper stop)
        {
            if (t == 0)
            {
                return(0);
            }
            IPoint p1, p2;
            double a = 0;

            this.GetPoint(a, out p1);
            double len = 0;
            int    i;

            for (i = 1; stop.Stop(len, (double)i / Params.n, t); i++)
            {
                a = (double)i / Params.n;
                this.GetPoint(a, out p2);
                len += Math.Pow(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2), 0.5);
                p1   = p2;
            }
            t = len * a / t;
            return(t);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Setup Stop, Go, Stemming
 /// </summary>
 private void SetPreferences()
 {
     switch (Preferences.StemmingMode)
     {
         case 1:
             ProgressEvent(this, new ProgressEventArgs(1, "Stemming enabled."));
             _Stemmer = new PorterStemmer();	//Stemmer = new SnowStemming();
             break;
         case 2:
             ProgressEvent(this, new ProgressEventArgs(1, "Stemming enabled."));
             _Stemmer = new PorterStemmer();
             break;
         default:
             ProgressEvent(this, new ProgressEventArgs(1, "Stemming DISabled."));
             _Stemmer = new NoStemming();
             break;
     }
     switch (Preferences.StoppingMode)
     {
         case 1:
             ProgressEvent(this, new ProgressEventArgs(1, "Stop words shorter than 3 chars."));
             _Stopper = new ShortStopper();
             break;
         case 2:
             ProgressEvent(this, new ProgressEventArgs(1, "Stop words from list."));
             _Stopper = new ListStopper();
             break;
         default:
             ProgressEvent(this, new ProgressEventArgs(1, "Stopping DISabled."));
             _Stopper = new NoStopping();
             break;
     }
     switch (Preferences.GoWordMode)
     {
         case 1:
             ProgressEvent(this, new ProgressEventArgs(1, "Go Words enabled."));
             _GoChecker = new ListGoWord();
             break;
         default:
             ProgressEvent(this, new ProgressEventArgs(1, "Go Words DISabled."));
             _GoChecker = new NoGoWord();
             break;
     }
 }
Ejemplo n.º 13
0
 public abstract double GetT(double len, IStopper stop);
Ejemplo n.º 14
0
 public double GetT(double len, IStopper stop)
 {
     return(GetLength(len, stop));
 }
Ejemplo n.º 15
0
 public double GetLength(double t, IStopper stop)
 {
     return(curve.GetLength(t, stop));
 }
Ejemplo n.º 16
0
 public abstract double GetLength(double t, IStopper stop);
Ejemplo n.º 17
0
 public double GetT(double len, IStopper stop)
 {
     return(curve.GetT(len, stop));
 }
Ejemplo n.º 18
0
 public Timer(IWantToBeRun task, ISleeper sleeper,IStopper stopper)
 {
     _task = task;
     _sleeper = sleeper;
     _stopper = stopper;
 }