示例#1
0
        public static string ToString(this long value, Multiple multiple)
        {
            var bp = _multiples[multiple].FirstOrDefault(p => 0 < value / p.Integer) ?? BinaryPrefix.None;
            var n  = Math.Round((double)value / bp.Integer, 3);

            return(string.Format("{0:0.000}{1}", n, bp.Symbol));
        }
示例#2
0
 protected override void OnDecode(ByteBuffer buffer, int count)
 {
     if (count-- > 0)
     {
         this.SaslServerMechanisms = AmqpCodec.DecodeMultiple<AmqpSymbol>(buffer);
     }
 }
示例#3
0
    protected static Func <EffectResolved, Maybe <ProposedReaction> > CreateMaybeEffect(IDictionary <int, Member> members, int possessingMemberId, Member originator, ReactionCardType reaction, Func <EffectResolved, bool> condition) =>
    effect =>
    {
        var reactingMaybeMember = effect.Target.Members.Where(m => m.Id == possessingMemberId);
        if (reactingMaybeMember.None() || !condition(effect))
        {
            return(Maybe <ProposedReaction> .Missing());
        }

        var possessor = reactingMaybeMember.First();
        var action    = reaction.ActionSequence;
        var reactor   = action.Reactor == ReactiveMember.Originator ? originator : possessor;

        Target target = new Single(possessor);
        if (action.Scope == ReactiveTargetScope.Attacker)
        {
            target = new Single(effect.Source);
        }
        if (action.Scope == ReactiveTargetScope.AllEnemies)
        {
            target = new Multiple(members.Values.Where(x => x.IsConscious() && x.TeamType == TeamType.Enemies).ToArray());
        }
        // TODO: Implement other scopes

        return(new ProposedReaction(reaction, reactor, target));
    };
