/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { var length = value.ToLength(); if (length.HasValue) _h = _v = length.Value; else if (value is CSSValueList) { var values = (CSSValueList)value; if (values.Length != 2) return false; var h = values[0].ToLength(); var v = values[1].ToLength(); if (!h.HasValue || !v.HasValue) return false; _h = h.Value; _v = v.Value; } else if (value != CSSValue.Inherit) return false; return true; }
private GameObject[] myBlocks; //arry to hold rferences to the blocks #endregion Fields #region Methods // Use this for initialization void Start() { //first initialize the bars array so you can insantiate prefabs Bars = new GameObject[3]{ Resources.Load<GameObject>("Full_Block"), Resources.Load<GameObject>("Half_Block"), Resources.Load<GameObject>("Quarter_Block") }; //if the height/width wasn't set, at least set it to 1 so you have something if(height == 0){height = 1;} if(width == 0){width = 1;} //if the block Lengths weren't selected then, at least make them quaters to see if(wBlock == Length.None){wBlock = Length.Quarter;} if(hBlock == Length.None){wBlock = Length.Quarter;} myBlocks = new GameObject[(2*(width+height))]; switch(wBlock){ case Length.Full: for(int i = 0; i<width; i++){ }break; case Length.Half: for(int i = 0; i<width; i++){ }break; case Length.Quarter: for(int i = 0; i<width; i++){ }break; } }
public Datum(DateTime time, Latitude latitude, Longitude longitude, Length altitude = null, Speed speed = null, Heading heading = null) { _time = time; _location = new GeoPosition(latitude, longitude, altitude); _speed = speed; _heading = heading; }
private PaperMargins(Length top, Length right, Length bottom, Length left) { _top = top; _right = right; _bottom = bottom; _left = left; }
/// <summary> /// Creates a new shape value. /// </summary> /// <param name="top">The top position.</param> /// <param name="right">The right position.</param> /// <param name="bottom">The bottom position.</param> /// <param name="left">The left position.</param> public Shape(Length top, Length right, Length bottom, Length left) { _top = top; _right = right; _bottom = bottom; _left = left; }
public static void doit() { new LengthTest().hashCode(); Length l = new Length(10.1234, LengthType.mm); double d = 10.1234; for (int i = 0; i < 100; i++) { d = d / 7; } for (int i = 0; i < 100; i++) { d = d * 7; } Length l2 = new Length(d, LengthType.cm); Console.WriteLine(l); Console.WriteLine(new Length()); Console.WriteLine(l.ToCM()); Console.WriteLine(l.ToKM()); Console.WriteLine(l.ToM()); Console.WriteLine(new Length(1, LengthType.km).ToCM()); //Console.WriteLine(l2.ToString("n0")); Console.WriteLine(l2.Value); Console.WriteLine(l.GetHashCode() + " " + l2.GetHashCode()); Console.WriteLine(l.Equals(l2)); }
/// <summary>Assigns all needed attributes to the tag</summary> /// <returns>This instance downcasted to base class</returns> public virtual IndexedTag attr( string id = null, string @class = null, string style = null, string title = null, string longdesc = null, string name = null, string src = null, bool? frameborder = null, int? marginwidth = null, int? marginheight = null, Scrolling? scrolling = null, Length height = null, Length width = null ) { Id = id; Class = @class; Style = style; Title = title; LongDesc = longdesc; Name = name; Src = src; FrameBorder = frameborder; MarginWidth = marginwidth; MarginHeight = marginheight; Scrolling = scrolling; Height = height; Width = width; return this; }
public void hashCode() { Length l = new Length(10.1234, LengthType.mm); double d = 10.1234; for (int i = 0; i < 100; i++) { d = d / 7; } for (int i = 0; i < 100; i++) { d = d * 7; } Length l2 = new Length(d, LengthType.mm); Console.WriteLine(l.Value.ToString("n15") + " : " + l2.Value.ToString("n15")); Console.WriteLine(l.GetHashCode()); Assert.IsTrue(l.Value - l2.Value > 0); Console.WriteLine(l.Value - l2.Value ); Assert.IsTrue(l.Value != l2.Value); Assert.IsTrue(l == l2); Assert.IsTrue(l.GetHashCode() == l2.GetHashCode()); }
public void ToStandardMeasures_DoubleNoUnitConversion_ReturningNonConvertedStandardMeasures() { var measures = new[] { 1.0, 2.0, 3.0, -2.0 }.Cast<Length>(); var expected = new Length(3.0); var actual = measures.ElementAt(2); MeasureAssert.MeasuresAreEqual(expected, actual); }
public void VerifyAllEnums() { var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit); var angle = new Angle(1, AngleUnit.BaseUnit); var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit); var area = new Area(1, AreaUnit.BaseUnit); var density = new MassDensity(1, MassDensityUnit.BaseUnit); var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit); var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit); var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit); var energy = new Energy(1, EnergyUnit.BaseUnit); var force = new Force(1, ForceUnit.BaseUnit); var frequency = new Frequency(1, FrequencyUnit.BaseUnit); var jerk = new Jerk(1, JerkUnit.BaseUnit); var length = new Length(1, LengthUnit.BaseUnit); var mass = new Mass(1, MassUnit.BaseUnit); var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit); var momentum = new Momentum(1, MomentumUnit.BaseUnit); var numeric = new Numeric(1, NumericUnit.BaseUnit); var power = new Power(1, PowerUnit.BaseUnit); var pressure = new Pressure(1, PressureUnit.BaseUnit); var speed = new Speed(1, SpeedUnit.BaseUnit); var temperature = new Temperature(1, TemperatureUnit.BaseUnit); var time = new Time(1, TimeUnit.BaseUnit); var torque = new Torque(1, TorqueUnit.BaseUnit); var volume = new Volume(1, VolumeUnit.BaseUnit); var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit); }
internal CSSBorderSpacingProperty() : base(PropertyNames.BorderSpacing) { _inherited = true; _h = Length.Zero; _v = Length.Zero; }
/// <summary>Assigns all needed attributes to the tag</summary> /// <returns>This instance downcasted to base class</returns> public virtual IndexedTag attr( Shape? shape = null, Length[] coords = null, string href = null, NoHref? nohref = null, Target target = null, string alt = 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, char? accesskey = null, int? tabindex = null, string onfocus = null, string onblur = null ) { Shape = shape; Coords = coords; Href = href; NoHref = nohref; Target = target; Alt = alt; 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; AccessKey = accesskey; TabIndex = tabindex; OnFocus = onfocus; OnBlur = onblur; return this; }
/// <summary> /// Calculation method. /// </summary> /// <param name="chain"> /// Source sequence. /// </param> /// <param name="link"> /// Redundant parameter, not used in calculations. /// </param> /// <returns> /// Frequency of element in congeneric chain as <see cref="double"/>. /// </returns> public double Calculate(CongenericChain chain, Link link) { var count = new ElementsCount(); var length = new Length(); return count.Calculate(chain, link) / length.Calculate(chain, link); }
public PredictorData(double distanceNominal, Length.Units unitNominal) { this.Distance = distanceNominal; this.Unit = unitNominal; result = new Dictionary<PredictionModel, TimePredictionResult>(); source = null; }
public void OpAddition() { var length1 = new Length(5000, LengthUnit.Meter); var length2 = new Length(2, LengthUnit.Kilometer); var expected = new Length(7000, LengthUnit.Meter); (length1 + length2).ShouldEqual(expected); (length2 + length1).ShouldEqual(expected); }
public void Divide_DivideVolumeAndLength_ReturnsArea() { var expected = new Area(4.0); var numerator = new Volume(8.0); var denominator = new Length(200.0, Length.CentiMeter); Area actual; ArithmeticOperations.Divide(numerator, denominator, out actual); MeasureAssert.MeasuresAreEqual(expected, actual); }
public void Times_MultiplyAreaAndLength_ReturnsVolume() { var expected = new Volume(6.0); var lhs = new Area(2.0); var rhs = new Length(3.0); Volume actual; ArithmeticOperations.Times(lhs, rhs, out actual); MeasureAssert.MeasuresAreEqual(expected, actual); }
/// <summary>Create a <see cref="Box2"/> by providing minimum and maximum extents.</summary> public Box2( Length minX , Length minY , Length maxX , Length maxY ) { Min.X = minX; Max.X = maxX; Min.Y = minY; Max.Y = maxY; }
internal CSSBorderWidthProperty() : base(PropertyNames.BorderWidth) { _inherited = false; _top = Length.Medium; _right = Length.Medium; _bottom = Length.Medium; _left = Length.Medium; }
/// <summary> /// Creates a new CSS shadow. /// </summary> /// <param name="inset">If the shadow is an inset.</param> /// <param name="offsetX">The x-coordinate offset.</param> /// <param name="offsetY">The y-coordinate offset.</param> /// <param name="blurRadius">The blur radius of the shadow.</param> /// <param name="spreadRadius">The spread radius of the shadow.</param> /// <param name="color">The color of the shadow.</param> public Shadow(Boolean inset, Length offsetX, Length offsetY, Length blurRadius, Length spreadRadius, Color color) { _inset = inset; _offsetX = offsetX; _offsetY = offsetY; _blurRadius = blurRadius; _spreadRadius = spreadRadius; _color = color; }
/// <summary>Assigns all needed attributes to the tag</summary> /// <returns>This instance downcasted to base class</returns> public virtual IndexedTag attr( string src = null, string alt = null, string longdesc = null, Length height = null, Length width = null, string usemap = null, IsMap? ismap = null, string id = null, string name = 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 ) { Src = src; Alt = alt; LongDesc = longdesc; Height = height; Width = width; UseMap = usemap; IsMap = ismap; Id = id; Name = name; 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; }
public void OpDivision() { var length1 = new Length(4000, LengthUnit.Meter); var length2 = new Length(4, LengthUnit.Kilometer); (length1 / length2).ShouldBeWithinEpsilonOf(1); (length2 / length1).ShouldBeWithinEpsilonOf(1); (length1 / 2).ShouldEqual(new Length(2000, LengthUnit.Meter)); (length2 / 2).ShouldEqual(new Length(2, LengthUnit.Kilometer)); }
/// <summary> /// Creates a new radial gradient. /// </summary> /// <param name="circle">Determines if the radial gradient has to be forced to a circle form.</param> /// <param name="pt">The center point of the gradient.</param> /// <param name="width">The width of the ellipsoid.</param> /// <param name="height">The height of the ellipsoid.</param> /// <param name="sizeMode">The size mode of the ellipsoid.</param> /// <param name="stops">A collection of stops to use.</param> /// <param name="repeating">The repeating setting.</param> public RadialGradient(Boolean circle, Point pt, Length width, Length height, SizeMode sizeMode, GradientStop[] stops, Boolean repeating = false) { _stops = stops; _pt = pt; _width = width; _height = height; _repeating = repeating; _circle = circle; _sizeMode = sizeMode; }
public void OpGreaterThanOrEqual() { var length1 = new Length(3000, LengthUnit.Meter); var length2 = new Length(3, LengthUnit.Kilometer); var length3 = new Length(4, LengthUnit.Kilometer); (length1 >= length3).ShouldBeFalse(); (length3 >= length1).ShouldBeTrue(); (length1 >= length2).ShouldBeTrue(); (length2 >= length1).ShouldBeTrue(); }
public void OpInverseEquals() { var length1 = new Length(3000, LengthUnit.Meter); var length2 = new Length(3, LengthUnit.Kilometer); var length3 = new Length(4, LengthUnit.Kilometer); (length1 != length2).ShouldBeFalse(); (length2 != length1).ShouldBeFalse(); (length1 != length3).ShouldBeTrue(); (length3 != length1).ShouldBeTrue(); }
/// <summary>Assigns all needed attributes to the tag</summary> /// <returns>This instance downcasted to base class</returns> public virtual IndexedTag attr( string summary = null, Length width = null, int? border = null, Frame? frame = null, Rules? rules = null, Length cellspacing = null, Length cellpadding = 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 ) { Summary = summary; Width = width; Border = border; Frame = frame; Rules = rules; CellSpacing = cellspacing; CellPadding = cellpadding; 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; }
public Block(Length l,GameObject Parent) { L = l; inUse=false; owner = Parent; me = new GameObject(); me.AddComponent("MeshFilter"); me.AddComponent("BoxCollider"); me.AddComponent("MeshRenderer"); me.AddComponent("Rigidbody"); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { var width = value.ToBorderWidth(); if (width.HasValue) _width = width.Value; else if (value != CSSValue.Inherit) return false; return true; }
public SpeedRangeTarget(double minUnitsPerHour, double maxUnitsPerHour, Length.Units speedUnit, Speed.Units speedPace, BaseSpeedTarget baseTarget) : this(baseTarget) { if (speedPace == Speed.Units.Pace) { SetRangeInMinutesPerUnit(minUnitsPerHour, maxUnitsPerHour, speedUnit); } else { SetRangeInUnitsPerHour(minUnitsPerHour, maxUnitsPerHour, speedUnit); } }
public Meter ConvertToMeter(Length length) { if(length.grade < 0) { return new Meter(length.value / Math.Pow(10, length.grade)); } if (length.grade > 0) { return new Meter(length.value * Math.Pow(10, (length.grade))); } return new Meter(length.value); }
public void EqualsReturnsFalseOnNull() { Length meter = Length.FromMeters(1); Assert.IsFalse(meter.Equals(null)); }
public LegsBase(Length length, Colors color) { Length = length; Color = color; }
public void VolumeDividedByAreaEqualsLength() { Length length = Volume.FromCubicMeters(15) / Area.FromSquareMeters(5); Assert.Equal(length, Length.FromMeters(3)); }
public override string ToString() { return(Ident.ToString() + ": " + Length.ToString()); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Identifier != null) { Identifier.ForEach(elem => result.AddRange(elem.Validate())); } if (StatusElement != null) { result.AddRange(StatusElement.Validate()); } if (ClassElement != null) { result.AddRange(ClassElement.Validate()); } if (Type != null) { Type.ForEach(elem => result.AddRange(elem.Validate())); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (Participant != null) { Participant.ForEach(elem => result.AddRange(elem.Validate())); } if (Fulfills != null) { result.AddRange(Fulfills.Validate()); } if (StartElement != null) { result.AddRange(StartElement.Validate()); } if (Length != null) { result.AddRange(Length.Validate()); } if (Reason != null) { result.AddRange(Reason.Validate()); } if (Indication != null) { result.AddRange(Indication.Validate()); } if (Priority != null) { result.AddRange(Priority.Validate()); } if (Hospitalization != null) { result.AddRange(Hospitalization.Validate()); } if (Location != null) { Location.ForEach(elem => result.AddRange(elem.Validate())); } if (ServiceProvider != null) { result.AddRange(ServiceProvider.Validate()); } if (PartOf != null) { result.AddRange(PartOf.Validate()); } return(result); }
public void ApostropheDigitGroupingCultureFormatting(string culture) { Assert.AreEqual("1'111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, new CultureInfo(culture))); }
public void ForceDividedByLengthEqualsForcePerLength() { ForcePerLength forcePerLength = Force.FromNewtons(200) / Length.FromMeters(50); Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4)); }
public void DecimalRadixPointCultureFormatting(string culture) { Assert.AreEqual("0.12 m", Length.FromMeters(0.12).ToString(LengthUnit.Meter, new CultureInfo(culture))); }
public void SpaceDigitGroupingCultureFormatting(string culture) { // Note: the space used in digit groupings is actually a "thin space" Unicode character U+2009 Assert.AreEqual("1 111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, new CultureInfo(culture))); }
/// <summary> /// 符号を抽出しますよ /// </summary> /// <param name="a">長さ</param> /// <returns>符号; -1, 0, +1 の何れか</returns> public static int Sign(Length a) { return(Math.Sign(a._m)); }
/// <summary> /// 逆正接値を計算しますよ /// </summary> /// <param name="x">長さ ( this )</param> /// <param name="y">長さ ( 相手 )</param> /// <returns>逆正接値</returns> public static PlaneAngle ATan2(this Length x, Length y) { return(PlaneAngle.FromRadians(Math.Atan2(y._m, x._m))); }
/// <summary> /// 逆余弦値を cathetus / hypotenuse から計算しますよ /// </summary> /// <param name="hypotenuse">斜辺 ( this )</param> /// <param name="cathetus">隣辺 ( 相手 )</param> /// <returns>逆余弦による平面角</returns> public static PlaneAngle ACos(this Length hypotenuse, Length cathetus) { return(PlaneAngle.FromRadians(Math.Acos(cathetus._m / hypotenuse._m))); }
public void EqualsReturnsFalseOnTypeMismatch() { Length meter = Length.FromMeters(1); Assert.IsFalse(meter.Equals(new object())); }
public void DecimalPointDigitGroupingCultureFormatting(string culture) { Assert.AreEqual("1.111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, new CultureInfo(culture))); }
/// <summary> /// Writes a binary representation of this class to a byte buffer, at a given position. /// The position is incremented to the end of the representation /// </summary> /// <param name="buffer">a byte array where the binary representation is written</param> /// <param name="position">the position in the byte array</param> public override void ToByteArray(byte[] buffer, ref int position) { base.ToByteArray(buffer, ref position); Length.ToByteArray(buffer, ref position); _data.ToByteArray(buffer, ref position); }
public void CompareToThrowsOnTypeMismatch() { Length meter = Length.FromMeters(1); Assert.Throws <ArgumentException>(() => meter.CompareTo(new object())); }
public void CompareToThrowsOnNull() { Length meter = Length.FromMeters(1); Assert.Throws <ArgumentNullException>(() => meter.CompareTo(null)); }
public void FromMeters_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => Length.FromMeters(double.NaN)); }
public LengthAttribute(Length length) { Length = (int)length; }
public void VolumeDividedByLengthEqualsArea() { Area area = Volume.FromCubicMeters(15) / Length.FromMeters(5); Assert.Equal(area, Area.FromSquareMeters(3)); }
public void ToUnit() { var meter = Length.FromMeters(1); var centimeterQuantity = meter.ToUnit(LengthUnit.Centimeter); AssertEx.EqualTolerance(CentimetersInOneMeter, (double)centimeterQuantity.Value, CentimetersTolerance); Assert.Equal(LengthUnit.Centimeter, centimeterQuantity.Unit); var decimeterQuantity = meter.ToUnit(LengthUnit.Decimeter); AssertEx.EqualTolerance(DecimetersInOneMeter, (double)decimeterQuantity.Value, DecimetersTolerance); Assert.Equal(LengthUnit.Decimeter, decimeterQuantity.Unit); var dtppicaQuantity = meter.ToUnit(LengthUnit.DtpPica); AssertEx.EqualTolerance(DtpPicasInOneMeter, (double)dtppicaQuantity.Value, DtpPicasTolerance); Assert.Equal(LengthUnit.DtpPica, dtppicaQuantity.Unit); var dtppointQuantity = meter.ToUnit(LengthUnit.DtpPoint); AssertEx.EqualTolerance(DtpPointsInOneMeter, (double)dtppointQuantity.Value, DtpPointsTolerance); Assert.Equal(LengthUnit.DtpPoint, dtppointQuantity.Unit); var fathomQuantity = meter.ToUnit(LengthUnit.Fathom); AssertEx.EqualTolerance(FathomsInOneMeter, (double)fathomQuantity.Value, FathomsTolerance); Assert.Equal(LengthUnit.Fathom, fathomQuantity.Unit); var footQuantity = meter.ToUnit(LengthUnit.Foot); AssertEx.EqualTolerance(FeetInOneMeter, (double)footQuantity.Value, FeetTolerance); Assert.Equal(LengthUnit.Foot, footQuantity.Unit); var inchQuantity = meter.ToUnit(LengthUnit.Inch); AssertEx.EqualTolerance(InchesInOneMeter, (double)inchQuantity.Value, InchesTolerance); Assert.Equal(LengthUnit.Inch, inchQuantity.Unit); var kilometerQuantity = meter.ToUnit(LengthUnit.Kilometer); AssertEx.EqualTolerance(KilometersInOneMeter, (double)kilometerQuantity.Value, KilometersTolerance); Assert.Equal(LengthUnit.Kilometer, kilometerQuantity.Unit); var meterQuantity = meter.ToUnit(LengthUnit.Meter); AssertEx.EqualTolerance(MetersInOneMeter, (double)meterQuantity.Value, MetersTolerance); Assert.Equal(LengthUnit.Meter, meterQuantity.Unit); var microinchQuantity = meter.ToUnit(LengthUnit.Microinch); AssertEx.EqualTolerance(MicroinchesInOneMeter, (double)microinchQuantity.Value, MicroinchesTolerance); Assert.Equal(LengthUnit.Microinch, microinchQuantity.Unit); var micrometerQuantity = meter.ToUnit(LengthUnit.Micrometer); AssertEx.EqualTolerance(MicrometersInOneMeter, (double)micrometerQuantity.Value, MicrometersTolerance); Assert.Equal(LengthUnit.Micrometer, micrometerQuantity.Unit); var milQuantity = meter.ToUnit(LengthUnit.Mil); AssertEx.EqualTolerance(MilsInOneMeter, (double)milQuantity.Value, MilsTolerance); Assert.Equal(LengthUnit.Mil, milQuantity.Unit); var mileQuantity = meter.ToUnit(LengthUnit.Mile); AssertEx.EqualTolerance(MilesInOneMeter, (double)mileQuantity.Value, MilesTolerance); Assert.Equal(LengthUnit.Mile, mileQuantity.Unit); var millimeterQuantity = meter.ToUnit(LengthUnit.Millimeter); AssertEx.EqualTolerance(MillimetersInOneMeter, (double)millimeterQuantity.Value, MillimetersTolerance); Assert.Equal(LengthUnit.Millimeter, millimeterQuantity.Unit); var nanometerQuantity = meter.ToUnit(LengthUnit.Nanometer); AssertEx.EqualTolerance(NanometersInOneMeter, (double)nanometerQuantity.Value, NanometersTolerance); Assert.Equal(LengthUnit.Nanometer, nanometerQuantity.Unit); var nauticalmileQuantity = meter.ToUnit(LengthUnit.NauticalMile); AssertEx.EqualTolerance(NauticalMilesInOneMeter, (double)nauticalmileQuantity.Value, NauticalMilesTolerance); Assert.Equal(LengthUnit.NauticalMile, nauticalmileQuantity.Unit); var printerpicaQuantity = meter.ToUnit(LengthUnit.PrinterPica); AssertEx.EqualTolerance(PrinterPicasInOneMeter, (double)printerpicaQuantity.Value, PrinterPicasTolerance); Assert.Equal(LengthUnit.PrinterPica, printerpicaQuantity.Unit); var printerpointQuantity = meter.ToUnit(LengthUnit.PrinterPoint); AssertEx.EqualTolerance(PrinterPointsInOneMeter, (double)printerpointQuantity.Value, PrinterPointsTolerance); Assert.Equal(LengthUnit.PrinterPoint, printerpointQuantity.Unit); var shackleQuantity = meter.ToUnit(LengthUnit.Shackle); AssertEx.EqualTolerance(ShacklesInOneMeter, (double)shackleQuantity.Value, ShacklesTolerance); Assert.Equal(LengthUnit.Shackle, shackleQuantity.Unit); var twipQuantity = meter.ToUnit(LengthUnit.Twip); AssertEx.EqualTolerance(TwipsInOneMeter, (double)twipQuantity.Value, TwipsTolerance); Assert.Equal(LengthUnit.Twip, twipQuantity.Unit); var ussurveyfootQuantity = meter.ToUnit(LengthUnit.UsSurveyFoot); AssertEx.EqualTolerance(UsSurveyFeetInOneMeter, (double)ussurveyfootQuantity.Value, UsSurveyFeetTolerance); Assert.Equal(LengthUnit.UsSurveyFoot, ussurveyfootQuantity.Unit); var yardQuantity = meter.ToUnit(LengthUnit.Yard); AssertEx.EqualTolerance(YardsInOneMeter, (double)yardQuantity.Value, YardsTolerance); Assert.Equal(LengthUnit.Yard, yardQuantity.Unit); }
public void PropertyTests() { string[] array = { "abc", "bca", "xyz", "qrs" }; string[] array2 = { "a", "ab", "abc" }; var list = new ArrayList(array); // Not available using the classic syntax // Constraint Syntax Assert.That(list, Has.Property("Count")); Assert.That(list, Has.No.Property("Length")); Assert.That("Hello", Has.Length.EqualTo(5)); Assert.That("Hello", Has.Length.LessThan(10)); Assert.That("Hello", Has.Property("Length").EqualTo(5)); Assert.That("Hello", Has.Property("Length").GreaterThan(3)); Assert.That(array, Has.Property("Length").EqualTo(4)); Assert.That(array, Has.Length.EqualTo(4)); Assert.That(array, Has.Property("Length").LessThan(10)); Assert.That(array, Has.All.Property("Length").EqualTo(3)); Assert.That(array, Has.All.Length.EqualTo(3)); Assert.That(array, Is.All.Length.EqualTo(3)); Assert.That(array, Has.All.Property("Length").EqualTo(3)); Assert.That(array, Is.All.Property("Length").EqualTo(3)); Assert.That(array2, Has.Some.Property("Length").EqualTo(2)); Assert.That(array2, Has.Some.Length.EqualTo(2)); Assert.That(array2, Has.Some.Property("Length").GreaterThan(2)); Assert.That(array2, Is.Not.Property("Length").EqualTo(4)); Assert.That(array2, Is.Not.Length.EqualTo(4)); Assert.That(array2, Has.No.Property("Length").GreaterThan(3)); Assert.That(List.Map(array2).Property("Length"), Is.EqualTo(new[] { 1, 2, 3 })); Assert.That(List.Map(array2).Property("Length"), Is.EquivalentTo(new[] { 3, 2, 1 })); Assert.That(List.Map(array2).Property("Length"), Is.SubsetOf(new[] { 1, 2, 3, 4, 5 })); Assert.That(List.Map(array2).Property("Length"), Is.Unique); Assert.That(list, Has.Count.EqualTo(4)); // Inherited syntax Expect(list, Property("Count")); Expect(list, Not.Property("Nada")); Expect("Hello", Length.EqualTo(5)); Expect("Hello", Property("Length").EqualTo(5)); Expect("Hello", Property("Length").GreaterThan(0)); Expect(array, Property("Length").EqualTo(4)); Expect(array, Length.EqualTo(4)); Expect(array, Property("Length").LessThan(10)); Expect(array, All.Length.EqualTo(3)); Expect(array, All.Property("Length").EqualTo(3)); Expect(array2, Some.Property("Length").EqualTo(2)); Expect(array2, Some.Length.EqualTo(2)); Expect(array2, Some.Property("Length").GreaterThan(2)); Expect(array2, None.Property("Length").EqualTo(4)); Expect(array2, None.Length.EqualTo(4)); Expect(array2, None.Property("Length").GreaterThan(3)); Expect(Map(array2).Property("Length"), EqualTo(new[] { 1, 2, 3 })); Expect(Map(array2).Property("Length"), EquivalentTo(new[] { 3, 2, 1 })); Expect(Map(array2).Property("Length"), SubsetOf(new[] { 1, 2, 3, 4, 5 })); Expect(Map(array2).Property("Length"), Unique); Expect(list, Count.EqualTo(4)); }
/// <summary>Get <see cref="Length"/> from <see cref="Force"/> divided by <see cref="ForcePerLength"/>.</summary> public static Length operator /(Force force, ForcePerLength forcePerLength) { return(Length.FromMeters(force.Newtons / forcePerLength.NewtonsPerMeter)); }
public LengthAttribute(int min, Length length) { Length = (int)length; Min = min; }
public string CustomNumberOfSignificantDigitsAfterRadixFormatting(int significantDigitsAfterRadix) { return(Length.FromMeters(1.123456789).ToString(LengthUnit.Meter, null, significantDigitsAfterRadix)); }
public void GenerateRandomLettersWithLengthOfTenStaticValueExpectedFiveRandomCharString() { const int Length = 10; SetupArguments(ActivityStrings.RandomActivityDataListWithData, ActivityStrings.RandomActivityDataListShape, enRandomType.Letters, string.Empty, string.Empty, Length.ToString(CultureInfo.InvariantCulture), "[[OutVar1]]"); IDSFDataObject result = ExecuteProcess(); string error; string actual; GetScalarValueFromEnvironment(result.Environment, "OutVar1", out actual, out error); // remove test datalist ;) if (string.IsNullOrEmpty(error)) { Assert.AreEqual(Length, actual.Length); } else { Assert.Fail("The following errors occurred while retrieving datalist items\r\nerrors:{0}", error); } }
protected void btn_Submit_Click(object sender, EventArgs e) { lbl_ErrorBaySpacing.Visible = false; double baySpacing = 0; bool baySpacingIsValid = double.TryParse(txt_BaySpacing.Text, out baySpacing); double width = Length.From(double.Parse(txt_LandWidth.Text), selectedUnit).Millimeters; double length = Length.From(double.Parse(txt_LandLength.Text), selectedUnit).Millimeters; baySpacing = Length.From(baySpacing, selectedUnit).Millimeters; double eaveHeight = Length.From(double.Parse(txt_EaveHeight.Text), selectedUnit).Millimeters; if (!baySpacingIsValid || baySpacing < 5000 || baySpacing > 10000)//ToDo:need Revision { lbl_ErrorBaySpacing.Visible = true; return; } HndzFrame3D finalFrame = null; HndzFrameTypeEnum type; HndzBuilding bui = new HndzBuilding(project); HndzStorey storey = new HndzStorey(bui, 0); if (Enum.TryParse(Request.QueryString["FrameType"], out type)) { switch (type) { case HndzFrameTypeEnum.Undefined: throw new NotImplementedException("Undefined Frame"); break; case HndzFrameTypeEnum.ClearSpan: finalFrame = new HndzFrameSingleBay3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.SingleSlope: finalFrame = new HndzFrameMonoSlope3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan1: finalFrame = new HndzFrameMultiSpan13D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan2: finalFrame = new HndzFrameMultiSpan23D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan3: finalFrame = new HndzFrameMultiSpan33D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiGable: finalFrame = new HndzFrameMultiGable3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; default: break; } finalFrame.FramesCount = Convert.ToInt32(txt_FramesCount.Text); finalFrame.Type = type; DataContractSerializer xmlser = new DataContractSerializer(finalFrame.GetType()); string relativePath = Resources.WebResources.XMLPath + string.Format("Frame No.{0}.xml", finalFrame.GlobalId.ToString()); string absolutePath = Server.MapPath(relativePath); using (XmlWriter xw = XmlWriter.Create(absolutePath)) { xmlser.WriteObject(xw, finalFrame); } HttpCookie cookName = null; if (Request.Cookies["Frame"] == null) //mafrod 3mro ma yd5l hna bs e7tyaty { cookName = new HttpCookie("Frame"); } else { cookName = Response.Cookies["Frame"]; } cookName.Value = absolutePath; Response.Cookies.Add(cookName); } else { #region IFC Creation //HttpCookie cookNameFile = null; //if (Request.Cookies["FileName"] == null) //{ // cookNameFile = new HttpCookie("FileName"); //} //else //{ // cookNameFile = Response.Cookies["FileName"]; // #region Delete old files // //string oldFileName = cookName.Value; // //string oldFilePath = Resources.WebResources.wexbimPath + oldFileName; // //oldFilePath = Server.MapPath(oldFilePath); // //if ((File.Exists(oldFilePath + ".ifc"))) // //{ // // File.Delete(oldFilePath + ".ifc"); // //} // //if ((File.Exists(oldFilePath + ".wexbim"))) // //{ // // File.Delete(oldFilePath + ".wexbim"); // //} // #endregion //} //string fileName = "DesignedFrame" + Guid.NewGuid().ToString(); //string filePath = Resources.WebResources.wexbimPath + fileName; //filePath = Server.MapPath(filePath); //try //{ // BIM.ConvertToIFC.GenerateIFCProject(project, filePath); // cookNameFile.Value = fileName; // Response.Cookies.Add(cookNameFile); // Response.Redirect("/Pages/Designer/DesignWizard.aspx?FrameType=");//ToDo:goto Viewer and final results page isa //} //catch (Exception ex) //{ // IsInvalidModel = true; // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", "$('btn_error').click();", true);//wrong //} #endregion } Session["FrameObject"] = finalFrame; Response.Redirect("/Pages/Designer/DesignWizard.aspx?FrameType=" + finalFrame.Type.ToString()); }
private void ConvertIntoFrame() { lbl_ErrorBaySpacing.Visible = false; double baySpacing = 0; bool baySpacingIsValid = double.TryParse(txt_BaySpacing.Text, out baySpacing); double width = Length.From(double.Parse(txt_LandWidth.Text), selectedUnit).Millimeters; double length = Length.From(double.Parse(txt_LandLength.Text), selectedUnit).Millimeters; baySpacing = Length.From(baySpacing, selectedUnit).Millimeters; double eaveHeight = Length.From(double.Parse(txt_EaveHeight.Text), selectedUnit).Millimeters; if (!baySpacingIsValid || baySpacing < 5000 || baySpacing > 10000)//ToDo:need Revision { lbl_ErrorBaySpacing.Visible = true; return; } HndzFrame3D finalFrame = null; HndzFrameTypeEnum type; HndzBuilding bui = new HndzBuilding(project); HndzStorey storey = new HndzStorey(bui, 0); if (Enum.TryParse(Request.QueryString["FrameType"], out type)) { switch (type) { case HndzFrameTypeEnum.Undefined: throw new NotImplementedException("Undefined Frame"); case HndzFrameTypeEnum.ClearSpan: finalFrame = new HndzFrameSingleBay3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.SingleSlope: finalFrame = new HndzFrameMonoSlope3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan1: finalFrame = new HndzFrameMultiSpan13D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan2: finalFrame = new HndzFrameMultiSpan23D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiSpan3: finalFrame = new HndzFrameMultiSpan33D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; case HndzFrameTypeEnum.MultiGable: finalFrame = new HndzFrameMultiGable3D(length, baySpacing, width, eaveHeight, 2000, (HndzLocationEnum)ddl_Location.SelectedIndex, (HndzRoofSlopeEnum)ddl_RoofSlope.SelectedIndex , (HndzRoofAccessibilityEnum)ddl_RoofAccessability.SelectedIndex, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey); break; default: break; } finalFrame.FramesCount = Convert.ToInt32(txt_FramesCount.Text); finalFrame.Type = type; HttpCookie cookName = null; if (Request.Cookies["FileName"] == null) { cookName = new HttpCookie("FileName"); } else { cookName = Response.Cookies["FileName"]; } string fileName = Guid.NewGuid().ToString(); string filePath = Resources.WebResources.wexbimPath + fileName; filePath = Server.MapPath(filePath); try { bool isGenerated = BIM.ConvertToIFC.GenerateIFCProject(finalFrame.BuildingStorey.Building.Project, filePath); cookName.Value = fileName; Response.Cookies.Add(cookName); } catch (Exception) { IsInvalidModel = true; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", "$('btn_error').click();", true);//wrong } return; } }
/// <summary> /// 符号を正に強制します /// </summary> /// <param name="a">長さ</param> /// <returns>確実に正の符号の長さ</returns> public static Length Abs(this Length a) { return(Length.From_m(Math.Abs(a._m))); }
public override int GetHashCode() => Name.GetHashCode() ^ FieldType.GetHashCode() ^ Offset.GetHashCode() ^ Length.GetHashCode() ^ DecimalCount.GetHashCode();