diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-30 17:20:53 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-30 17:20:53 +0100 |
| commit | ec5037c01868fecaec2eba89b975f3e53aded89a (patch) | |
| tree | e0d5a092419bace577a90eb29699f5be57f36078 /Mammoth/Couscous/HorribleHacks.cs | |
| parent | 17d1a1f710edd8dfb92e75bcd273e04cee7c8146 (diff) | |
Export from java-mammoth 5f538798b147f0e76
Diffstat (limited to 'Mammoth/Couscous/HorribleHacks.cs')
| -rw-r--r-- | Mammoth/Couscous/HorribleHacks.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Mammoth/Couscous/HorribleHacks.cs b/Mammoth/Couscous/HorribleHacks.cs new file mode 100644 index 0000000..c97dc0a --- /dev/null +++ b/Mammoth/Couscous/HorribleHacks.cs @@ -0,0 +1,34 @@ +using Mammoth.Couscous.java.util; +using Mammoth.Couscous.org.zwobble.mammoth.@internal.documents; +using Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing; +using System.Linq; + +namespace Mammoth.Couscous { + internal static class HorribleHacks { + internal static bool equals(this char first, int second) { + return first == second; + } + + internal static bool equals(this Optional<string> first, Optional<string> second) { + return (!first.isPresent() && !second.isPresent()) || (first.isPresent() && second.isPresent() && first.get() == second.get()); + } + + internal static bool equals(this Map<string, string> firstMap, Map<string, string> secondMap) { + var first = FromJava.MapToDictionary(firstMap); + var second = FromJava.MapToDictionary(secondMap); + return first.Count == second.Count && first.All(item => second.ContainsKey(item.Key) && second[item.Key] == item.Value); + } + + internal static bool equals(this NoteType first, NoteType second) { + return first == second; + } + + internal static bool equals(this TokenType first, TokenType second) { + return first == second; + } + + internal static string getMessage(this System.Exception exception) { + return exception.Message; + } + } +} |
