Example #1
0
 public override void CompTick()
 {
     base.CompTick();
     if (this.parent.Faction == Faction.OfPlayer)
     {
         if (this.AbilityData.AllPowers.Count == 0)
         {
             Pawn p = parent as Pawn;
             foreach (Apparel Ap in p.apparel.WornApparel)
             {
                 CompAbilityItem comp = Ap.TryGetComp <AbilityUser.CompAbilityItem>();
                 if (comp != null)
                 {
                     foreach (AbilityDef Pa in comp.Props.Abilities)
                     {
                         this.AddApparelAbility(Pa);
                     }
                 }
             }
             foreach (var Eq in p.equipment.AllEquipmentListForReading)
             {
                 CompAbilityItem comp = Eq.TryGetComp <AbilityUser.CompAbilityItem>();
                 if (comp != null)
                 {
                     foreach (AbilityDef Pa in comp.Props.Abilities)
                     {
                         this.AddWeaponAbility(Pa);
                     }
                 }
             }
         }
     }
 }
Example #2
0
    public Eq dsubstitute(Eq e, Eq newE)
    {
        Eq t = new Eq(this.operat, this.operand1, this.operand2);

        if (t.operat == "d")
        {
            return(new Eq("d", operand1.substitute(e, newE)));
        }
        else
        {
            if (this.operat != "")
            {
                if (operand1 != null)
                {
                    if (!operand1.print().Equals(operand1.dsubstitute(e, newE).print()))
                    {
                        return(new Eq(this.operat, operand1.dsubstitute(e, newE), this.operand2));
                    }
                }
                if (operand2 != null)
                {
                    if (!operand2.print().Equals(operand2.dsubstitute(e, newE).print()))
                    {
                        return(new Eq(this.operat, operand1, operand2.dsubstitute(e, newE)));
                    }
                }
            }
        }
        return(t);
    }
Example #3
0
 public override void RevertChanges()
 {
     Filter.RevertChanges();
     Phaser.RevertChanges();
     Flanger.RevertChanges();
     Synth.RevertChanges();
     LoFi.RevertChanges();
     RingModulator.RevertChanges();
     GuitarToBass.RevertChanges();
     SlowGear.RevertChanges();
     Transpose.RevertChanges();
     PitchBend.RevertChanges();
     Robot.RevertChanges();
     VocalDist.RevertChanges();
     Dynamics.RevertChanges();
     Eq.RevertChanges();
     Isolator.RevertChanges();
     Octave.RevertChanges();
     Pan.RevertChanges();
     Tremolo.RevertChanges();
     Slicer.RevertChanges();
     Delay.RevertChanges();
     PanningDelay.RevertChanges();
     TapeEcho.RevertChanges();
     GranularDelay.RevertChanges();
     Roll.RevertChanges();
     Chorus.RevertChanges();
     Reverb.RevertChanges();
 }
