Пример #1
0
        public static void TestMultiLayerJumps()
        {
            var x1 = new X1();

            var res = x1.Test();

            Assert("testx", res);

            Output = "";
            x1.DoTest2();
            Assert("X2Test2", Output);

            Output = "";
            x1.Test3();
            Assert("X1Test3X2Test3X3Test3", Output);

            Output = "";
            x1.DoTest4();
            Assert("X1Test4", Output);

            Output = "";
            x1.DoTest5();
            Assert("X1Test5", Output);

            Output = "";
            x1.DoTest6();
            Assert("X2Test6", Output);
        }
Пример #2
0
        public static void DifferentObjectTypesHaveDifferentHashes()
        {
            var x = new X1();
            var y = new X2();

            Assert.NotEqual(x.GetHashCode(), y.GetHashCode());
        }
Пример #3
0
        public static X1 V1(X1 t)
        {
            var cur = new X1();

            cur.y += 1;
            return(cur);
        }
Пример #4
0
		public override void WriteGroupCodes()
		{
			int flags;

			WriteGroupCodeValue(10, X0.ToString().Trim());
			WriteGroupCodeValue(20, Y0.ToString().Trim());
			WriteGroupCodeValue(30, Z0.ToString().Trim());

			WriteGroupCodeValue(11, X1.ToString().Trim());
			WriteGroupCodeValue(21, Y1.ToString().Trim());
			WriteGroupCodeValue(31, Z1.ToString().Trim());

			WriteGroupCodeValue(12, X2.ToString().Trim());
			WriteGroupCodeValue(22, Y2.ToString().Trim());
			WriteGroupCodeValue(32, Z2.ToString().Trim());

			WriteGroupCodeValue(13, X3.ToString().Trim());
			WriteGroupCodeValue(23, Y3.ToString().Trim());
			WriteGroupCodeValue(33, Z3.ToString().Trim());

			flags = 0;

			if(Edge1Invisible) flags += 1;
			if(Edge2Invisible) flags += 2;
			if(Edge3Invisible) flags += 4;
			if(Edge4Invisible) flags += 8;

			WriteGroupCodeValue(70, flags.ToString().Trim());
		}
Пример #5
0
        static void Main(string[] args)
        {
            for (int k = 0; k < 4; k++)
            {
                double A, B, C, delta, X1, X2;

                string[] s = Console.ReadLine().Split(' ');
                A = double.Parse(s[0]);
                B = double.Parse(s[1]);
                C = double.Parse(s[2]);

                if (A == 0)
                {
                    Console.WriteLine("Impossivel calcular");
                }
                else
                {
                    delta = Math.Pow(B, 2.0) - (4.0 * A * C);
                    if (delta < 0)
                    {
                        Console.WriteLine("Impossivel calcular");
                    }
                    else
                    {
                        X1 = (-B + Math.Sqrt(delta)) / (2.0 * A);
                        X2 = (-B - Math.Sqrt(delta)) / (2.0 * A);
                        Console.WriteLine("X1 = " + X1.ToString("F5"));
                        Console.WriteLine("X2 = " + X2.ToString("F5"));
                    }
                }
                Console.WriteLine();
            }
        }
Пример #6
0
    public static void MainTest()
    {
        var x1 = new X1();
        var x2 = new X2();
        var x3 = new X3();
        var x4 = new X4();

        x4.Display2();
        x1 = x4;
        x1.Display1();
        System.Console.WriteLine(x1.y);
        //x1.Display2();
        System.Console.WriteLine();

        var tt = new Y <int, Double>();

        tt.Set(3);
        tt.Set(.3);

        x1 = new X1();
        var x11 = new X1();

        x2 = new X2();
        var x22 = new X2();

        x1 = T1.V1(x22);
        //x2 = T1.V2(x1);
    }
        public override void Update(ICoordinateCalculator <double> xCoordCalc, ICoordinateCalculator <double> yCoordCalc)
        {
            base.Update(xCoordCalc, yCoordCalc);

            if (Y1.CompareTo(Y2) > 0)
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Top;
                MeasureText.Margin = new Thickness(0, 5, 0, 0);
            }
            else
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Bottom;
                MeasureText.Margin = new Thickness(0, -5, 0, 0);
            }

            var rangeX = X1.CompareTo(X2) > 0 ? RangeFactory.NewRange(X2, X1) : RangeFactory.NewRange(X1, X2);
            var rangeY = Y1.CompareTo(Y2) > 0 ? RangeFactory.NewRange(Y2, Y1) : RangeFactory.NewRange(Y1, Y2);

            string xText;

            if (xCoordCalc is ICategoryCoordinateCalculator <DateTime> )
            {
                var categoryCalc = (ICategoryCoordinateCalculator <DateTime>)xCoordCalc;
                var indexRange   = (IntegerRange)rangeX;
                var difference   = categoryCalc.TransformIndexToData(indexRange.Max) - categoryCalc.TransformIndexToData(indexRange.Min);
                xText = string.Format("{0:dd} days", difference);
            }
            else
            {
                xText = rangeX.Diff.ToString();
            }


            MeasureText.Text = string.Format("{0:#.##}\n{1}", rangeY.Diff, xText);
        }