示例#4
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Context != null?Context.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (DefaultValue != null ? DefaultValue.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Label != null ? Label.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Required.GetHashCode();
                hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Min;
                hashCode = (hashCode * 397) ^ Max;
                hashCode = (hashCode * 397) ^ Stepsize;
                hashCode = (hashCode * 397) ^ (Pattern != null ? Pattern.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ ReadOnly.GetHashCode();
                hashCode = (hashCode * 397) ^ Multiple.GetHashCode();
                hashCode = (hashCode * 397) ^ MultipleLimit;
                hashCode = (hashCode * 397) ^ (GroupName != null ? GroupName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Advanced.GetHashCode();
                hashCode = (hashCode * 397) ^ Verify.GetHashCode();
                hashCode = (hashCode * 397) ^ LimitToOptions.GetHashCode();
                hashCode = (hashCode * 397) ^ (Unit != null ? Unit.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (UnitLabel != null ? UnitLabel.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Options != null ? Options.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (FilterCriteria != null ? FilterCriteria.GetHashCode() : 0);
                return(hashCode);
            }
        }
示例#5
0
 protected override void OnDecode(ByteBuffer buffer, int count)
 {
     if (count-- > 0)
     {
         this.SaslServerMechanisms = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);
     }
 }
示例#6
0
        public void AmqpCodecMultipleTest()
        {
            byte[]     workBuffer = new byte[2048];
            ByteBuffer buffer     = new ByteBuffer(workBuffer);

            Multiple <int>        nullValue   = null;
            Multiple <string>     oneValue    = new Multiple <string>(new string[] { strValue });
            Multiple <Guid>       twoValues   = new Multiple <Guid>(new Guid[] { uuidValue, uuidValue });
            Multiple <AmqpSymbol> threeValues = new Multiple <AmqpSymbol>(new AmqpSymbol[] { "sym1", "sym2", "sym3" });

            AmqpCodec.EncodeMultiple <int>(nullValue, buffer);
            AmqpCodec.EncodeMultiple <string>(oneValue, buffer);
            AmqpCodec.EncodeMultiple <Guid>(twoValues, buffer);
            AmqpCodec.EncodeMultiple <AmqpSymbol>(threeValues, buffer);

            Multiple <int>        nullDecoded  = AmqpCodec.DecodeMultiple <int>(buffer);
            Multiple <string>     oneDecoded   = AmqpCodec.DecodeMultiple <string>(buffer);
            Multiple <Guid>       twoDecoded   = AmqpCodec.DecodeMultiple <Guid>(buffer);
            Multiple <AmqpSymbol> threeDecoded = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer);

            Assert.True(nullDecoded == null, "the null multiple value is not null");
            Assert.True(Multiple <string> .Intersect(oneValue, oneDecoded).Count == 1, "multiple of one string value failed");
            Assert.True(Multiple <Guid> .Intersect(twoValues, twoDecoded).Count == 2, "multiple of two uuid values failed");
            Assert.True(Multiple <AmqpSymbol> .Intersect(threeValues, threeDecoded).Count == 3, "multiple of three symbol values failed");
        }
        /// <summary>
        /// Constructeur vide par défaut
        /// </summary>
        public MainWindowViewModel()
        {
            Multiples  = Multiple.GetMultiples();
            Tolerances = Tolerance.GetTolerances();
            TemperatureCoefficients = TemperatureCoefficient.GetTemperatureCoefficients();
            ESeries       = ESerie.GetESeries();
            ResistorRings = ResistorRing.GetResistorRings();
            Rings1        = Ring.GetRings().Where(x => x.Digit != null).OrderBy(x => x.DigitOrder).ToList();
            Rings2        = Ring.GetRings().Where(x => x.Digit != null).OrderBy(x => x.DigitOrder).ToList();
            Rings3        = Ring.GetRings().Where(x => x.Digit != null).OrderBy(x => x.DigitOrder).ToList();
            Rings4        = Ring.GetRings().Where(x => x.Multiplicator != null).OrderBy(x => x.MultiplicatorOrder).ToList();
            Rings5        = Ring.GetRings().Where(x => x.Tolerance != null).OrderBy(x => x.ToleranceOrder).ToList();
            Rings6        = Ring.GetRings().Where(x => x.TemperatureCoefficient != null).OrderBy(x => x.TemperatureCoefficientOrder).ToList();

            Ring        blackRing = Rings1.Where(x => x.Digit == 0).Single();
            List <Ring> except    = new List <Ring>()
            {
                blackRing
            };

            SetRing5Color(Rings5.OrderBy(a => a.Tolerance.Index == 2).First());
            SetRing1Color(Rings1.Except(except).ToList().OrderBy(a => Guid.NewGuid()).First());
            SetRing2Color(Rings2.OrderBy(a => Guid.NewGuid()).First());
            SetRing4Color(Rings4.OrderBy(a => Guid.NewGuid()).First());
        }
示例#8
0
        public JsonResult validaHoja3()
        {
            DataSet         ds3 = (DataSet)Session["ds3"];
            List <Multiple> lm  = new List <Multiple>();

            for (int i = 1; i < ds3.Tables[0].Rows.Count; i++)
            {
                Multiple doc = new Multiple();

                string num_doc     = ds3.Tables[0].Rows[i][0].ToString().Trim();
                string factura     = ds3.Tables[0].Rows[i][1].ToString().Trim();
                string bill_doc    = ds3.Tables[0].Rows[i][2].ToString().Trim();
                string ejerciciok  = ds3.Tables[0].Rows[i][3].ToString().Trim();
                string payer       = ds3.Tables[0].Rows[i][4].ToString().Trim();
                string importe_fac = ds3.Tables[0].Rows[i][5].ToString().Trim();
                string belnr       = ds3.Tables[0].Rows[i][6].ToString().Trim();

                doc.NUM_DOC     = num_doc;
                doc.FACTURA     = factura;
                doc.BILL_DOC    = bill_doc;
                doc.EJERCICIOK  = ejerciciok;
                doc.PAYER       = payer;
                doc.IMPORTE_FAC = importe_fac;
                doc.BELNR       = belnr;

                lm.Add(doc);
            }

            JsonResult jl = Json(lm, JsonRequestBehavior.AllowGet);

            return(jl);
        }
示例#9
0
        static void Main(string[] args)
        {
            int      max = 5;
            double   x   = 3;
            Multiple mul = i =>
            {
                double p = 1;
                for (int j = 1; j <= max; j++)
                {
                    p = p * i * x / j;
                }
                return(p);
            };
            Sum sum = () =>
            {
                double Sum = 0;
                for (int j = 1; j <= max; j++)
                {
                    Sum += mul(j);
                }
                return(Sum);
            };

            Console.WriteLine(sum());
            Console.ReadKey();
        }
示例#10
0
        static void Main(string[] args)
        {
            List <int> ListofNumbers = new List <int>();

            Console.WriteLine("Enter the Size of List : ");
            int Size = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter {0} numbers : ", Size);
            for (int i = 0; i < Size; i++)
            {
                int Value = int.Parse(Console.ReadLine());
                ListofNumbers.Add(Value);
            }

            Delegate.FindEven(ListofNumbers);
            Delegate.FindOdd(ListofNumbers);
            Delegate.FindPrime(ListofNumbers);
            Delegate.FindGreaterThan(ListofNumbers);
            Delegate.FindLessThan(ListofNumbers);
            Delegate.Find3k(ListofNumbers, i => i % 3 == 0);
            Multiple Num = delegate(int value)
            {
                return(value % 3 == 1 ? true : false);
            };

            Delegate.Find3KPlus1(ListofNumbers, Num);
            Delegate.Find3kPlus2(ListofNumbers, i => i % 3 == 2);
            Console.ReadLine();
        }
示例#11
0
    private IEnumerator RegistraBD(Multiple datos)
    {
        WWWForm form = new WWWForm();

        form.AddField("id", datos.id.ToString());
        form.AddField("giroX", datos.giroX.ToString());
        form.AddField("giroY", datos.giroY.ToString());
        //-----------
        form.AddField("idItem", datos.idItem.ToString());
        form.AddField("idEquipo", datos.idEquipo.ToString());
        form.AddField("conexion", datos.conexion.ToString());

        using (UnityWebRequest www = UnityWebRequest.Post(DatosScena.URL + "Editar/Multiple.php", form))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                Debug.Log(www.downloadHandler.text);
            }
        }
    }
