You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Semantic/Contracts/LexToken.cs

55 lines
1.5 KiB

using System;
using System.Runtime.Serialization;
namespace ZeroLevel.Services.Semantic
{
[Serializable]
[DataContract]
public class LexToken
{
[DataMember]
public readonly string Word;
[DataMember]
public readonly string Token;
[DataMember]
public readonly int Position;
public LexToken(string word, string token, int position)
{
Word = word;
Token = token;
Position = position;
}
public override bool Equals(object obj)
{
if (this == null)
throw new NullReferenceException();
return this.Equals(obj as LexToken);
}
public bool Equals(LexToken other)
{
if ((object)this == (object)other)
return true;
if (this == null)
throw new NullReferenceException();
if (other == null)
return false;
if (ReferenceEquals(this, other))
return true;
if (this.GetType() != other.GetType())
return false;
if (false == string.Equals(other.Word, this.Word, StringComparison.Ordinal)) return false;
if (false == string.Equals(other.Token, this.Token, StringComparison.Ordinal)) return false;
return this.Position == other.Position;
}
public override int GetHashCode()
{
return this.Word.GetHashCode() ^ this.Token.GetHashCode() & this.Position.GetHashCode();
}
}
}

Powered by TurnKey Linux.