Root
using System;
namespace Relativity.DataTransfer.Nodes.Internal
{
public abstract class Root : IRoot, INode, IEquatable<Root>
{
public string Name { get; }
public INodeContext Context => NullNodeContext.Instance;
public INode Parent => null;
public string AbsolutePath => string.Empty;
public string HashedName => Name;
public string HashedAbsolutePath => string.Empty;
protected Root(string name)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("name");
Name = name;
}
public override bool Equals(object obj)
{
if (obj != null) {
if (this != obj)
return obj.GetType() == GetType() && Equals((Root)obj);
return true;
}
return false;
}
public bool Equals(Root other)
{
if ((object)other != null)
return (object)this == other || string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase);
return false;
}
public override int GetHashCode()
{
return (Name != null) ? Name.GetHashCode() : 0;
}
public static bool operator ==(Root left, Root right)
{
return object.Equals(left, right);
}
public static bool operator !=(Root left, Root right)
{
return !object.Equals(left, right);
}
}
}