Equals() protected abstract method

protected abstract Equals ( ) : IEnumerable
return IEnumerable
示例#1
0
 private void DestroyThisBase(Base baseModel)
 {
     if (model.Equals(baseModel))
     {
         Destroy(gameObject);
     }
 }
示例#2
0
        public override bool performToolAction(Tool tool, GameLocation location)
        {
            if (!location.objects.TryGetValue(Base.TileLocation, out SObject occupant) ||
                !Base.Equals(occupant) || isTemporarilyInvisible)
            {
                return(false);
            }

            if (tool is WateringCan can && can.WaterLeft > 0)
            {
                int health = Base.getHealth() - 1;
                if (health <= 0)
                {
                    germinateLive(location, Base.TileLocation);
                }
                else
                {
                    Base.setHealth(health);
                }
                return(false);
            }

            if (tool is not MeleeWeapon && (tool?.isHeavyHitter() ?? true))
            {
                location.playSound("hammer");
                location.objects.Remove(Base.TileLocation);
                location.debris.Add(new Debris(Base, Base.TileLocation * 64f +
                                               new Vector2(32f, 32f)));
                return(false);
            }

            return(false);
        }
示例#3
0
 public bool Equals(TradePair rhs)
 {
     return
         (rhs != null &&
          Base.Equals(rhs.Base) &&
          Quote.Equals(rhs.Quote) &&
          Exchange == rhs.Exchange);
 }
示例#4
0
 private void ResolveDestoryedBase(Base baseModel)
 {
     if (baseModel.Equals(target))
     {
         target     = null;
         this.state = EnemyState.Searching;
     }
 }
示例#5
0
        public override bool Equals(object obj)
        {
            if (obj is Model.IMove)
            {
                return(Base.Equals(obj));
            }

            return(base.Equals(obj));
        }
示例#6
0
 public bool Equals(ServoPositions other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Base.Equals(other.Base) && Shoulder.Equals(other.Shoulder) && Elbow.Equals(other.Elbow));
 }
示例#7
0
    public bool Equals(Base <T> other)
    {
        if (other is null)
        {
            return(false);
        }

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

        return(GetType() == other.GetType() && Equals().SequenceEqual(other.Equals()));
    }
示例#8
0
文件: Base.cs 项目: rafaelfgx/DDD
    public bool Equals(Base<T> obj)
    {
        if (obj is null)
        {
            return false;
        }

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

        if (GetType() != obj.GetType())
        {
            return false;
        }

        return Equals().SequenceEqual(obj.Equals());
    }
示例#9
0
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var other = obj as Instance;

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

            return(true);
        }
示例#10
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)
                 ));
        }
示例#11
0
        /// <summary>Determines whether two Query instances are equal.</summary>
        /// <returns>True if the two Queries are equal, False otherwise</returns>
        public override bool Equals(object other)
        {
            if (null == other)
            {
                return(false);
            }
            if (this == other)
            {
                return(true);
            }
            if (!GetType().Equals(other.GetType()))
            {
                return(false);
            }

            Query specific = (Query)other;

            if (ResultLimit != specific.ResultLimit)
            {
                return(false);
            }
            if (ResultOffset != specific.ResultOffset)
            {
                return(false);
            }
            if (itsSelectAll != specific.itsSelectAll)
            {
                return(false);
            }
            if (itsVariables.Count != specific.itsVariables.Count)
            {
                return(false);
            }
            if (!itsPatternGroup.Equals(specific.itsPatternGroup))
            {
                return(false);
            }
            if (!Base.Equals(specific.Base))
            {
                return(false);
            }
            if (OrderDirection != specific.OrderDirection)
            {
                return(false);
            }
            if (!OrderBy.Equals(specific.OrderBy))
            {
                return(false);
            }
            if (ResultForm != specific.ResultForm)
            {
                return(false);
            }

            if (null == itsQueryGroup && null != specific.itsQueryGroup)
            {
                return(false);
            }
            if (null != itsQueryGroup && null == specific.itsQueryGroup)
            {
                return(false);
            }
            if (null != itsQueryGroup && null != specific.itsQueryGroup)
            {
                if (!itsQueryGroup.Equals(specific.itsQueryGroup))
                {
                    return(false);
                }
            }


            IList otherVariables = specific.itsVariables;

            foreach (Variable variable in itsVariables)
            {
                if (!otherVariables.Contains(variable))
                {
                    return(false);
                }
            }

            IList otherDescribeTerms = specific.itsDescribeTerms;

            foreach (PatternTerm term in itsDescribeTerms)
            {
                if (!otherDescribeTerms.Contains(term))
                {
                    return(false);
                }
            }


            return(true);
        }
示例#12
0
 public bool Equals(Substring other) =>
 Base.Equals(other.Base) &&
 StartingOffset == other.StartingOffset &&
 Length == other.Length;