Пример #8
0
 public void ConvertBadStateValuesToZero()
 {
     X1 = X1.ConvertBadValuesToZero();
     X2 = X2.ConvertBadValuesToZero();
     Y1 = Y1.ConvertBadValuesToZero();
     Y2 = Y2.ConvertBadValuesToZero();
 }
Пример #9
0
 public virtual void B(XmlWriter xmlWriter, X1 x)
 {
     if (x == null)
     {
         throw new l1();
     }
     if (this.c())
     {
         throw new l1();
     }
     if (this.A == null || this.A.get_Count() == 0)
     {
         throw new l1();
     }
     xmlWriter.WriteStartElement("CLIPSET");
     xmlWriter.WriteAttributeString("FORMAT", "1.00");
     xmlWriter.WriteAttributeString("ID", "" + this.A());
     this.A.B(xmlWriter, x);
     xmlWriter.WriteStartElement("CONNECTIONS");
     foreach (D.A current in (IEnumerable <D.A>) this.A)
     {
         current.B(xmlWriter, x);
     }
     xmlWriter.WriteEndElement();
     xmlWriter.WriteEndElement();
 }
Пример #10
0
        public bool Equals([AllowNull] Shape other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Layer == other.Layer && Layer != null && other.Layer != null && Layer.Equals(other.Layer)) &&
                   (XRef == other.XRef && XRef != null && other.XRef != null && XRef.Equals(other.XRef)) &&
                   (XSizeMode == other.XSizeMode && XSizeMode != null && other.XSizeMode != null && XSizeMode.Equals(other.XSizeMode)) &&
                   (XAnchor == other.XAnchor && XAnchor != null && other.XAnchor != null && XAnchor.Equals(other.XAnchor)) &&
                   (X0 == other.X0 && X0 != null && other.X0 != null && X0.Equals(other.X0)) &&
                   (X1 == other.X1 && X1 != null && other.X1 != null && X1.Equals(other.X1)) &&
                   (YRef == other.YRef && YRef != null && other.YRef != null && YRef.Equals(other.YRef)) &&
                   (YSizeMode == other.YSizeMode && YSizeMode != null && other.YSizeMode != null && YSizeMode.Equals(other.YSizeMode)) &&
                   (YAnchor == other.YAnchor && YAnchor != null && other.YAnchor != null && YAnchor.Equals(other.YAnchor)) &&
                   (Y0 == other.Y0 && Y0 != null && other.Y0 != null && Y0.Equals(other.Y0)) &&
                   (Y1 == other.Y1 && Y1 != null && other.Y1 != null && Y1.Equals(other.Y1)) &&
                   (Path == other.Path && Path != null && other.Path != null && Path.Equals(other.Path)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (Line == other.Line && Line != null && other.Line != null && Line.Equals(other.Line)) &&
                   (FillColor == other.FillColor && FillColor != null && other.FillColor != null && FillColor.Equals(other.FillColor)) &&
                   (FillRule == other.FillRule && FillRule != null && other.FillRule != null && FillRule.Equals(other.FillRule)) &&
                   (Editable == other.Editable && Editable != null && other.Editable != null && Editable.Equals(other.Editable)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (TemplateItemName == other.TemplateItemName && TemplateItemName != null && other.TemplateItemName != null && TemplateItemName.Equals(other.TemplateItemName)));
        }
