• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Signal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Signal的典型用法代码示例。如果您正苦于以下问题:C# Signal类的具体用法?C# Signal怎么用?C# Signal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Signal类属于命名空间,在下文中一共展示了Signal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Particle

        public Particle(Signal signal)
        {
            this.done = false;

            // Init the seek and flee
            seek = new Seek();
            seek.endingRadius = 0;

            // Initialize the origin and target
            origin.position = new Vector3(signal.origin.point.X, signal.origin.point.Y, 0);
            target.position = new Vector3(signal.location.X, signal.location.Y, 0);

            // Now move the origin a little
            int alpha = GameMode.random.Next(10, 50);
            int beta = GameMode.random.Next(10, 50);

            float x = (float)GameMode.random.NextDouble() * 2 * alpha - alpha;
            float y = (float)GameMode.random.NextDouble() * 2 * beta - beta;

            origin.position += new Vector3(x, y, 0);

            // And now the target
            alpha = GameMode.random.Next(0, 100);
            beta = GameMode.random.Next(0, 100);

            x = (float)GameMode.random.NextDouble() * 2 * alpha - alpha;
            y = (float)GameMode.random.NextDouble() * 2 * beta - beta;

            target.position += new Vector3(x, y, 0);
        }
开发者ID:jennydvr,项目名称:ColorWars,代码行数:30,代码来源:Particle.cs


