Esempio n. 1
0
 private bool Equals(DbaseField other) =>
 other != null &&
 Name.Equals(other.Name) &&
 FieldType.Equals(other.FieldType) &&
 Offset.Equals(other.Offset) &&
 Length.Equals(other.Length) &&
 DecimalCount.Equals(other.DecimalCount);
        public void Equals_DifferentValues_IsFalse(Offset value1, Offset value2)
        {
            // Arrange & Act
            var result = value1.Equals(value2);

            // Assert
            result.Should().BeFalse();
        }
Esempio n. 3
0
        public void TryStartOffset()
        {
            if (Offset.Equals(Vector3.zero))
            {
                return;
            }

            OffsetTime    = Mathf.Min(OffsetTime, Combatant.CurrentMove._animationClip.length / 2);
            m_offset_time = 0.0f;
        }
Esempio n. 4
0
        public void Equals_TheSameObject_True()
        {
            //Arrange
            var sut = new Offset();

            //Act
            var result = sut.Equals(sut);

            //Assert
            Assert.True(result);
        }
 public bool Equals(OffsetAndMetadata other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Offset.Equals(other.Offset) && Metadata == other.Metadata);
 }
Esempio n. 6
0
 /// <summary>
 /// Returns a value indicating whether this instance is equal to the specified <see cref="NzbSegment"/> value.
 /// </summary>
 /// <param name="other">A <see cref="NzbSegment"/> object to compare to this instance.</param>
 /// <returns>true if <paramref name="other" /> has the same value as this instance; otherwise, false.</returns>
 public bool Equals(NzbSegment other)
 {
     if ((object)other == null)
     {
         return(false);
     }
     return
         (Number.Equals(other.Number) &&
          Offset.Equals(other.Offset) &&
          Size.Equals(other.Size) &&
          MessageId.Equals(other.MessageId));
 }
Esempio n. 7
0
        public void Equals_TwoObjectsWithTheSameValues_False()
        {
            //Arrange
            var sut1 = new Offset(-1, 1);
            var sut2 = new Offset(1, -1);

            //Act
            var result1 = sut1.Equals(sut2);
            var result2 = sut2.Equals(sut1);

            //Assert
            Assert.False(result1);
            Assert.False(result2);
        }
Esempio n. 8
0
 private bool Equals(DbaseField other) =>
 other != null &&
 Name.Equals(other.Name) &&
 // HACK: Because legacy represents date times as characters - so why bother with DateTime support?
 (
     (
         (FieldType == DbaseFieldType.Character || FieldType == DbaseFieldType.DateTime)
         &&
         (other.FieldType == DbaseFieldType.Character || other.FieldType == DbaseFieldType.DateTime)
     )
     ||
     FieldType == other.FieldType
 ) &&
 Offset.Equals(other.Offset) &&
 Length.Equals(other.Length) &&
 DecimalCount.Equals(other.DecimalCount);
Esempio n. 9
0
        /// <inheritdoc/>
        /// <since_tizen> 9 </since_tizen>
        public override bool Equals(object other)
        {
            if ((other == null) || !GetType().Equals(other.GetType()))
            {
                return(false);
            }

            var otherShadow = (ShadowBase)other;

            if (!((Offset == null) ? otherShadow.Offset == null : Offset.Equals(otherShadow.Offset)))
            {
                return(false);
            }

            return((Extents == null) ? otherShadow.Extents == null : Extents.Equals(otherShadow.Extents));
        }
Esempio n. 10
0
        private PropertyValue GetTransformMap()
        {
            var transformMap = new PropertyMap();

            if (!Offset.Equals(noOffset))
            {
                transformMap[(int)VisualTransformPropertyType.OffsetPolicy] = new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute));
                transformMap[(int)VisualTransformPropertyType.Offset]       = PropertyValue.CreateWithGuard(Offset);
            }

            if (!Extents.Equals(noExtents))
            {
                transformMap[(int)VisualTransformPropertyType.ExtraSize] = PropertyValue.CreateWithGuard(Extents);
            }

            return(transformMap.Count() == 0 ? new PropertyValue() : new PropertyValue(transformMap));
        }
Esempio n. 11
0
        /// <inheritdoc />
        public bool Equals([AllowNull] CurrentValue other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                     ) &&
                 (
                     XAnchor == other.XAnchor ||
                     XAnchor != null &&
                     XAnchor.Equals(other.XAnchor)
                 ) &&
                 (
                     Offset == other.Offset ||
                     Offset != null &&
                     Offset.Equals(other.Offset)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.Equals(other.Suffix)
                 ) &&
                 (
                     Font == other.Font ||
                     Font != null &&
                     Font.Equals(other.Font)
                 ));
        }