Пример #11
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         hashCode = hashCode * 59 + Type.GetHashCode();
         hashCode = hashCode * 59 + Barcode1DSymbology.GetHashCode();
         if (Data != null)
         {
             hashCode = hashCode * 59 + Data.GetHashCode();
         }
         hashCode = hashCode * 59 + X1.GetHashCode();
         hashCode = hashCode * 59 + X2.GetHashCode();
         hashCode = hashCode * 59 + X3.GetHashCode();
         hashCode = hashCode * 59 + X4.GetHashCode();
         hashCode = hashCode * 59 + Y1.GetHashCode();
         hashCode = hashCode * 59 + Y2.GetHashCode();
         hashCode = hashCode * 59 + Y3.GetHashCode();
         hashCode = hashCode * 59 + Y4.GetHashCode();
         hashCode = hashCode * 59 + BboxLeftInches.GetHashCode();
         hashCode = hashCode * 59 + BboxTopInches.GetHashCode();
         hashCode = hashCode * 59 + BboxWidthInches.GetHashCode();
         hashCode = hashCode * 59 + BboxHeightInches.GetHashCode();
         hashCode = hashCode * 59 + PageNumber.GetHashCode();
         hashCode = hashCode * 59 + PagePixelWidth.GetHashCode();
         hashCode = hashCode * 59 + PagePixelHeight.GetHashCode();
         hashCode = hashCode * 59 + PageHorizontalResolution.GetHashCode();
         hashCode = hashCode * 59 + PageVerticalResolution.GetHashCode();
         return(hashCode);
     }
 }
Пример #12
0
 /// <summary>
 /// Вычисления корней в обработчике
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InHandler_Click(object sender, EventArgs e)
 {
     if (TextA.Text != "" && TextB.Text != "" && TextC.Text != "" &&
         TextA.Text != "-" && TextB.Text != "-" && TextC.Text != "-" &&
         TextA.Text != "+" && TextB.Text != "+" && TextC.Text != "+" &&
         TextA.Text != "," && TextB.Text != "," && TextC.Text != ",")
     {
         double D, X1, X2, a, b, c;
         a = double.Parse(TextA.Text);
         b = double.Parse(TextB.Text);
         c = double.Parse(TextC.Text);
         D = b * b - 4 * a * c;
         if (D >= 0)
         {
             X1          = (-1 * b + Math.Sqrt(D)) / (2 * a);
             X2          = (-1 * b - Math.Sqrt(D)) / (2 * a);
             TextX1.Text = X1.ToString("F4");
             TextX2.Text = X2.ToString("F4");
         }
         else
         {
             string comp_x1, comp_x2;
             comp_x1 = (-1 * b / (2 * a)).ToString("F4") + "+" +
                       (Math.Sqrt(-1 * D) / (2 * a)).ToString("F4") + "i";
             comp_x2 = (-1 * b / (2 * a)).ToString("F4") + "-" +
                       (Math.Sqrt(-1 * D) / (2 * a)).ToString("F4") + "i";
             TextX1.Text = comp_x1;
             TextX2.Text = comp_x2;
         }
     }
     else
     {
         Error.Text = "Ошибка, не все поля заполнены! \nЛибо неверный формат вводимых данных!";
     }
 }