Example #4
0
        public override TreeNode GetAstCodeGenerator(SymbolTable t)
        {
            switch (op)
            {
            case "<":
                var less = new Lt((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line);
                SetGeneratorType(less);
                return(less);

            case "<=":
                var lesseq = new Leq((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line);
                SetGeneratorType(lesseq);
                return(lesseq);

            case "=":
                var eq = new Eq((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line);
                SetGeneratorType(eq);
                return(eq);

            case ">":
                var greater = new Lt((MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), Line);
                SetGeneratorType(greater);
                return(greater);

            case ">=":
                var greaterEq = new Leq((MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), Line);
                SetGeneratorType(greaterEq);
                return(greaterEq);

            default: throw new InvalidOperationException();
            }
        }
Example #5
0
    public bool find(Eq e)
    {
        Eq t = new Eq(this.operat, this.operand1, this.operand2);

        if (t.print() == e.print())
        {
            return(true);
        }
        else
        {
            if (operand2 != null)
            {
                if (t.operand2.find(e))
                {
                    return(true);
                }
                ;
            }
            if (operand1 != null)
            {
                if (t.operand1.find(e))
                {
                    return(true);
                }
                ;
            }
            return(false);
        }
    }
Example #6
0
File: Form1.cs Project: MoIdriez/SM
        private static void TestNoise()
        {
            var noise = new List <double>();

            for (int i = 0; i < 150; i++)
            {
                noise.Add(Eq.SampleGaussian(random, 0, 150));
            }

            var noise1 = new List <double>();

            for (int i = 0; i < 150; i++)
            {
                noise1.Add(Eq.SampleGaussian(random, -20, 150));
            }

            var noise2 = new List <double>();

            for (int i = 0; i < 150; i++)
            {
                noise2.Add(Eq.SampleGaussian(random, 0, -30));
            }

            var noise3 = new List <double>();

            for (int i = 0; i < 150; i++)
            {
                noise3.Add(Eq.SampleGaussian(random, 20, 30));
            }
        }
Example #7
0
        internal Arguments(string prefix, params KeyValuePair <string, string>[] pairs)
        {
            this._prefix = prefix ?? string.Empty;
            ChainableEqualizer <KeyValuePair <string, string> > chainableEqualizer = Eq <KeyValuePair <string, string> > .By((KeyValuePair <string, string> x, KeyValuePair <string, string> y) => string.Equals(x.Key, y.Key, StringComparison.OrdinalIgnoreCase), (KeyValuePair <string, string> x) => x.Key.ToLowerInvariant().GetHashCode());

            this._pairs      = ((IEnumerable <KeyValuePair <string, string> >)(pairs ?? new KeyValuePair <string, string> [0])).Distinct <KeyValuePair <string, string> >(chainableEqualizer).ToArray <KeyValuePair <string, string> >();
            this._dictionary = ((IEnumerable <KeyValuePair <string, string> >) this._pairs).ToDictionary <KeyValuePair <string, string>, string, string>((KeyValuePair <string, string> x) => x.Key, (KeyValuePair <string, string> x) => x.Value, StringComparer.OrdinalIgnoreCase);
        }
        /// <summary>
        /// Add an &lt;Eq>-Tag
        /// </summary>
        /// <returns><see cref="BaseCoreComparingGroupElement{T}"/></returns>
        public static T Eq <T>(this T parent, Action <Eq> action)
            where T : BaseCoreComparingGroupElement <T>
        {
            var eq = new Eq();

            action(eq);
            parent.Childs.Add(eq);
            return(parent);
        }
Example #9
0
        public void AddNumberValueAddsANumerValueToTheElement()
        {
            var val = Fixture.Create <double>();
            var sut = new Eq();

            sut.AddNumberValue(val);

            sut.ToString().ShouldBe(string.Format(@"<Eq><Value Type=""Number"">{0}</Value></Eq>", val));
        }
Example #10
0
        public void AddFieldRefAddsAFieldRefToTheElement()
        {
            var field = Fixture.Create <string>();
            var sut   = new Eq();

            sut.AddFieldRef(field);

            sut.ToString().ShouldBe(string.Format(@"<Eq><FieldRef Name=""{0}"" /></Eq>", field));
        }
Example #11
0
        public void Test01()
        {
            var d1 = Digit.Define(3);
            var wf = from eq in some(Eq.make <Digit>())
                     let result = eq.eq(d1, Digit.Define(3))
                                  select result ? "good" : "bad";

            claim.satisfies(wf, result => result == "good");
        }
Example #12
0
        public void EQ(float[] Data, int Length)
        {
            if (newEq != null)
            {
                eq    = newEq;
                newEq = null;
            }

            eq.EQ(Data, Length);
        }
        internal Arguments(string prefix, params KeyValuePair <string, string>[] pairs)
        {
            _prefix = prefix ?? string.Empty;

            var uniqueKeys = Eq <KeyValuePair <string, string> > .By(
                (x, y) => string.Equals(x.Key, y.Key, StringComparison.OrdinalIgnoreCase),
                x => x.Key.ToLowerInvariant().GetHashCode());

            _pairs      = (pairs ?? new KeyValuePair <string, string> [0]).Distinct(uniqueKeys).ToArray();
            _dictionary = _pairs.ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
        }
Example #14
0
        public static void EqualsTests()
        {
            Func <Type, Type, bool> eq = (x, y) => x.Equals(y);
            Func <Type, Eq <Type> > mk = t => Eq.Make(t, eq);

            Assert.Equal(mk(typeof(string)), mk(typeof(string)));
            Assert.Equal(mk(null), mk(null));
            Assert.NotEqual(mk(typeof(int)), mk(typeof(string)));
            Assert.NotEqual(mk(null), mk(typeof(string)));
            Assert.NotEqual(mk(typeof(int)), mk(null));
        }
Example #15
0
 public static int eq2num(Eq eq)
 {
     foreach (var e in alleqs)
     {
         if (eq == e.b)
         {
             return(e.a);
         }
     }
     throw new Exception("boo!");
 }
Example #16
0
    public void EqTests()
    {
        Pair a = Pair.Variable("a");
        Goal g = new Eq(a, Pair.Value("the letter a"));

        AssertResults(new string[, , ] {
            {
                { "a", "the letter a" }
            }
        }, g);
    }
        public void SortBy_CustomEqualizer_EqualizerHonored()
        {
            OrderSubject            one = new OrderSubject(1, 1), two = new OrderSubject(2, 2);
            var                     subject           = new[] { one, two };
            IEqualityComparer <int> signDoesNotMatter = Eq <int> .By(
                (x, y) => Math.Abs(x).Equals(Math.Abs(y)),
                i => Math.Abs(i).GetHashCode());

            var actual = subject.SortBy(s => s.I1, new[] { -2, 1 }, signDoesNotMatter);

            Assert.That(actual, Is.EqualTo(new[] { two, one }));
        }
    // Use this for initialization
    void Start()
    {
        sc      = GetComponent <SC>();
        sp      = GetComponent <SP>();
        eq      = GetComponent <Eq>();
        critter = GetComponent <Critter>();

        bubble = Instantiate(Resources.Load("ShieldBubble")) as GameObject;
        bubble.transform.parent        = transform;
        bubble.transform.localPosition = new Vector3(0, 0.2f, 0);
        bubble.SetActive(false);
    }
        private void SetMembers(IMenuFacade menu, HttpRequestMessage req, List <LinkRepresentation> tempLinks)
        {
            var actionFacades = menu.MenuItems.SelectMany(i => GetMenuItem(i)).Where(af => IsVisibleAndUsable(af.Item2));

            InlineActionRepresentation[] actions = actionFacades.Select(a => InlineActionRepresentation.Create(OidStrategy, req, a.Item2, Flags)).ToArray();

            var eq = new Eq();

            // todo fix distinct
            actions = actions.Distinct(eq).ToArray();

            Members = RestUtils.CreateMap(actions.ToDictionary(m => m.Id, m => (object)m));
        }
        public void Chaining_IsDestructive()
        {
            EqualitySubject x1 = new EqualitySubject("x", 1, 1m), x2 = new EqualitySubject("x", 1, 2m);
            ChainableEqualizer <EqualitySubject> sAndI = new SelectorEqualizer <EqualitySubject, string>(s => s.S)
                                                         .Then(s => s.I);

            Assert.That(sAndI.Equals(x1, x2), Is.True);

            var allProp = sAndI.Then(Eq <EqualitySubject> .By(s => s.D));

            Assert.That(allProp.Equals(x1, x2), Is.False);
            Assert.That(sAndI.Equals(x1, x2), Is.False);
        }
Example #21
0
        static void Main(string[] args)
        {
            int count_test = int.Parse(Console.ReadLine());
            Eq  comp       = new Eq();

            int[] input;
            int[] result = new int[count_test];
            int   max_st = 0;

            int[]              number;
            List <res>         check_sum    = new List <res>();
            long               countForLoop = 0;
            List <List <res> > mass_for_res = new List <List <res> >();

            for (int i = 0; i < count_test; i++)
            {
                input  = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                number = new int[input[2]];
                max_st = (int)(Math.Truncate((Math.Log(input[0], input[1]))));

                countForLoop = (int)Math.Pow((max_st + 1), (input[2]));
                mass_for_res.Clear();
                for (int j = 0; j < countForLoop - 1; j++)
                {
                    check_sum.Clear();

                    //Console.WriteLine($"{string.Join("", number)}");

                    for (int k = 0; k < input[2]; k++)
                    {
                        check_sum.Add(new Task_I_From_Olimpiada.Program.res()
                        {
                            value = (int)Math.Pow(input[1], number[k])
                        });
                    }
                    if (check_sum.Select(x => x.value).Sum() == input[0])
                    {
                        if (!mass_for_res.Contains(check_sum.OrderBy(x => x.value).ToList(), comp))
                        {
                            result[i]++;
                            mass_for_res.Add(check_sum.OrderBy(x => x.value).ToList());
                        }
                    }
                    increment(input[2], max_st, number);
                }
            }
            for (int i = 0; i < count_test; i++)
            {
                Console.WriteLine(result[i]);
            }
        }
Example #22
0
        public void Chaining_IsDestructive()
        {
            EqualitySubject x1 = new EqualitySubject("x", 1, 1m), x2 = new EqualitySubject("x", 1, 2m);

            ChainableEqualizer <EqualitySubject> sAndI = new DelegatedEqualizer <EqualitySubject>((x, y) => x.S.Equals(y.S), Hasher.Zero)
                                                         .Then((x, y) => x.I.Equals(y.I), Hasher.Zero);

            Assert.That(sAndI.Equals(x1, x2), Is.True);

            var allProp = sAndI.Then(Eq <EqualitySubject> .By((x, y) => x.D.Equals(y.D), x => x.D.GetHashCode()));

            Assert.That(allProp.Equals(x1, x2), Is.False);
            Assert.That(sAndI.Equals(x1, x2), Is.False);
        }
Example #23
0
    public void unsubstitute(Eq eqbefore, Eq eqafter)
    {
        string prevEq = currentEquation.print();

        eqafter         = eqafter.substitute(new Eq("★"), substitutions);
        eqafter         = eqafter.substitute(new Eq("◎"), substitutionc);
        currentEquation = currentEquation.substitute(eqbefore, eqafter);
        if (!prevEq.Equals(currentEquation.print()))
        {
            currentEquation     = currentEquation.substitute(new Eq("◎"), new Eq("★"));
            substitutions       = substitutionc;
            starAvailable       = true;
            currentFormula.text = currentEquation.print();
            fullFormula.text   += "\n" + currentEquation.print();
            if (yexist)
            {
                if (eqbefore.print().Contains("x") || eqbefore.print().Contains("y"))
                {
                    if (currentEquation.find(answer))
                    {
                        pm.ProbSolved();
                        pm.transGlow.SetActive(false);
                        for (int i = 0; i < 5; i++)
                        {
                            PracTranss[i].GetComponent <PracTrans>().eq = new Eq("");
                            PracTranss[i].GetComponent <PracTrans>().setEq();
                        }
                    }
                }
            }
            else if (currentEquation.find(answer))
            {
                pm.ProbSolved();
                pm.transGlow.SetActive(false);
                for (int i = 0; i < 5; i++)
                {
                    PracTranss[i].GetComponent <PracTrans>().eq = new Eq("");
                    PracTranss[i].GetComponent <PracTrans>().setEq();
                }
            }
            else
            {
                pm.transGlow.SetActive(true);
            }
        }
        else
        {
            pm.ProbFailed();
        }
    }
Example #24
0
        public TablaPage(Page prev)
        {
            previous = prev;
            InitializeComponent();

            List <Equipo>     equipos  = App.EquipoController.GetAll();
            List <Eq>         eq_show  = new List <Eq>();
            List <Calendario> partidos = App.CalendarioController.GetAll().FindAll(x => x.ganador != 0);
            List <Gol>        goles    = App.GolController.GetAll();

            foreach (Equipo E in equipos)
            {
                Eq                eq         = new Eq();
                List <Gol>        myGoles    = goles.FindAll(x => x.equipo == E.id);
                List <Calendario> myMatches  = partidos.FindAll(X => X.local == E.Nombre || X.visitante == E.Nombre);
                List <Gol>        golesOnMyP = new List <Gol>();

                foreach (Calendario partido in myMatches)
                {
                    golesOnMyP.AddRange(goles.FindAll(z => z.clave_partido == partido.id));
                }

                eq.Nombre    = E.Nombre;
                eq.PartidosJ = myMatches.Count;
                eq.PartidosG = myMatches.FindAll(x => x.ganador == E.id).Count;
                eq.PartidosE = myMatches.FindAll(x => x.ganador == -1).Count;
                eq.PartidosP = eq.PartidosJ - eq.PartidosE - eq.PartidosG;

                eq.Puntos     = eq.PartidosG * 3 + eq.PartidosE;
                eq.Golesf     = myGoles.Count;
                eq.Golesc     = golesOnMyP.FindAll(x => x.equipo != E.id).Count;
                eq.Diferencia = eq.Golesf - eq.Golesc;

                eq_show.Add(eq);
            }

            IEnumerable <Eq> eordered = eq_show.OrderByDescending(z => z.Puntos);

            int i = 1;

            foreach (Eq equipo in eordered)
            {
                equipo.Pos = i;
                i++;
            }


            tabla.ItemsSource = eq_show;
        }
Example #25
0
        internal Arguments(string prefix, params KeyValuePair <string, string>[] pairs)
        {
            this._prefix = prefix ?? string.Empty;
            bool equals(KeyValuePair <string, string> x, KeyValuePair <string, string> y) => string.Equals(x.Key, y.Key, StringComparison.OrdinalIgnoreCase);

            ChainableEqualizer <KeyValuePair <string, string> > chainableEqualizer = Eq <KeyValuePair <string, string> > .By(equals, x => x.Key.ToLowerInvariant().GetHashCode());

            _pairs = ((IEnumerable <KeyValuePair <string, string> >)(pairs ?? new KeyValuePair <string, string> [0])).Distinct(chainableEqualizer).ToArray();
            KeyValuePair <string, string>[] pairs1 = _pairs;
            string keySelector(KeyValuePair <string, string> x) => x.Key;

            StringComparer ordinalIgnoreCase = StringComparer.OrdinalIgnoreCase;

            _dictionary = ((IEnumerable <KeyValuePair <string, string> >)pairs1).ToDictionary(keySelector, x => x.Value, ordinalIgnoreCase);
        }
Example #26
0
        public static void Test()
        {
            // 1 + 2
            Expr OnePlusTwo = new Add(new IntVal(1), new IntVal(2));

            // true == false
            Expr TrueEqFalse = new Eq(new BoolVal(true), new BoolVal(false));

            // 1 + true
            // CS1503 引数 2: 无法从 'GADT.BoolVal' 转换成 'GADT.Expr<int>'
            //Expr OnePlusTrue = new Add(new IntVal(1), new BoolVal(true));

            // true == 42
            // CS1503 引数 2: 无法从 'GADT.IntVal' 转换成 'GADT.Expr<bool>'
            // Expr TrueEq42 = new Eq(new BoolVal(true), new IntVal(42));
        }
        public void ToHashSet_OnlyComparer_HashSetWithUniqueMembersAsComparer()
        {
            IEnumerable <DerivedType> subject = new[]
            {
                new DerivedType("one", 1),
                new DerivedType("two", 2),
                new DerivedType("ONE", 1)
            };
            IEqualityComparer <DerivedType> comparer = Eq <DerivedType> .By(
                (x, y) => x.Name.Equals(y.Name, StringComparison.OrdinalIgnoreCase),
                Hasher.Zero);

            HashSet <DerivedType> set = subject.ToHashSet(comparer);

            Assert.That(set, Has.Count.EqualTo(2));
        }
Example #28
0
        public EqualizerDSP(int NumBands, int SampleRate, float[] EqValues)
        {
            sampleRate = SampleRate;
            numBands   = NumBands;

            if (NumBands == 30)
            {
                NumBands = 31;
            }

            eq = new Eq(NumBands, SampleRate);

            this.EqValues = EqValues;

            newEq = null;
        }
        public void Explore()
        {
            IEqualityComparer <EqualitySubject> subject = new SelectorEqualizer <EqualitySubject, int>(s => s.I);

            Assert.That(subject.Equals(new EqualitySubject {
                I = 1
            }, new EqualitySubject {
                I = 2
            }), Is.False);
            Assert.That(subject.GetHashCode(new EqualitySubject {
                I = 1
            }), Is.EqualTo(1.GetHashCode()));

            IEqualityComparer <EqualitySubject> byDAndI = new SelectorEqualizer <EqualitySubject, decimal>(s => s.D)
                                                          .Then(s => s.I);

            byDAndI = Eq <EqualitySubject> .By(s => s.D)
                      .Then(s => s.I);
        }
Example #30
0
    public void substitutex(Eq eq)
    {
        string symbol;

        if (starAvailable)
        {
            symbol        = "★";
            starAvailable = false;
            substitutions = eq;
        }
        else
        {
            symbol        = "◎";
            substitutionc = eq;
        }

        currentEquation     = currentEquation.dsubstitute(eq, new Eq(symbol));
        currentFormula.text = currentEquation.print();
        fullFormula.text   += "\n" + currentEquation.print();
        //SetTools();
    }
Example #31
0
 public CamlWhere GetTestQuery3()
 {
     var eq = new Eq<bool>("IsCompleted", false, FieldType.Boolean);
     eq.FieldRef.Nullable = true;
     return new CamlWhere(eq);
 }