Example #1
0
        public Dictionary <String, List <Point> > GetNoise(TFilterType FilterType, int N = 1024, int PeriodsCount = 2)
        {
            var tempSets = new Dictionary <String, List <Point> >();

            if (noise == null)
            {
                noise = GetNoisePoints(B_1, B_1 / B_2_COEF, N, PeriodsCount);
            }

            tempSets.Add("Noise", noise);

            switch (FilterType)
            {
            case TFilterType.None:
                break;

            case TFilterType.SlidingAverage:
                tempSets.Add("Sliding Average Filter", Restorer.DoSlidingAverageFilter(noise, Sli_K));
                break;

            case TFilterType.Mediana:
                tempSets.Add("Mediana Filter", Restorer.DoMedianFilter(noise, N, Med_K));
                break;

            case TFilterType.Parabolic:
                tempSets.Add("Parabolic Smoothing", Restorer.DoParabolicSmoothing(noise));
                break;

            default:
                break;
            }

            return(tempSets);
        }
Example #2
0
        static void Main(string[] args)
        {
            //Command
            Console.WriteLine("Command");
            Invoker     invoker  = new Invoker();
            Receiver    receiver = new Receiver();
            JumpCommand command  = new JumpCommand(receiver);

            invoker.SetCommand(command);
            receiver.WriteState();
            invoker.Operation();
            receiver.WriteState();

            Console.WriteLine();

            //State
            Console.WriteLine("State");
            MyObject myObject = new MyObject();

            myObject.ChangeState(new DuckingState());
            myObject.HandleInput(Input._UP);
            myObject.HandleInput(Input._DOWN);

            Console.WriteLine();

            //Memento
            Console.WriteLine("Memento");
            Memento  memento  = myObject.CreateMemento();
            Restorer restorer = new Restorer(myObject, memento);

            myObject.HandleInput(Input._UP);
            restorer.SetMemento();
            myObject.HandleInput(Input._UP);

            Console.WriteLine();

            //Strategy
            Console.WriteLine("Strategy");
            ConcreteStrategy1 concreteStrategy1 = new ConcreteStrategy1();
            ConcreteStrategy2 concreteStrategy2 = new ConcreteStrategy2();
            Context           context           = new Context(concreteStrategy1);

            context.ExecuteAlgorithm();
            Console.WriteLine("Next algorithm");
            context.ContextStrategy = concreteStrategy2;
            context.ExecuteAlgorithm();

            Console.WriteLine();

            //Observer
            Console.WriteLine("Observer");
            ConcreteObservable concreteObservable = new ConcreteObservable();
            ConcreteObserver   concreteObserver   = new ConcreteObserver();

            concreteObservable.AddObserver(concreteObserver);
            concreteObservable.NotifyObservers();


            Console.ReadLine();
        }
Example #3
0
        public Dictionary <String, List <Point> > GetAmplSpectre(TFilterType FilterType, int N = 1024, int PeriodsCount = 2)
        {
            var tempSets = new Dictionary <String, List <Point> >();

            if (noise == null)
            {
                noise = GetNoisePoints(B_1, B_1 / B_2_COEF, N, PeriodsCount);
            }

            tempSets.Add("Noise Amplitude Spectre", FurieSpectres.GetAmplSpectre(noise, N));

            switch (FilterType)
            {
            case TFilterType.None:
                break;

            case TFilterType.SlidingAverage:
                var SAfiltered = Restorer.DoSlidingAverageFilter(noise, Sli_K);
                tempSets.Add("Sliding Average Filter Amplitude Spectre", FurieSpectres.GetAmplSpectre(SAfiltered, SAfiltered.Count));
                break;

            case TFilterType.Mediana:
                var Mfiltered = Restorer.DoMedianFilter(noise, N, Med_K);
                tempSets.Add("Mediana Filter Amplitude Spectre", FurieSpectres.GetAmplSpectre(Mfiltered, Mfiltered.Count));
                break;

            case TFilterType.Parabolic:
                var Pfiltered = Restorer.DoParabolicSmoothing(noise);
                tempSets.Add("Parabolic Smoothing Amplitude Spectre", FurieSpectres.GetAmplSpectre(Pfiltered, Pfiltered.Count));
                break;

            default:
                break;
            }

            return(tempSets);
        }