示例#12
0
        static void Main(string[] args)
        {
            int[]  mas = new int[ReadInt("введите размер массива \"генеральной совокупности\" не больше 1000.", 1000)];
            Random ran = new Random();

            for (int i = 0; i < mas.Length; i++)
            {
                mas[i] = ran.Next(0, 100);
            }
            int      divisor  = ReadInt("Введите делитель", 9);
            Multiple multiple = new Multiple(divisor, mas);

            multiple.Name = "генеральной совокупности";

            BinaryFormatter binformatter = new BinaryFormatter();
            FileStream      fs           = new FileStream("Text.txt", FileMode.Create);

            binformatter.Serialize(fs, multiple);
            fs.Close();

            fs = new FileStream("Text.txt", FileMode.Open);
            try
            {
                multiple = (Multiple)binformatter.Deserialize(fs);
                Console.WriteLine("____________________________");
                Console.WriteLine(multiple.Name);
                Console.WriteLine(multiple.Divisor);
                Console.WriteLine(multiple.Set.ToString());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
        public override int GetHashCode()
        {
            var hashCode = -1067145431;

            hashCode = hashCode * -1521134295 + base.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CustomizedType);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FieldFormat);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Regexp);

            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(MinLength);

            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(MaxLength);

            hashCode = hashCode * -1521134295 + IsRequired.GetHashCode();
            hashCode = hashCode * -1521134295 + IsFilter.GetHashCode();
            hashCode = hashCode * -1521134295 + Searchable.GetHashCode();
            hashCode = hashCode * -1521134295 + Multiple.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DefaultValue);

            hashCode = hashCode * -1521134295 + Visible.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <IList <CustomFieldPossibleValue> > .Default.GetHashCode(PossibleValues);

            hashCode = hashCode * -1521134295 + EqualityComparer <IList <TrackerCustomField> > .Default.GetHashCode(Trackers);

            hashCode = hashCode * -1521134295 + EqualityComparer <IList <CustomFieldRole> > .Default.GetHashCode(Roles);

            return(hashCode);
        }
示例#14
0
            public override void Render(StringBuilder sb, int depth = 0)
            {
                var pad = String.Empty.PadLeft(depth, ' ');

                sb.Append(pad).AppendLine("increment");
                sb.Append(pad).Append("  ").Append("multiple: ").AppendLine(Multiple.ToString());
                Variable.Render(sb, depth + 2);
            }
示例#15
0
 public override void InitOrder()
 {
     if (DatosScena.Multiple == null)
     {
         DatosScena.Multiple = new List <Multiple>();
     }
     this.union = new Multiple();
     DatosScena.Multiple.Add(union);
 }
示例#16
0
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string name = null,
            int? size = null,
            Multiple? multiple = null,
            Disabled? disabled = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null,
            string onchange = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null
        )
        {
            Name = name;
            Size = size;
            Multiple = multiple;
            Disabled = disabled;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;
            OnChange = onchange;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;

            return this;
        }
示例#17
0
        // GET: ShowData
        public ActionResult MultiData()
        {
            sithar_dbEntities1 obj = new sithar_dbEntities1();
            var MyModel            = new Multiple();

            MyModel.pol    = obj.Policies.ToList();
            MyModel.conreq = obj.ConstructorRequests.ToList();

            return(View(MyModel));
        }
示例#18
0
        /// <summary>
        /// Get multiple.
        /// </summary>
        /// <param name="numbers"> list of numbers </param>
        /// <returns> Multiple </returns>
        private static Multiple GetMultiple(List <int> numbers)
        {
            var divisor = GetNumber <int>("\nEnter divisor: ",
                                          "Divisor must be in range [1; 9]: ",
                                          number => (number > 0) && (number < 10));

            var row = new Multiple(divisor, numbers);

            return(row);
        }
示例#19
0
        // Finds the numbers that are multiple of 3 from the list.

        public static void Find3k(List <int> numbers, Multiple Num)
        {
            Console.WriteLine("Multiples of three  from the list are : ");
            foreach (int i in numbers)
            {
                if (Num(i))
                {
                    Console.WriteLine(i);
                }
            }
        }