示例2: EnterSignal

 public override bool EnterSignal(Signal signal, Port parent, bool again, bool root)
 {
     if(again)
         return false;
     _signals.Add(signal);
     return true;
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:CollectVisitor.cs


示例3: Import

        public Signal Import(FileInfo file)
        {
            string textFromFile;
            using (StreamReader sr = file.OpenText())
            {
                textFromFile = sr.ReadToEnd();
            }
            textFromFile = textFromFile.Replace('.', ',');
            textFromFile = textFromFile.Trim('\n', ' ');
            string[] txtValues =  textFromFile.Split(' ', '\n', '\t');
            double[] values = new double[txtValues.Length];
            for (int i = 0; i < txtValues.Length; ++i)
                values[i] = double.Parse(txtValues[i]);

            if (values.Length < 2)
            {
                throw new Exception("Should be at least 2 values in file!");
            }
            try
            {
                var s = new Signal(values, file.Name.Remove(file.Name.Length - 4));
                return s;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:kverhun,项目名称:SignalProcessor,代码行数:28,代码来源:ImporterTxt.cs


示例4: RegisterTheorems

        public static void RegisterTheorems(ILibrary library)
        {
            Analysis.DerivativeTransformation.Provider.Add(
                new Analysis.DerivativeTransformation(_entityId,
                delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs)
                {
                    Signal[] outputs = new Signal[manipulatedInputs.Count];
                    ReadOnlySignalSet cotangents = StdBuilder.Cotangent(port.InputSignals);
                    for(int i = 0; i < outputs.Length; i++)
                        outputs[i] = Std.Multiply(port.OutputSignals[i], cotangents[i], manipulatedInputs[i]);
                    return StdBuilder.Negate(outputs);
                }));

            MathIdentifier typeId = new MathIdentifier("TrigonometricSubstitute", "Std");
            ITheoremProvider basicProvider;
            if(!library.TryLookupTheoremType(typeId, out basicProvider))
            {
                basicProvider = Binder.GetInstance<ITransformationTheoremProvider, MathIdentifier>(typeId);
                library.AddTheoremType(basicProvider);
            }
            ((ITransformationTheoremProvider)basicProvider).Add(
                new BasicTransformation(_entityId.DerivePostfix("TrigonometricSubstitute"), typeId,
                delegate() { return new Pattern(new EntityCondition(_entityId)); },
                delegate(Port port) { return ManipulationPlan.DoAlter; },
                delegate(Port port, SignalSet transformedInputs, bool hasTransformedInputs)
                {
                    return StdBuilder.Invert(StdBuilder.Sine(transformedInputs));
                    //Signal[] ret = new Signal[transformedInputs.Count];
                    //for(int i = 0; i < ret.Length; i++)
                    //    ret[i] = Std.Invert(Std.Sine(transformedInputs[i]));
                    //return ret;
                }));
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:33,代码来源:CosecantArchitectures.cs


示例5: EnterPort

 public override bool EnterPort(Port port, Signal parent, bool again, bool root)
 {
     if(again)
         return false;
     _ports.Add(port);
     return true;
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:CollectVisitor.cs


示例6: GenericFunctionProcess

        protected GenericFunctionProcess(bool[] inInput, bool[] inInternal, bool[] outOutput, bool[] outInternal)
        {
            if(inInput == null)
                throw new ArgumentNullException("inInput");
            if(inInternal == null)
                throw new ArgumentNullException("inInternal");
            if(outOutput == null)
                throw new ArgumentNullException("outOutput");
            if(outInternal == null)
                throw new ArgumentNullException("outInternal");

            this.inInput = inInput;
            this.inInternal = inInternal;
            this.outOutput = outOutput;
            this.outInternal = outInternal;

            //count mapped signals
            for(int i = 0; i < inInput.Length; i++)
                if(inInput[i]) inCount++;
            for(int i = 0; i < inInternal.Length; i++)
                if(inInternal[i]) inCount++;
            for(int i = 0; i < outOutput.Length; i++)
                if(outOutput[i]) outCount++;
            for(int i = 0; i < outInternal.Length; i++)
                if(outInternal[i]) outCount++;

            inputs = new Signal[inCount];
            outputs = new Signal[outCount];
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:29,代码来源:GenericFunctionProcess.cs


示例7: Form1_FormClosing

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            degreesSignal.Stop();
            degreesSignal.Dispose();
            degreesSignal = null;

            radiansSignal.Dispose();
            radiansSignal = null;

            sineSignal.Dispose();
            sineSignal = null;

            cosineSignal.Dispose();
            cosineSignal = null;

            signalTickCount.Dispose();
            signalTickCount = null;

            intervalChanged.Dispose();
            intervalChanged = null;

            runningEvent.Dispose();
            runningEvent = null;

            intervalBehavior.Dispose();
            intervalBehavior = null;

            runningBehavior.Dispose();
            runningBehavior = null;
        }
开发者ID:jerometerry,项目名称:potassium,代码行数:30,代码来源:Form1.cs


示例8: MonomialDegree

 public static IValueStructure MonomialDegree(Signal signal, Signal[] generalizedVariables)
 {
     if(Std.IsConstantAdditiveIdentity(signal))
         return NegativeInfinitySymbol.Instance;
     if(Array.Exists<Signal>(generalizedVariables, signal.Equals))
         return IntegerValue.One;
     if(!Array.Exists<Signal>(generalizedVariables, signal.DependsOn))
         return IntegerValue.Zero;
     ISignalSet factors;
     long deg = 0;
     if(signal.IsDrivenByPortEntity("Multiply", "Std"))
         factors = signal.DrivenByPort.InputSignals;
     else
         factors = new SignalSet(signal);
     for(int i = 0; i < factors.Count; i++)
     {
         if(Array.Exists<Signal>(generalizedVariables, factors[i].Equals))
             deg++;
         else if(factors[i].IsDrivenByPortEntity("Power", "Std"))
         {
             Signal b = signal.DrivenByPort.InputSignals[0];
             Signal e = signal.DrivenByPort.InputSignals[1];
             IntegerValue v;
             if(Array.Exists<Signal>(generalizedVariables, b.Equals) && (v = e.Value as IntegerValue) != null && v.Value > 0)
                 deg += v.Value;
         }
     }
     return new IntegerValue(deg);
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:29,代码来源:GeneralizedPolynomial.cs


示例9: DescriptionTest

        public void DescriptionTest()
        {
            var s = new Signal();
            s.Description = null;

            var validDescription = string.Empty;
            var random = new Random(1);
            for (int i = 0; i < Signal.MaxDescriptionLength; i++)
            {
                validDescription +=(char) random.Next(1, 255);
            }

            try
            {
                s.Description = validDescription;
            }
            catch (Exception)
            {
                Assert.Fail("Exception should not have been thrown.");
            }

            var invalidDescription = validDescription + (char)random.Next(1,255);
            try
            {
                s.Description = invalidDescription;
                Assert.Fail("ArgumentException should have been thrown.");
            }
            catch (ArgumentException)
            {
            }
            Wfdb.Quit();
        }
开发者ID:BoutemineOualid,项目名称:WfdbCsharpWrapper,代码行数:32,代码来源:SignalTests.cs


示例10: LogArgs

		public LogArgs( string str, LogType p, Signal s )
		{
			Message = str;
			Type = p;
			sig = s;
			timestamp = DateTime.Now;		   
		}
开发者ID:tgckpg,项目名称:libpenguin,代码行数:7,代码来源:LogArgs.cs


示例11: IsMonomial

 public static bool IsMonomial(Signal signal, Signal[] generalizedVariables)
 {
     if(signal.IsDrivenByPortEntity("Multiply", "Std"))
         return signal.DrivenByPort.InputSignals.TrueForAll(delegate(Signal s) { return IsMonomialFactor(s, generalizedVariables); });
     else
         return IsMonomialFactor(signal, generalizedVariables);
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:GeneralizedPolynomial.cs


示例12: JuliaFractal

 public JuliaFractal(String algebra, String function, int precision, int iterations,
     Point3 location = null, float x = -0.162f, float y = 0.163f, float z = 0.560f, float k = -0.599f,
     Signal<float> rx = null, Signal<float> ry = null, Signal<float> rz = null, Signal<float> rk = null,
     Point3 rotation = null, PovTexture texture = null, String finish = null, bool reactive = false)
 {
     this.reactive = reactive;
     this.loc = location ?? new Point3(0, 0, 0, reactive: reactive);
     this.rot = rotation ?? new Point3(0, 0, 0, reactive: reactive);
     this.tex = texture ?? new POVColor("Red");
     this.finish = finish ?? "finish {phong .9 reflection .5}";
     this.x = rx ?? new Lift0f(x);
     this.y = ry ?? new Lift0f(y);
     this.z = rz ?? new Lift0f(z);
     this.k = rk ?? new Lift0f(k);
     if (algebra.Equals("quaternion"))
     {
         this.algebra = algebra;
     }
     else if (algebra.Equals(" hypercomplex"))
     {
         this.algebra = algebra;
     }
     else this.algebra = "quaternion";
     this.precision = precision;
     this.iterations = iterations;
     this.function = function;
 }
开发者ID:TheAwesomePossum,项目名称:VisualPOVray,代码行数:27,代码来源:JuliaFractal.cs


示例13: FulfillsCondition

 public override bool FulfillsCondition(Signal output, Port port)
 {
     foreach(Condition c in _conditions)
         if(!c.FulfillsCondition(output, port))
             return false;
     return true;
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:AndCondition.cs


示例14: RaiseSignal

        public bool RaiseSignal(Signal signal, long? id)
        {
            switch (signal)
            {
                case Signal.SOMEONE_WON:
                    foreach (var trigger in m_winTriggers)
                        if (trigger.IsTrue || trigger.RaiseSignal(signal, id))
                        { //Won!
                            trigger.DisplayMessage(true);
                            Won = true;
                            return true;
                        }

                    foreach (var trigger in m_loseTriggers)
                        if (trigger.IsTrue || trigger.RaiseSignal(signal, id))
                        {//Lost
                            trigger.DisplayMessage(false);
                            Lost = true;
                            return true;
                        }
                    return false;
                    break;

                default:
                    Debug.Assert(false,"Wrong signal received");
                    return false;
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:29,代码来源:MyMissionTriggers.cs


示例15: ProcessFilter

        /// <summary>
        ///   Applies the filter to a signal.
        /// </summary>
        protected unsafe override void ProcessFilter(Signal sourceData, Signal destinationData)
        {
            SampleFormat format = sourceData.SampleFormat;
            int samples = sourceData.Samples;

            if (format == SampleFormat.Format32BitIeeeFloat)
            {
                float* src = (float*)sourceData.Data.ToPointer();
                float* dst = (float*)destinationData.Data.ToPointer();

                for (int i = 0; i < samples; i++, dst++, src++)
                    *dst = System.Math.Abs(*src);
            }
            else if (format == SampleFormat.Format128BitComplex)
            {
                Complex* src = (Complex*)sourceData.Data.ToPointer();
                Complex* dst = (Complex*)destinationData.Data.ToPointer();

                Complex c = new Complex();

                for (int i = 0; i < samples; i++, dst++, src++)
                {
                    c.Re = (*src).Magnitude;
                    *dst = c;
                }
            }
        }
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:30,代码来源:WaveRectifier.cs


示例16: HandleSignal

		public override void HandleSignal(Signal signal)
		{
			if (signal is Stimulation)
			{
				var stimulation = signal as Stimulation;
				var affinity = Pattern.Affinity(stimulation.Peptide, AffinityType.Euclidean);

				if (affinity >= Globals.HelperAffinityThreashold)
				{
					peptideAffinitySum += affinity;
					costimulationSum += stimulation.Concentration;
					Activators.Add(stimulation.Sender);

					if (!Activated && peptideAffinitySum + costimulationSum > Globals.HelperActivationThreshold)
					{
						Activated = true;

						//Secrete(new Cytokine(Address, CytokineType.IL2, costimulationSum));	// TODO: X64 stimulates growth and differentiation of T cell response
						//Secrete(new Cytokine(Address, CytokineType.IL4, costimulationSum));	// TODO: X64 stimulates proliferation and differentiation

						string nodes = "";
						foreach (var activator in Activators)
						{
							nodes += activator + ",";
						}
						Log("ALARM: Attack detected in node " + nodes.TrimEnd(new char[] { ',' }), LogLevel.Major);

						// die after activation
						Apoptosis();
					}
				}
			}
			base.HandleSignal(signal);
		}
开发者ID:sawat80,项目名称:Simulais,代码行数:34,代码来源:HelperTCell.cs


示例17: UsingPInvoke

        private static void UsingPInvoke(int frequency)
        {
            try
            {
                Frequency f = frequency;
                Sample[] v = new Sample[2];
                Signal[] s = new Signal[2];
                Time t = 0, t0 = 0, t1 = 0;

                if (f <= 0)
                    f = PInvoke.sampfreq("data/100s");

                if (PInvoke.isigopen("data/100s", s, 2) < 1)
                    return;
                PInvoke.setifreq(f);
                t0 = PInvoke.strtim("1");
                PInvoke.isigsettime(t);
                t1 = PInvoke.strtim("2");
                for (t = t0; t <= t1; t++)
                {
                    if (PInvoke.getvec(v) < 0)
                        break;
                    Console.WriteLine("{0}\t{1}", v[0], v[1]);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:BoutemineOualid,项目名称:WfdbCsharpWrapper,代码行数:30,代码来源:psamplex.cs


示例18: WaveTexture

 public WaveTexture(String color1, String color2, float scale = .1f, Signal<float> rscale = null, bool reactive = false)
 {
     this.scale = rscale ?? new Lift0f(scale);
     this.color1 = color1;
     this.color2 = color2;
     this.reactive = reactive;
 }
开发者ID:TheAwesomePossum,项目名称:VisualPOVray,代码行数:7,代码来源:WaveTexture.cs


示例19: FulfillsCondition

        public override bool FulfillsCondition(Signal output, Port port)
        {
            if(port == null)
                return false;

            return port.HasArchitectureLink && _match(port.CurrentArchitecture);
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:ArchitectureCondition.cs


示例20: SignalSoundEvent

 /**
  * create an event containing a signal, which modifies properties of the parent
  * event during rendering. Modifier types to be chosen from SignalSoundEvent.Modifier
  */
 public SignalSoundEvent(SignalSoundEvent.Modifier modifierType , Signal sig)
     : base()
 {
     _sig = sig;
     _modif = modifierType;
     UpdateDuration(_sig.Duration);
 }
开发者ID:IndiegameGarden,项目名称:TTengine,代码行数:11,代码来源:SignalSoundEvent.cs



注:本文中的Signal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Signature类代码示例发布时间:2022-05-24
下一篇:
C# SignInRequestMessage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap