Files
BeWoPlaner/Shared/DataContracts/Feature/AI/AiModelDC.cs

72 lines
1.4 KiB
C#
Raw Normal View History

2025-03-19 16:30:27 +01:00
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
2025-03-19 16:30:27 +01:00
using System.Text;
using System.Threading.Tasks;
namespace BS.Shared.DataContracts.Feature.AI
2025-03-19 16:30:27 +01:00
{
public class AiModelDC : BeWoDataContract, IComparable<AiModelDC>
2025-03-19 16:30:27 +01:00
{
public AiModelDC()
{
}
public AiModelDC(AiModelSource modelSource, string name, int value)
2025-03-19 16:30:27 +01:00
{
ModelSource = modelSource;
2025-03-19 16:30:27 +01:00
ModelName = name;
Value = value;
}
public string ModelName { get; set; }
public int Value { get; set; }
public AiModelSource ModelSource { get; set; }
2025-03-19 16:30:27 +01:00
public virtual int CompareTo(AiModelDC other)
2025-03-19 16:30:27 +01:00
{
if (other == null) return 1;
2025-03-19 16:30:27 +01:00
var comp = ModelSource.CompareTo(other.ModelSource);
2025-03-19 16:30:27 +01:00
if (comp != 0) return comp;
var comp1 = ModelName.CompareTo(other.ModelName);
if (comp1 != 0) return comp;
2025-03-19 16:30:27 +01:00
var comp2 = Value.CompareTo(other.Value);
return comp2;
}
public override bool Equals(object obj)
{
return obj is AiModelDC ent &&
ModelSource == ent.ModelSource &&
ModelName == ent.ModelName &&
Value == ent.Value;
2025-03-19 16:30:27 +01:00
}
public override int GetHashCode()
{
unchecked
{
var result = 0;
result = (result * 397) ^ ModelSource.GetHashCode();
2025-03-19 16:30:27 +01:00
result = (result * 397) ^ ModelName.GetHashCode();
result = (result * 397) ^ Value.GetHashCode();
return result;
}
}
public override string ToString()
{
return $"{ModelName} ({ModelSource})";
2025-03-19 16:30:27 +01:00
}
}
}