示例#20
0
 public static void Find3kPlus2(List <int> numbers, Multiple Num)
 {
     Console.WriteLine("Numbers in the form of 3k+2 from the list are : ");
     foreach (int i in numbers)
     {
         if (Num(i))
         {
             Console.WriteLine(i);
         }
     }
 }
示例#21
0
 public override void InitOrder()
 {
     if (DatosScena.Multiple == null)
     {
         DatosScena.Multiple = new List <Multiple>();
     }
     this.codo = new Multiple();
     DatosScena.Multiple.Add(codo);
     codo.giroX = 90;
     codo.giroY = 0;
 }
示例#22
0
        public void Multiple_NullCast()
        {
            var nullCast = (Multiple <TestClass>)null;

            Assert.IsNull(nullCast.Items);

            var empty = new Multiple <TestClass>();

            Assert.IsNotNull(empty.MergedClock);
            Assert.AreEqual(empty.MergedClock, (new Multiple <TestClass>() | nullCast).MergedClock);
        }
示例#23
0
        public void CleanUpCleansChildren()
        {
            var cleaned = false;
            var child   = new TriggerStub
            {
                OnCleanUp = () => cleaned = true
            };
            var trigger = new Multiple(child);

            trigger.CleanUp();
            Assert.IsTrue(cleaned);
        }
示例#24
0
        public void InitialiseInitialisesChildren()
        {
            var initialised = false;
            var child       = new TriggerStub
            {
                OnInitialise = () => initialised = true
            };
            var trigger = new Multiple(child);

            trigger.Initialise();
            Assert.IsTrue(initialised);
        }
示例#25
0
        public void ResetResetsChildren()
        {
            var reset = false;
            var child = new TriggerStub
            {
                OnResetAction = () => reset = true
            };
            var trigger = new Multiple(child);

            trigger.Reset();
            Assert.IsTrue(reset);
        }
示例#26
0
        public void CheckReturnsNullIfAllChildrenNullWithOr()
        {
            var child1 = new TriggerStub {
                OnCheckAction = () => null
            };
            var child2 = new TriggerStub {
                OnCheckAction = () => null
            };
            var trigger = new Multiple(child1, child2);
            var actual  = trigger.Check();

            Assert.IsNull(actual);
        }
        public void it_should_map_the_multiple_entity_to_the_multiple_view_model()
        {
            var industry = new Multiple
            {
                Id   = 1,
                Name = "Test Sector"
            };

            var result = this.mapper.Map <MultipleViewModel>(industry);

            Assert.AreEqual(industry.Id, result.Id);
            Assert.AreEqual(industry.Name, result.Name);
        }
示例#28
0
        public void ValidateValidatesChildren()
        {
            var validated = false;
            var child     = new TriggerStub
            {
                OnValidate = vl => validated = true
            };
            var trigger        = new Multiple(child);
            var validationMock = new Mock <IValidationLog>();

            trigger.Validate(validationMock.Object);
            Assert.IsTrue(validated);
        }
示例#29
0
        public void NextTimeReturnsLowestValidTime()
        {
            var child1 = new TriggerStub();
            var child2 = new TriggerStub {
                NextTimeValue = DateTime.Now
            };
            var child3 = new TriggerStub {
                NextTimeValue = DateTime.Now.AddHours(1)
            };
            var trigger = new Multiple(child1, child2, child3);
            var actual  = trigger.NextTime;

            Assert.AreEqual(child2.NextTimeValue, actual);
        }
                public PageSizeAggregate(IEnumerable<Size> sizes)
                    : base()
                {
                    this._count = 0;

                    foreach (Size s in sizes)
                    {
                        Multiple.Add(s);
                        this._count++;
                    }

                    if (this._count <= 0)
                        throw new ArgumentOutOfRangeException("sizes", "sizes must have at least one entry");
                }
示例#31
0
        public void TestMultiple3_Positive()
        {
            // Arrange
            const int  input    = 3;
            const bool expected = true;

            // Setup
            var obj = new Multiple(input);

            var result = obj.IsMultofThree();

            // Assert
            Assert.AreEqual(result, expected);
        }
示例#32
0
        public void TestMultiple35_Negative()
        {
            // Arrange
            const int  input    = 16;
            const bool expected = false;

            // Setup
            var obj = new Multiple(input);

            var result = obj.IsMultofThreeAndFive();

            // Assert
            Assert.AreEqual(result, expected);
        }
示例#33
0
 public static TagSelect multiple(this TagSelect tag, Multiple value) { tag.Multiple = value; return tag; }
示例#34
0
 protected void FindMutualCapabilites(Multiple<AmqpSymbol> desired, Multiple<AmqpSymbol> offered)
 {
     this.mutualCapabilities = Multiple<AmqpSymbol>.Intersect(desired, offered);
 }