Esempio n. 12
0
        private PropertyValue GetTransformMap()
        {
            var transformMap = new PropertyMap();

            if (!Offset.Equals(noOffset))
            {
                transformMap[(int)VisualTransformPropertyType.OffsetPolicy] = new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute));
                transformMap[(int)VisualTransformPropertyType.Offset]       = PropertyValue.CreateWithGuard(Offset);
            }

            if (!Extents.Equals(noExtents))
            {
                transformMap[(int)VisualTransformPropertyType.ExtraSize] = PropertyValue.CreateWithGuard(Extents);
            }

            transformMap[(int)VisualTransformPropertyType.Origin]      = new PropertyValue((int)Visual.AlignType.Center);
            transformMap[(int)VisualTransformPropertyType.AnchorPoint] = new PropertyValue((int)Visual.AlignType.Center);

            return(new PropertyValue(transformMap));
        }
Esempio n. 13
0
        public override bool Equals(object obj)
        {
            var other = obj as ShxRecord;

            if (other == null)
            {
                return(false);
            }

            if (!Offset.Equals(other.Offset))
            {
                return(false);
            }

            if (!ContentLength.Equals(other.ContentLength))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 14
0
        /// <inheritdoc />
        public bool Equals([AllowNull] BarPolar other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     ShowLegend == other.ShowLegend ||
                     ShowLegend != null &&
                     ShowLegend.Equals(other.ShowLegend)
                 ) &&
                 (
                     LegendGroup == other.LegendGroup ||
                     LegendGroup != null &&
                     LegendGroup.Equals(other.LegendGroup)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     SelectedPoints == other.SelectedPoints ||
                     SelectedPoints != null &&
                     SelectedPoints.Equals(other.SelectedPoints)
                 ) &&
                 (
                     HoverLabel == other.HoverLabel ||
                     HoverLabel != null &&
                     HoverLabel.Equals(other.HoverLabel)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     Equals(Transforms, other.Transforms) ||
                     Transforms != null && other.Transforms != null &&
                     Transforms.SequenceEqual(other.Transforms)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Equals(R, other.R) ||
                     R != null && other.R != null &&
                     R.SequenceEqual(other.R)
                 ) &&
                 (
                     Equals(Theta, other.Theta) ||
                     Theta != null && other.Theta != null &&
                     Theta.SequenceEqual(other.Theta)
                 ) &&
                 (
                     R0 == other.R0 ||
                     R0 != null &&
                     R0.Equals(other.R0)
                 ) &&
                 (
                     Dr == other.Dr ||
                     Dr != null &&
                     Dr.Equals(other.Dr)
                 ) &&
                 (
                     Theta0 == other.Theta0 ||
                     Theta0 != null &&
                     Theta0.Equals(other.Theta0)
                 ) &&
                 (
                     DTheta == other.DTheta ||
                     DTheta != null &&
                     DTheta.Equals(other.DTheta)
                 ) &&
                 (
                     ThetaUnit == other.ThetaUnit ||
                     ThetaUnit != null &&
                     ThetaUnit.Equals(other.ThetaUnit)
                 ) &&
                 (
                     Base == other.Base ||
                     Base != null &&
                     Base.Equals(other.Base)
                 ) &&
                 (
                     Equals(BaseArray, other.BaseArray) ||
                     BaseArray != null && other.BaseArray != null &&
                     BaseArray.SequenceEqual(other.BaseArray)
                 ) &&
                 (
                     Offset == other.Offset ||
                     Offset != null &&
                     Offset.Equals(other.Offset)
                 ) &&
                 (
                     Equals(OffsetArray, other.OffsetArray) ||
                     OffsetArray != null && other.OffsetArray != null &&
                     OffsetArray.SequenceEqual(other.OffsetArray)
                 ) &&
                 (
                     Width == other.Width ||
                     Width != null &&
                     Width.Equals(other.Width)
                 ) &&
                 (
                     Equals(WidthArray, other.WidthArray) ||
                     WidthArray != null && other.WidthArray != null &&
                     WidthArray.SequenceEqual(other.WidthArray)
                 ) &&
                 (
                     Text == other.Text ||
                     Text != null &&
                     Text.Equals(other.Text)
                 ) &&
                 (
                     Equals(TextArray, other.TextArray) ||
                     TextArray != null && other.TextArray != null &&
                     TextArray.SequenceEqual(other.TextArray)
                 ) &&
                 (
                     HoverText == other.HoverText ||
                     HoverText != null &&
                     HoverText.Equals(other.HoverText)
                 ) &&
                 (
                     Equals(HoverTextArray, other.HoverTextArray) ||
                     HoverTextArray != null && other.HoverTextArray != null &&
                     HoverTextArray.SequenceEqual(other.HoverTextArray)
                 ) &&
                 (
                     Marker == other.Marker ||
                     Marker != null &&
                     Marker.Equals(other.Marker)
                 ) &&
                 (
                     HoverInfo == other.HoverInfo ||
                     HoverInfo != null &&
                     HoverInfo.Equals(other.HoverInfo)
                 ) &&
                 (
                     Equals(HoverInfoArray, other.HoverInfoArray) ||
                     HoverInfoArray != null && other.HoverInfoArray != null &&
                     HoverInfoArray.SequenceEqual(other.HoverInfoArray)
                 ) &&
                 (
                     HoverTemplate == other.HoverTemplate ||
                     HoverTemplate != null &&
                     HoverTemplate.Equals(other.HoverTemplate)
                 ) &&
                 (
                     Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                     HoverTemplateArray != null && other.HoverTemplateArray != null &&
                     HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)
                 ) &&
                 (
                     Selected == other.Selected ||
                     Selected != null &&
                     Selected.Equals(other.Selected)
                 ) &&
                 (
                     Unselected == other.Unselected ||
                     Unselected != null &&
                     Unselected.Equals(other.Unselected)
                 ) &&
                 (
                     Subplot == other.Subplot ||
                     Subplot != null &&
                     Subplot.Equals(other.Subplot)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     RSrc == other.RSrc ||
                     RSrc != null &&
                     RSrc.Equals(other.RSrc)
                 ) &&
                 (
                     ThetaSrc == other.ThetaSrc ||
                     ThetaSrc != null &&
                     ThetaSrc.Equals(other.ThetaSrc)
                 ) &&
                 (
                     BaseSrc == other.BaseSrc ||
                     BaseSrc != null &&
                     BaseSrc.Equals(other.BaseSrc)
                 ) &&
                 (
                     OffsetSrc == other.OffsetSrc ||
                     OffsetSrc != null &&
                     OffsetSrc.Equals(other.OffsetSrc)
                 ) &&
                 (
                     WidthSrc == other.WidthSrc ||
                     WidthSrc != null &&
                     WidthSrc.Equals(other.WidthSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ) &&
                 (
                     HoverTextSrc == other.HoverTextSrc ||
                     HoverTextSrc != null &&
                     HoverTextSrc.Equals(other.HoverTextSrc)
                 ) &&
                 (
                     HoverInfoSrc == other.HoverInfoSrc ||
                     HoverInfoSrc != null &&
                     HoverInfoSrc.Equals(other.HoverInfoSrc)
                 ) &&
                 (
                     HoverTemplateSrc == other.HoverTemplateSrc ||
                     HoverTemplateSrc != null &&
                     HoverTemplateSrc.Equals(other.HoverTemplateSrc)
                 ));
        }
 public bool Equals(BerlinClockTime other)
 {
     return(Offset.Equals(other));
 }
