Fixes for equality

This commit is contained in:
2018-12-09 11:45:38 +01:00
parent e1b9bb2002
commit 92586e4939
6 changed files with 72 additions and 2 deletions

View File

@@ -55,5 +55,19 @@ namespace Upsilon.BaseTypes.UserData
{
return new ScriptNumberLong(Dictionary.Count);
}
protected bool Equals(DictionaryUserData other)
{
return Dictionary.Equals(other.Dictionary);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((DictionaryUserData) obj);
}
}
}

View File

@@ -55,5 +55,19 @@ namespace Upsilon.BaseTypes.UserData
{
return _typeInfo.UnaryOperator(Value, par1, op);
}
protected bool Equals(GenericUserData other)
{
return Value.Equals(other.Value);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((GenericUserData) obj);
}
}
}

View File

@@ -71,5 +71,19 @@ namespace Upsilon.BaseTypes.UserData
{
return new ScriptNumberLong(List.Count);
}
protected bool Equals(ListUserData other)
{
return List.Equals(other.List);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((ListUserData) obj);
}
}
}