From 48ff651b6bf83b9ba2442488f3f49c9c6a517516 Mon Sep 17 00:00:00 2001 From: rampaa Date: Sat, 1 Feb 2025 16:48:31 +0300 Subject: [PATCH] Minor --- JL.Core.Tests/Deconjugation/DeconjugatorTests.cs | 2 +- JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs | 3 +++ JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaRecord.cs | 3 +++ JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanRecord.cs | 3 +++ JL.Core/Dicts/JMdict/JmdictRecord.cs | 3 +++ JL.Core/Dicts/JMnedict/JmnedictRecord.cs | 3 +++ JL.Core/Dicts/KanjiDict/YomichanKanjiRecord.cs | 3 +++ JL.Core/Dicts/PitchAccent/PitchAccentRecord.cs | 3 +++ JL.Core/WordClass/JmdictWordClass.cs | 3 +++ 9 files changed, 25 insertions(+), 1 deletion(-) diff --git a/JL.Core.Tests/Deconjugation/DeconjugatorTests.cs b/JL.Core.Tests/Deconjugation/DeconjugatorTests.cs index 83c09aa5..5aa3953c 100644 --- a/JL.Core.Tests/Deconjugation/DeconjugatorTests.cs +++ b/JL.Core.Tests/Deconjugation/DeconjugatorTests.cs @@ -27,7 +27,7 @@ public void Deconjugate_わからない() bool success = false; foreach (Form form in result) { - if (form.Text is expectedText && form.Process.FirstOrDefault() is expectedProcess) + if (form.Text is expectedText && form.Process.Count > 0 && form.Process[0] is expectedProcess) { success = true; break; diff --git a/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs b/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs index 75b130a9..a343b10c 100644 --- a/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs +++ b/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs @@ -235,4 +235,7 @@ public override int GetHashCode() return hash; } } + + public static bool operator ==(CustomWordRecord? left, CustomWordRecord? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(CustomWordRecord? left, CustomWordRecord? right) => left is not null ? !left.Equals(right) : right is not null; } diff --git a/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaRecord.cs b/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaRecord.cs index 5aa73df2..cb65f5ee 100644 --- a/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaRecord.cs +++ b/JL.Core/Dicts/EPWING/Nazeka/EpwingNazekaRecord.cs @@ -147,4 +147,7 @@ public override int GetHashCode() return hash; } } + + public static bool operator ==(EpwingNazekaRecord? left, EpwingNazekaRecord? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(EpwingNazekaRecord? left, EpwingNazekaRecord? right) => left is not null ? !left.Equals(right) : right is not null; } diff --git a/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanRecord.cs b/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanRecord.cs index e06aec64..91a68ac5 100644 --- a/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanRecord.cs +++ b/JL.Core/Dicts/EPWING/Yomichan/EpwingYomichanRecord.cs @@ -166,4 +166,7 @@ public override int GetHashCode() return hash; } } + + public static bool operator ==(EpwingYomichanRecord? left, EpwingYomichanRecord? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(EpwingYomichanRecord? left, EpwingYomichanRecord? right) => left is not null ? !left.Equals(right) : right is not null; } diff --git a/JL.Core/Dicts/JMdict/JmdictRecord.cs b/JL.Core/Dicts/JMdict/JmdictRecord.cs index c1a57720..a41b6b87 100644 --- a/JL.Core/Dicts/JMdict/JmdictRecord.cs +++ b/JL.Core/Dicts/JMdict/JmdictRecord.cs @@ -338,4 +338,7 @@ public override int GetHashCode() return Id * PrimarySpelling.GetHashCode(StringComparison.Ordinal); } } + + public static bool operator ==(JmdictRecord? left, JmdictRecord? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(JmdictRecord? left, JmdictRecord? right) => left is not null ? !left.Equals(right) : right is not null; } diff --git a/JL.Core/Dicts/JMnedict/JmnedictRecord.cs b/JL.Core/Dicts/JMnedict/JmnedictRecord.cs index 20f69766..6482f173 100644 --- a/JL.Core/Dicts/JMnedict/JmnedictRecord.cs +++ b/JL.Core/Dicts/JMnedict/JmnedictRecord.cs @@ -107,4 +107,7 @@ public override int GetHashCode() return Id * PrimarySpelling.GetHashCode(StringComparison.Ordinal); } } + + public static bool operator ==(JmnedictRecord? left, JmnedictRecord? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(JmnedictRecord? left, JmnedictRecord? right) => left is not null ? !left.Equals(right) : right is not null; } diff --git a/JL.Core/Dicts/KanjiDict/YomichanKanjiRecord.cs b/JL.Core/Dicts/KanjiDict/YomichanKanjiRecord.cs index f8cdf2c2..ebe5b34f 100644 --- a/JL.Core/Dicts/KanjiDict/YomichanKanjiRecord.cs +++ b/JL.Core/Dicts/KanjiDict/YomichanKanjiRecord.cs @@ -200,4 +200,7 @@ public override int GetHashCode() return hash; } } + + public static bool operator ==(YomichanKanjiRecord left, YomichanKanjiRecord right) => left.Equals(right); + public static bool operator !=(YomichanKanjiRecord left, YomichanKanjiRecord right) => !left.Equals(right); } diff --git a/JL.Core/Dicts/PitchAccent/PitchAccentRecord.cs b/JL.Core/Dicts/PitchAccent/PitchAccentRecord.cs index e06c2bf1..dccbf487 100644 --- a/JL.Core/Dicts/PitchAccent/PitchAccentRecord.cs +++ b/JL.Core/Dicts/PitchAccent/PitchAccentRecord.cs @@ -72,4 +72,7 @@ public override int GetHashCode() { return HashCode.Combine(Spelling, Reading); } + + public static bool operator ==(PitchAccentRecord left, PitchAccentRecord right) => left.Equals(right); + public static bool operator !=(PitchAccentRecord left, PitchAccentRecord right) => !left.Equals(right); } diff --git a/JL.Core/WordClass/JmdictWordClass.cs b/JL.Core/WordClass/JmdictWordClass.cs index d814639d..c45134b1 100644 --- a/JL.Core/WordClass/JmdictWordClass.cs +++ b/JL.Core/WordClass/JmdictWordClass.cs @@ -53,4 +53,7 @@ public override int GetHashCode() return hash; } } + + public static bool operator ==(JmdictWordClass? left, JmdictWordClass? right) => left is not null ? left.Equals(right) : right is null; + public static bool operator !=(JmdictWordClass? left, JmdictWordClass? right) => left is not null ? !left.Equals(right) : right is not null; }