Esempio n. 16
0
        /// <summary>
        /// Compares element sizes.
        /// </summary>
        public override bool Equals(object obj)
        {
            var elementSizes = obj as VirtualItem;

            return((elementSizes != null) && Width.Equals(elementSizes.Width) && Height.Equals(elementSizes.Height) && Offset.Equals(elementSizes.Offset) && Alignment == elementSizes.Alignment);
        }
 public bool Equals(OpenGLVertexInputElement other)
 {
     return(SizeInBytes.Equals(other.SizeInBytes) && ElementCount.Equals(other.ElementCount) &&
            Type == other.Type && Offset.Equals(other.Offset) && Normalized.Equals(other.Normalized) &&
            InstanceStepRate.Equals(other.InstanceStepRate));
 }
Esempio n. 18
0
 public bool Equals(MetaTransformCopy other)
 {
     return(true && Region.Equals(other.Region) && Offset.Equals(other.Offset) && Size.Equals(other.Size));
 }
Esempio n. 19
0
 public bool Equals(Direction other)
 {
     return(Offset.Equals(other.Offset));
 }
Esempio n. 20
0
        public bool Equals([AllowNull] Funnel other)
        {
            if (other == null)
            {
                return(false);
            }

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

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (ShowLegend == other.ShowLegend && ShowLegend != null && other.ShowLegend != null && ShowLegend.Equals(other.ShowLegend)) &&
                   (LegendGroup == other.LegendGroup && LegendGroup != null && other.LegendGroup != null && LegendGroup.Equals(other.LegendGroup)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (SelectedPoints == other.SelectedPoints && SelectedPoints != null && other.SelectedPoints != null && SelectedPoints.Equals(other.SelectedPoints)) &&
                   (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) &&
                   (X0 == other.X0 && X0 != null && other.X0 != null && X0.Equals(other.X0)) &&
                   (DX == other.DX && DX != null && other.DX != null && DX.Equals(other.DX)) &&
                   (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) &&
                   (Y0 == other.Y0 && Y0 != null && other.Y0 != null && Y0.Equals(other.Y0)) &&
                   (Dy == other.Dy && Dy != null && other.Dy != null && Dy.Equals(other.Dy)) &&
                   (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) &&
                   (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) &&
                   (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) &&
                   (Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                    HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) &&
                   (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) &&
                   (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) &&
                   (TextInfo == other.TextInfo && TextInfo != null && other.TextInfo != null && TextInfo.Equals(other.TextInfo)) &&
                   (TextTemplate == other.TextTemplate && TextTemplate != null && other.TextTemplate != null && TextTemplate.Equals(other.TextTemplate)) &&
                   (Equals(TextTemplateArray, other.TextTemplateArray) || TextTemplateArray != null && other.TextTemplateArray != null && TextTemplateArray.SequenceEqual(other.TextTemplateArray)) &&
                   (Text == other.Text && Text != null && other.Text != null && Text.Equals(other.Text)) &&
                   (Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray)) &&
                   (TextPosition == other.TextPosition && TextPosition != null && other.TextPosition != null && TextPosition.Equals(other.TextPosition)) &&
                   (Equals(TextPositionArray, other.TextPositionArray) || TextPositionArray != null && other.TextPositionArray != null && TextPositionArray.SequenceEqual(other.TextPositionArray)) &&
                   (InsideTextAnchor == other.InsideTextAnchor && InsideTextAnchor != null && other.InsideTextAnchor != null && InsideTextAnchor.Equals(other.InsideTextAnchor)) &&
                   (TextAngle == other.TextAngle && TextAngle != null && other.TextAngle != null && TextAngle.Equals(other.TextAngle)) &&
                   (TextFont == other.TextFont && TextFont != null && other.TextFont != null && TextFont.Equals(other.TextFont)) &&
                   (InsideTextFont == other.InsideTextFont && InsideTextFont != null && other.InsideTextFont != null && InsideTextFont.Equals(other.InsideTextFont)) &&
                   (OutsideTextFont == other.OutsideTextFont && OutsideTextFont != null && other.OutsideTextFont != null && OutsideTextFont.Equals(other.OutsideTextFont)) &&
                   (ConstrainText == other.ConstrainText && ConstrainText != null && other.ConstrainText != null && ConstrainText.Equals(other.ConstrainText)) &&
                   (ClipOnAxis == other.ClipOnAxis && ClipOnAxis != null && other.ClipOnAxis != null && ClipOnAxis.Equals(other.ClipOnAxis)) &&
                   (Orientation == other.Orientation && Orientation != null && other.Orientation != null && Orientation.Equals(other.Orientation)) &&
                   (Offset == other.Offset && Offset != null && other.Offset != null && Offset.Equals(other.Offset)) &&
                   (Width == other.Width && Width != null && other.Width != null && Width.Equals(other.Width)) &&
                   (Marker == other.Marker && Marker != null && other.Marker != null && Marker.Equals(other.Marker)) &&
                   (Connector == other.Connector && Connector != null && other.Connector != null && Connector.Equals(other.Connector)) &&
                   (OffsetGroup == other.OffsetGroup && OffsetGroup != null && other.OffsetGroup != null && OffsetGroup.Equals(other.OffsetGroup)) &&
                   (AlignmentGroup == other.AlignmentGroup && AlignmentGroup != null && other.AlignmentGroup != null && AlignmentGroup.Equals(other.AlignmentGroup)) &&
                   (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) &&
                   (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) &&
                   (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) &&
                   (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) &&
                   (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) &&
                   (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc)) &&
                   (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc)) &&
                   (TextTemplateSrc == other.TextTemplateSrc && TextTemplateSrc != null && other.TextTemplateSrc != null && TextTemplateSrc.Equals(other.TextTemplateSrc)) &&
                   (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) &&
                   (TextPositionSrc == other.TextPositionSrc && TextPositionSrc != null && other.TextPositionSrc != null && TextPositionSrc.Equals(other.TextPositionSrc)));
        }
        public static List <Offset> FindClosedPosByAStar(Offset startNode, int startDirection, Offset endNode, out List <int> rotationPathWay)
        {
            Console.Error.WriteLine("Path finding from {0} to {1} at direction of {2}", startNode, endNode, startDirection);

            rotationPathWay = new List <int>();
            List <Offset> pathWay = new List <Offset>();

            if (startNode.Equals(endNode))
            {
                return(pathWay);
            }

            List <HexSearchNode> frontier = new List <HexSearchNode>();
            List <HexSearchNode> explored = new List <HexSearchNode>();

            HexSearchNode start = new HexSearchNode(startNode, startDirection, 0, GetHexHeuristic(startNode, endNode));

            frontier.Add(start);

            bool found = false;

            while (frontier.Count > 0)
            {
                HexSearchNode current = frontier[0];
                frontier.RemoveAt(0);
                explored.Add(current);

                if (current.Pos.Equals(endNode))
                {
                    HexSearchNode parent = current;

                    while (parent != null && parent != start)
                    {
                        //Console.Error.WriteLine( "cost to {0} is {1}", parent.Pos, parent.CostSoFar );
                        int rotation = Offset.GetRotation(parent.Parent.Pos, parent.Pos);
                        rotationPathWay.Add(rotation);
                        pathWay.Add(parent.Pos);
                        parent = parent.Parent;
                    }

                    found = true;
                    break;
                }

                // constraints for early exit such as line of sight
                if (Offset.GetDistance(current.Pos, start.Pos) < 5)
                {
                    List <HexSearchNode> neighbors = GetHexNeighbors(current, endNode);
                    foreach (HexSearchNode node in neighbors)
                    {
                        if (explored.Contains(node))
                        {
                            continue;
                        }

                        int costSoFar = current.CostSoFar;
                        int costToEnd = PathFinding.GetHexHeuristic(node.Pos, endNode);

                        int index = frontier.IndexOf(node);
                        if (index > 0)
                        {
                            if (costSoFar < frontier[index].CostSoFar)
                            {
                                // already exist in the container and found better way
                                frontier[index].Parent    = current;
                                frontier[index].Rotation  = current.Rotation;
                                frontier[index].CostSoFar = costSoFar;
                                frontier[index].CostToEnd = costToEnd;
                            }
                        }
                        else
                        {
                            // Not found
                            node.Parent    = current;
                            node.CostSoFar = costSoFar;
                            node.CostToEnd = costToEnd;
                            frontier.Add(node);
                        }
                    }
                }
                frontier.Sort((item1, item2) => (item1.CostSoFar + item1.CostToEnd) - (item2.CostSoFar + item2.CostToEnd));
                //Console.Error.WriteLine( "Frontier is {0}", frontier.ToDebugString() );
            }

            if (pathWay.Count == 0 && explored.Count > 0)
            {
                explored.Sort((item1, item2) => (item1.CostSoFar + item1.CostToEnd) - (item2.CostSoFar + item2.CostToEnd));
                HexSearchNode parent = explored[0];
                while (parent != null && parent != start)
                {
                    rotationPathWay.Add(Offset.GetRotation(parent.Parent.Pos, parent.Pos));
                    pathWay.Add(parent.Pos);
                    parent = parent.Parent;
                }
            }

            pathWay.Reverse();
            rotationPathWay.Reverse();

            if (found)
            {
                Console.Error.WriteLine("Found : Pathway from {0} to target({1}) is {2}, rotation = {3} at distance of {4}", startNode, endNode, pathWay.ToDebugString(), rotationPathWay.ToDebugString(), pathWay.Count);
            }
            else
            {
                Console.Error.WriteLine("Not Found : Closest Pathway from {0} to target({1}) is {2}, rotation = {3} at distance of {4}", startNode, endNode, pathWay.ToDebugString(), rotationPathWay.ToDebugString(), pathWay.Count);
            }

            return(pathWay);
        }
Esempio n. 22
0
 public bool Equals(Point other)
 {
     return(Offset.Equals(other));
 }