Пример #13
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (X1 != 0)
            {
                hash ^= X1.GetHashCode();
            }
            if (Y1 != 0)
            {
                hash ^= Y1.GetHashCode();
            }
            if (X2 != 0)
            {
                hash ^= X2.GetHashCode();
            }
            if (Y2 != 0)
            {
                hash ^= Y2.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #14
0
        public static void SaveLog(int itemIndex, string runResult)
        {
            //创建文件夹
            if (!Directory.Exists(logDir))
            {
                Directory.CreateDirectory(logDir);
            }

            var lineVals = new List <string>
            {
                DateTime.Now.ToString("HH:mm:ss"), X1.ToString("f3"), X2.ToString("f3"), Y1.ToString("f3"),
                Y2.ToString("f3"), angle.ToString("f3"),
                runResult, itemIndex.ToString(), " ", X1_pixel.ToString("f3"), X2_pixel.ToString("f3"),
                Y1_pixel.ToString("f3"), Y2_pixel.ToString("f3"),
                angleUncalib.ToString("f3")
            };
            var line = string.Join(",", lineVals);

            try
            {
                csvFile = dataLogger.WriteLine(line);
            }
            catch
            {
                MessageBox.Show("请关闭所有CCD软件产生的文档");
            }

            removeOutdatedFiles(logDir);
        }
Пример #15
0
        public override IEnumerable <SvgAttribute> GetAttributes()
        {
            var baseAttributes = base.GetAttributes();

            if (baseAttributes != null)
            {
                foreach (var attr in baseAttributes)
                {
                    yield return(attr);
                }
            }

            var ci = CultureInfo.InvariantCulture;

            yield return(new SvgAttribute("x1", "0",
                                          () => X1.ToString(ci),
                                          v => X1 = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("y1", "0",
                                          () => Y1.ToString(ci),
                                          v => Y1 = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("x2", "0",
                                          () => X2.ToString(ci),
                                          v => X2 = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("y2", "0",
                                          () => Y2.ToString(ci),
                                          v => Y2 = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("stroke-width",
                                          () => StrokeWidth.ToString(ci),
                                          v => StrokeWidth = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("stroke",
                                          () => Stroke == Color.Empty ? "none" : ColorTranslator.ToSvg(Stroke),
                                          v => Stroke = SvgAttribute.ParseColorAttribute(v, Stroke.A)
                                          ));

            yield return(new SvgAttribute("stroke-opacity", "1",
                                          () => ((double)Stroke.A / 255).ToString(ci),
                                          v => Stroke = SvgAttribute.ParseOpacityAttribute(v, Stroke)
                                          ));

            yield return(new SvgAttribute("stroke-dashoffset",
                                          () => StrokeDashOffset.ToString(ci),
                                          v => StrokeDashOffset = SvgAttribute.ParseFloatAttribute(v)
                                          ));

            yield return(new SvgAttribute("stroke-dasharray",
                                          () => DashArrayToString(),
                                          v => StrokeDashArray = SvgAttribute.ParseFloatArray(v)
                                          ));
        }
Пример #16
0
 public override void a1(XmlWriter xmlWriter, X1 x)
 {
     base.a1(xmlWriter, x);
     if (this.A() != null)
     {
         xmlWriter.WriteAttributeString("ASSOCIATE", "" + this.A().A());
     }
 }
Пример #17
0
 /// <summary>
 /// Return a string representation of this object.
 /// </summary>
 public override String ToString()
 {
     return(String.Format("Line2D: X1={0}, Y1={1}, X2={2}, Y2={3}",
                          X1.ToString(),
                          Y1.ToString(),
                          X2.ToString(),
                          Y2.ToString()));
 }
        public void TestCreateAfterConfigureInstances()
        {
            var x1 = new X1();

            container.Configurator.ForAbstraction <IX1>().UseInstances(x1);
            Assert.AreNotSame(x1, container.Create <IX1>());
            Assert.AreSame(x1, container.Get <IX1>());
        }
Пример #19
0
 private void LastExecutedCommand()
 {
     TbMR2n.Text = N.ToString();
     TbMR2x.Text = X1.ToString();
     TbMR2y.Text = Y1.ToString();
     TbMR2t.Text = T1.ToString();
     TbMR2g.Text = G1.ToString();
     TbMR2l.Text = L1.ToString();
 }
Пример #20
0
        public bool Equals(Answer other)
        {
            if (other == null)
            {
                return(false);
            }

            return(X1.EqualsEps(other.X1) && X2.EqualsEps(other.X2));
        }
Пример #21
0
        public override string ToString()
        {
            string str = "{X1:" + X1.ToString()
                         + ", X2:" + X2.ToString()
                         + ", Y:" + Y.ToString()
                         + ", Z:" + Z.ToString() + "}";

            return("GSA Offset " + str);
        }
Пример #22
0
        public override int GetHashCode()
        {
            var hashCode = 1280913280;

            hashCode = hashCode * -1521134295 + X1.GetHashCode();
            hashCode = hashCode * -1521134295 + X2.GetHashCode();
            hashCode = hashCode * -1521134295;
            return(hashCode);
        }
Пример #23
0
        public virtual void Render(Graphics g)
        {
            Bitmap bmp = GetBitmap();

            if (bmp != null)
            {
                g.DrawImage(bmp, X1.Floor(), Y1.Floor(), (float)bmp.Width, (float)bmp.Height);
            }
        }
Пример #24
0
 public XElement ToXml(string name)
 {
     return(new XElement(name,
                         new XAttribute("R0", R0.ToString(CultureInfo.InvariantCulture)),
                         new XAttribute("R1", R1.ToString(CultureInfo.InvariantCulture)),
                         new XAttribute("X0", X0.ToString(CultureInfo.InvariantCulture)),
                         new XAttribute("X1", X1.ToString(CultureInfo.InvariantCulture))
                         ));
 }
Пример #25
0
        public override int GetHashCode()
        {
            var hashCode = 1001978625;

            hashCode = hashCode * -1521134295 + X1.GetHashCode();
            hashCode = hashCode * -1521134295 + X2.GetHashCode();

            return(hashCode);
        }
Пример #26
0
    public H1(X x) : base(x)
    {
        m_x = x;
        X1 x1 = x as X1;

        if (x1 != null)
        {
            m_x1 = x1;
        }
    }
Пример #27
0
 /// <summary>
 /// 得到四大车的工作车;(需要在一个计时器中)
 /// </summary>
 public void GetAllJobAndNonJobCar()
 {
     TJob.GetCopy((Tjc)T1.GetJobCar(CarsLst[0], CarsLst[1], Addrs.TRoomNumDic));
     LJob.GetCopy((Ljc)L1.GetJobCar(CarsLst[2], CarsLst[3], Addrs.LRoomNumDic));
     XJob.GetCopy((Xjc)X1.GetJobCar((Xjc)CarsLst[4], (Xjc)CarsLst[5]));
     //20171124 得到平煤的工作推焦车
     TNonJob.GetCopy(TJob.CarNum == 1 ? T2 : T1);
     LNonJob.GetCopy(LJob.CarNum == 1 ? L2 : L1);
     XNonJob.GetCopy(XJob.CarNum == 1 ? X2 : X1);
 }
        public override string ToString()
        {
            string str = "";

            str += X1.ToString() + "\n";
            str += X2.ToString() + "\n";
            str += X3.ToString() + "\n";
            str += $"Area = {Area.ToString("f3")}\nPerimetr = {Perimetr.ToString("f3")}\n";
            return(str);
        }
Пример #29
0
        }//Separamos todos los valores de las X y el lado derecho

        private void Paso2(ListBox ltbSalida, PictureBox cuadro, ListBox ltbSalida2, TextBox txtResultado4)
        {
            for (int i = 0; i < ltsGrafos.N; i++)
            {
                ltsGrafos.mostrarPosicion(i, out object X1, out object X2, out object ld);
                ltsGrafosCoordenadas.insertatFin(Dividir(ld.ToString(), X1.ToString()), Dividir(ld.ToString(), X2.ToString()), 0);
            }
            ltsGrafosCoordenadas.mostrar(ltbSalida);
            Paso3(cuadro, ltbSalida2, txtResultado4);
        }
Пример #30
0
 public override void B(XmlWriter xmlWriter, X1 x)
 {
     xmlWriter.WriteStartElement("CONNECTION");
     xmlWriter.WriteAttributeString("FORMAT", "1.00");
     xmlWriter.WriteAttributeString("ID", "" + this.A());
     xmlWriter.WriteAttributeString("FROM", "" + this.A.A());
     xmlWriter.WriteAttributeString("TO", "" + this.a.A());
     xmlWriter.WriteAttributeString("TEXT", "" + this.c());
     xmlWriter.WriteEndElement();
 }
Пример #31
0
		protected override void Check()
		{
			var x1 = new X1();
			var x2 = new X2();
			var m = new Model();

			m.AddRootComponents(new X3(x1, x2));
			m.Bind(x1.RequiredPorts.M = x2.ProvidedPorts.M);
			m.Seal();

			m.Metadata.Bindings.Length.ShouldBe(1);
		}
 public void Test()
 {
     var container = Container();
     var factory = container.Get<A.Ctor>();
     var x1 = new X1();
     var a = factory(x1, 42);
     Assert.That(a.x, Is.SameAs(x1));
     Assert.That(a.a, Is.EqualTo(42));
 }
Пример #33
0
			public X3(X1 x1, X2 x2)
			{
				_x1 = x1;
				_x2 = x2;
			}