From 45e530dceda42282fae56b4c4f5fa7865f57899d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 4 Jun 2016 16:03:56 +0100 Subject: Remove dotnet (use submodule from dotnet repo instead) --- dotnet/Mammoth/Couscous/Adapters.cs | 99 ------------------- dotnet/Mammoth/Couscous/HorribleHacks.cs | 34 ------- dotnet/Mammoth/Couscous/IterableExtensions.cs | 13 --- dotnet/Mammoth/Couscous/JavaStringExtensions.cs | 33 ------- dotnet/Mammoth/Couscous/java/io/Closeable.cs | 8 -- dotnet/Mammoth/Couscous/java/io/File.cs | 15 --- dotnet/Mammoth/Couscous/java/io/IOException.cs | 17 ---- dotnet/Mammoth/Couscous/java/io/InputStream.cs | 5 - .../Couscous/java/lang/IllegalArgumentException.cs | 8 -- .../java/lang/IndexOutOfBoundsException.cs | 7 -- dotnet/Mammoth/Couscous/java/lang/Iterable.cs | 5 - .../Mammoth/Couscous/java/lang/RuntimeException.cs | 13 --- dotnet/Mammoth/Couscous/java/lang/String.cs | 7 -- dotnet/Mammoth/Couscous/java/lang/StringBuilder.cs | 14 --- .../java/lang/UnsupportedOperationException.cs | 7 -- dotnet/Mammoth/Couscous/java/math/BigInteger.cs | 24 ----- dotnet/Mammoth/Couscous/java/net/URI.cs | 42 -------- .../Couscous/java/net/URISyntaxException.cs | 6 -- dotnet/Mammoth/Couscous/java/net/URL.cs | 28 ------ dotnet/Mammoth/Couscous/java/nio/file/Path.cs | 16 --- dotnet/Mammoth/Couscous/java/util/ArrayDeque.cs | 35 ------- dotnet/Mammoth/Couscous/java/util/ArrayList.cs | 49 --------- dotnet/Mammoth/Couscous/java/util/Arrays.cs | 7 -- dotnet/Mammoth/Couscous/java/util/Collection.cs | 11 --- dotnet/Mammoth/Couscous/java/util/Deque.cs | 10 -- dotnet/Mammoth/Couscous/java/util/HashMap.cs | 69 ------------- dotnet/Mammoth/Couscous/java/util/HashSet.cs | 34 ------- dotnet/Mammoth/Couscous/java/util/Iterator.cs | 6 -- dotnet/Mammoth/Couscous/java/util/List.cs | 8 -- dotnet/Mammoth/Couscous/java/util/Map.cs | 15 --- .../Couscous/java/util/NoSuchElementException.cs | 6 -- dotnet/Mammoth/Couscous/java/util/Optional.cs | 103 ------------------- dotnet/Mammoth/Couscous/java/util/Set.cs | 6 -- .../Couscous/java/util/function/BiConsumer.cs | 5 - .../Couscous/java/util/function/BiFunction.cs | 6 -- .../Couscous/java/util/function/BiPredicate.cs | 6 -- .../Couscous/java/util/function/Consumer.cs | 5 - .../Couscous/java/util/function/Function.cs | 6 -- .../Couscous/java/util/function/Predicate.cs | 5 - .../Couscous/java/util/function/Supplier.cs | 5 - .../mammoth/internal/docx/InMemoryDocxFile.cs | 13 --- .../mammoth/internal/docx/ZippedDocxFile.cs | 30 ------ .../internal/styles/parsing/LineParseException.cs | 15 --- .../internal/styles/parsing/ParseException.cs | 8 -- .../internal/styles/parsing/StyleMapParser.cs | 22 ----- .../mammoth/internal/util/Base64Encoding.cs | 18 ---- .../Couscous/mammoth/internal/util/Casts.cs | 13 --- .../Couscous/mammoth/internal/util/Iterables.cs | 60 ----------- .../Couscous/mammoth/internal/util/Lists.cs | 97 ------------------ .../Mammoth/Couscous/mammoth/internal/util/Maps.cs | 110 --------------------- .../mammoth/internal/util/PassThroughException.cs | 29 ------ .../Couscous/mammoth/internal/util/Paths.cs | 8 -- .../Mammoth/Couscous/mammoth/internal/util/Sets.cs | 18 ---- .../Couscous/mammoth/internal/util/Strings.cs | 18 ---- .../mammoth/internal/xml/parsing/SimpleSax.cs | 42 -------- dotnet/Mammoth/DocumentConverter.cs | 57 ----------- dotnet/Mammoth/IResult.cs | 8 -- dotnet/Mammoth/Mammoth.csproj | 107 -------------------- dotnet/Mammoth/Mammoth.nuspec | 16 --- dotnet/Mammoth/Properties/AssemblyInfo.cs | 27 ----- dotnet/Mammoth/SimpleResult.cs | 22 ----- 61 files changed, 1536 deletions(-) delete mode 100644 dotnet/Mammoth/Couscous/Adapters.cs delete mode 100644 dotnet/Mammoth/Couscous/HorribleHacks.cs delete mode 100644 dotnet/Mammoth/Couscous/IterableExtensions.cs delete mode 100644 dotnet/Mammoth/Couscous/JavaStringExtensions.cs delete mode 100644 dotnet/Mammoth/Couscous/java/io/Closeable.cs delete mode 100644 dotnet/Mammoth/Couscous/java/io/File.cs delete mode 100644 dotnet/Mammoth/Couscous/java/io/IOException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/io/InputStream.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/IndexOutOfBoundsException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/Iterable.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/RuntimeException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/String.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/StringBuilder.cs delete mode 100644 dotnet/Mammoth/Couscous/java/lang/UnsupportedOperationException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/math/BigInteger.cs delete mode 100644 dotnet/Mammoth/Couscous/java/net/URI.cs delete mode 100644 dotnet/Mammoth/Couscous/java/net/URISyntaxException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/net/URL.cs delete mode 100644 dotnet/Mammoth/Couscous/java/nio/file/Path.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/ArrayDeque.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/ArrayList.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Arrays.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Collection.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Deque.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/HashMap.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/HashSet.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Iterator.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/List.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Map.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/NoSuchElementException.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Optional.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/Set.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/BiFunction.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/BiPredicate.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/Consumer.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/Function.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/Predicate.cs delete mode 100644 dotnet/Mammoth/Couscous/java/util/function/Supplier.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/docx/InMemoryDocxFile.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/docx/ZippedDocxFile.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/StyleMapParser.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Base64Encoding.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Iterables.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Lists.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Paths.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Sets.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Strings.cs delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/xml/parsing/SimpleSax.cs delete mode 100644 dotnet/Mammoth/DocumentConverter.cs delete mode 100644 dotnet/Mammoth/IResult.cs delete mode 100644 dotnet/Mammoth/Mammoth.csproj delete mode 100644 dotnet/Mammoth/Mammoth.nuspec delete mode 100644 dotnet/Mammoth/Properties/AssemblyInfo.cs delete mode 100644 dotnet/Mammoth/SimpleResult.cs (limited to 'dotnet/Mammoth') diff --git a/dotnet/Mammoth/Couscous/Adapters.cs b/dotnet/Mammoth/Couscous/Adapters.cs deleted file mode 100644 index c45f35b..0000000 --- a/dotnet/Mammoth/Couscous/Adapters.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.io; - -namespace Mammoth.Couscous { - internal static class FromJava { - internal static IEnumerable IterableToEnumerable(Iterable iterable) { - Iterator iterator = iterable.iterator(); - while (iterator.hasNext()) { - yield return iterator.next(); - } - } - - internal static IDictionary MapToDictionary(Map map) { - return map.AsDictionary(); - } - } - - internal static class ToJava { - internal static Iterable EnumerableToIterable(IEnumerable enumerator) { - return new IterableWrapper(enumerator); - } - - private class IterableWrapper : Iterable { - private readonly IEnumerable _enumerable; - - internal IterableWrapper(IEnumerable enumerable) { - _enumerable = enumerable; - } - - public Iterator iterator() { - return EnumeratorToIterator(_enumerable.GetEnumerator()); - } - } - - internal static Iterator EnumeratorToIterator(IEnumerator enumerator) { - return new EnumeratorToIteratorAdapter(enumerator); - } - - private class EnumeratorToIteratorAdapter : Iterator { - private readonly IEnumerator _enumerator; - private bool _ready; - private bool _hasNext; - - internal EnumeratorToIteratorAdapter(IEnumerator enumerator) { - _enumerator = enumerator; - _ready = false; - } - - public bool hasNext() { - MakeReady(); - return _hasNext; - } - - public T next() { - MakeReady(); - if (_hasNext) { - _ready = false; - return _enumerator.Current; - } else { - throw new NoSuchElementException(); - } - } - - private void MakeReady() { - if (!_ready) { - MoveNext(); - } - } - - private void MoveNext() { - _hasNext = _enumerator.MoveNext(); - _ready = true; - } - } - - internal static Map DictionaryToMap(IDictionary dictionary) { - return new HashMap(dictionary); - } - - internal static java.util.List ListToList(IList list) { - return new ArrayList(list); - } - - internal static java.io.InputStream StreamToInputStream(System.IO.Stream stream) { - return new StreamToInputStreamAdapter(stream); - } - - private class StreamToInputStreamAdapter : InputStream { - public System.IO.Stream Stream { get; } - - internal StreamToInputStreamAdapter(System.IO.Stream stream) { - Stream = stream; - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/HorribleHacks.cs b/dotnet/Mammoth/Couscous/HorribleHacks.cs deleted file mode 100644 index c97dc0a..0000000 --- a/dotnet/Mammoth/Couscous/HorribleHacks.cs +++ /dev/null @@ -1,34 +0,0 @@ -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 first, Optional second) { - return (!first.isPresent() && !second.isPresent()) || (first.isPresent() && second.isPresent() && first.get() == second.get()); - } - - internal static bool equals(this Map firstMap, Map 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; - } - } -} diff --git a/dotnet/Mammoth/Couscous/IterableExtensions.cs b/dotnet/Mammoth/Couscous/IterableExtensions.cs deleted file mode 100644 index bac0b43..0000000 --- a/dotnet/Mammoth/Couscous/IterableExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util.function; - -namespace Mammoth.Couscous { - internal static class IterableExtensions { - public static void forEach(this Iterable iterable, Consumer consumer) { - var iterator = iterable.iterator(); - while (iterator.hasNext()) { - consumer.accept(iterator.next()); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/JavaStringExtensions.cs b/dotnet/Mammoth/Couscous/JavaStringExtensions.cs deleted file mode 100644 index bf4e73f..0000000 --- a/dotnet/Mammoth/Couscous/JavaStringExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace Mammoth.Couscous { - internal static class JavaStringExtensions { - internal static char charAt(this string value, int index) { - return value[index]; - } - - internal static bool equalsIgnoreCase(this string first, string second) { - return first.Equals(second, StringComparison.InvariantCultureIgnoreCase); - } - - internal static string replace(this string original, string search, string replacement) { - return original.Replace(search, replacement); - } - - internal static bool isEmpty(this string value) { - return value.Length == 0; - } - - internal static bool startsWith(this string value, string prefix) { - return value.StartsWith(prefix); - } - - internal static string trim(this string value) { - return value.Trim(); - } - - internal static string[] split(this string value, string separator) { - return System.Text.RegularExpressions.Regex.Split(value, separator); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/io/Closeable.cs b/dotnet/Mammoth/Couscous/java/io/Closeable.cs deleted file mode 100644 index 9dc10c5..0000000 --- a/dotnet/Mammoth/Couscous/java/io/Closeable.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.io { - internal interface Closeable { - void close(); - } -} - diff --git a/dotnet/Mammoth/Couscous/java/io/File.cs b/dotnet/Mammoth/Couscous/java/io/File.cs deleted file mode 100644 index abff40a..0000000 --- a/dotnet/Mammoth/Couscous/java/io/File.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Mammoth.Couscous.java.nio.file; - -namespace Mammoth.Couscous.java.io { - internal class File { - internal string Path { get; } - - internal File(string path) { - Path = path; - } - - internal Path toPath() { - return new Path(Path); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/io/IOException.cs b/dotnet/Mammoth/Couscous/java/io/IOException.cs deleted file mode 100644 index f7b708e..0000000 --- a/dotnet/Mammoth/Couscous/java/io/IOException.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.io -{ - internal class IOException : Exception { - internal IOException() : base() { - } - - internal IOException(string message) : base(message) { - } - - internal string getMessage() { - return Message; - } - } -} - diff --git a/dotnet/Mammoth/Couscous/java/io/InputStream.cs b/dotnet/Mammoth/Couscous/java/io/InputStream.cs deleted file mode 100644 index b474bb8..0000000 --- a/dotnet/Mammoth/Couscous/java/io/InputStream.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.io { - internal interface InputStream { - System.IO.Stream Stream { get; } - } -} diff --git a/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs b/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs deleted file mode 100644 index 57ef62b..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/IllegalArgumentException.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.lang { - internal class IllegalArgumentException : RuntimeException { - internal IllegalArgumentException(string message) : base(message) { - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/lang/IndexOutOfBoundsException.cs b/dotnet/Mammoth/Couscous/java/lang/IndexOutOfBoundsException.cs deleted file mode 100644 index c56c7c1..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/IndexOutOfBoundsException.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.lang { - internal class IndexOutOfBoundsException : RuntimeException { - } -} - diff --git a/dotnet/Mammoth/Couscous/java/lang/Iterable.cs b/dotnet/Mammoth/Couscous/java/lang/Iterable.cs deleted file mode 100644 index d050b06..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/Iterable.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.lang { - internal interface Iterable { - java.util.Iterator iterator(); - } -} diff --git a/dotnet/Mammoth/Couscous/java/lang/RuntimeException.cs b/dotnet/Mammoth/Couscous/java/lang/RuntimeException.cs deleted file mode 100644 index cf882aa..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/RuntimeException.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.lang -{ - internal class RuntimeException : Exception { - internal RuntimeException() : base() { - } - - internal RuntimeException(string message) : base(message) { - } - } -} - diff --git a/dotnet/Mammoth/Couscous/java/lang/String.cs b/dotnet/Mammoth/Couscous/java/lang/String.cs deleted file mode 100644 index bd0838d..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/String.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Mammoth.Couscous.java.lang { - internal partial class String { - internal static string join(string separator, Iterable values) { - return string.Join(separator, FromJava.IterableToEnumerable(values)); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/lang/StringBuilder.cs b/dotnet/Mammoth/Couscous/java/lang/StringBuilder.cs deleted file mode 100644 index c894936..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/StringBuilder.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Mammoth.Couscous.java.lang { - internal class StringBuilder { - private readonly System.Text.StringBuilder _builder = new System.Text.StringBuilder(); - - internal StringBuilder append(string value) { - _builder.Append(value); - return this; - } - - internal string toString() { - return _builder.ToString(); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/lang/UnsupportedOperationException.cs b/dotnet/Mammoth/Couscous/java/lang/UnsupportedOperationException.cs deleted file mode 100644 index da86874..0000000 --- a/dotnet/Mammoth/Couscous/java/lang/UnsupportedOperationException.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.lang { - internal class UnsupportedOperationException : RuntimeException { - } -} - diff --git a/dotnet/Mammoth/Couscous/java/math/BigInteger.cs b/dotnet/Mammoth/Couscous/java/math/BigInteger.cs deleted file mode 100644 index 40ac3d3..0000000 --- a/dotnet/Mammoth/Couscous/java/math/BigInteger.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Mammoth.Couscous.java.math { - internal class BigInteger { - internal static readonly BigInteger _ONE = new BigInteger(1); - - // TOOD: use proper BigInteger - private readonly long _value; - - internal BigInteger(string value) { - _value = long.Parse(value); - } - - internal BigInteger(long value) { - _value = value; - } - - internal BigInteger subtract(BigInteger other) { - return new BigInteger(_value - other._value); - } - - internal string toString() { - return _value.ToString(); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/net/URI.cs b/dotnet/Mammoth/Couscous/java/net/URI.cs deleted file mode 100644 index 818d694..0000000 --- a/dotnet/Mammoth/Couscous/java/net/URI.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace Mammoth.Couscous.java.net { - internal class URI { - private readonly Uri _uri; - - internal URI(string uri) { - try { - _uri = new Uri(uri, UriKind.RelativeOrAbsolute); - } catch (UriFormatException exception) { - throw new URISyntaxException(exception.Message); - } - } - - internal URI(Uri uri) { - _uri = uri; - } - - internal bool isAbsolute() { - return _uri.IsAbsoluteUri; - } - - internal URL toURL() { - return new URL(_uri.ToString()); - } - - internal URI resolve(string relativeUri) { - if (new URI(relativeUri).isAbsolute()) { - return new URI(relativeUri); - } else if (_uri.IsAbsoluteUri) { - return new URI(new Uri(_uri, relativeUri)); - } else { - var path = _uri.ToString(); - var lastSlashIndex = path.LastIndexOf("/"); - var basePath = lastSlashIndex == -1 - ? "." - : path.Substring(0, lastSlashIndex + 1); - return new URI(basePath + relativeUri); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/net/URISyntaxException.cs b/dotnet/Mammoth/Couscous/java/net/URISyntaxException.cs deleted file mode 100644 index 7380ff6..0000000 --- a/dotnet/Mammoth/Couscous/java/net/URISyntaxException.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Mammoth.Couscous.java.net { - internal class URISyntaxException : System.Exception { - internal URISyntaxException(string message) : base(message) { - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/net/URL.cs b/dotnet/Mammoth/Couscous/java/net/URL.cs deleted file mode 100644 index 88479e8..0000000 --- a/dotnet/Mammoth/Couscous/java/net/URL.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Net; -using Mammoth.Couscous.java.io; - -namespace Mammoth.Couscous.java.net { - internal class URL { - private readonly string _url; - - internal URL(string url) { - _url = url; - } - - internal InputStream openStream() { - try { - var response = WebRequest.Create(_url).GetResponse(); - try { - return ToJava.StreamToInputStream(response.GetResponseStream()); - } catch { - response.Close(); - throw; - } - } catch (System.UriFormatException) { - return ToJava.StreamToInputStream(System.IO.File.OpenRead(_url)); - } catch (System.Net.WebException exception) { - throw new java.io.IOException(exception.Message); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/nio/file/Path.cs b/dotnet/Mammoth/Couscous/java/nio/file/Path.cs deleted file mode 100644 index 030f757..0000000 --- a/dotnet/Mammoth/Couscous/java/nio/file/Path.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Mammoth.Couscous.java.net; - -namespace Mammoth.Couscous.java.nio.file { - internal class Path { - private readonly string _path; - - internal Path(string path) { - _path = path; - } - - internal URI toUri() { - return new URI(_path); - } - } -} - diff --git a/dotnet/Mammoth/Couscous/java/util/ArrayDeque.cs b/dotnet/Mammoth/Couscous/java/util/ArrayDeque.cs deleted file mode 100644 index df5447d..0000000 --- a/dotnet/Mammoth/Couscous/java/util/ArrayDeque.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Mammoth.Couscous.java.util { - internal class ArrayDeque : Deque { - private readonly System.Collections.Generic.IList _list = new System.Collections.Generic.List(); - - public int size() { - return _list.Count; - } - - public T getFirst() { - if (_list.Count > 0) { - return _list[0]; - } else { - throw new NoSuchElementException(); - } - } - - public T getLast() { - if (_list.Count > 0) { - return _list[_list.Count - 1]; - } else { - throw new NoSuchElementException(); - } - } - - public void add(T value) { - _list.Add(value); - } - - public T removeLast() { - T value = getLast(); - _list.RemoveAt(_list.Count - 1); - return value; - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/ArrayList.cs b/dotnet/Mammoth/Couscous/java/util/ArrayList.cs deleted file mode 100644 index 4414123..0000000 --- a/dotnet/Mammoth/Couscous/java/util/ArrayList.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util; - -namespace Mammoth.Couscous.java.util { - internal class ArrayList : List { - private readonly System.Collections.Generic.IList _list; - - internal ArrayList() : this(new System.Collections.Generic.List()) { - } - - internal ArrayList(System.Collections.Generic.IList list) { - _list = list; - } - - public Iterator iterator() { - return ToJava.EnumeratorToIterator(_list.GetEnumerator()); - } - - public bool isEmpty() { - return _list.Count == 0; - } - - public int size() { - return _list.Count; - } - - public bool contains(object value) { - return value is T && _list.Contains((T) value); - } - - public T get(int index) { - if (index < 0 || index >= _list.Count) { - throw new IndexOutOfBoundsException(); - } else { - return _list[index]; - } - } - - public void add(T value) { - _list.Add(value); - } - - public T remove(int index) { - T value = _list[index]; - _list.RemoveAt(index); - return value; - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Arrays.cs b/dotnet/Mammoth/Couscous/java/util/Arrays.cs deleted file mode 100644 index 093db83..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Arrays.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Mammoth.Couscous.java.util { - internal static class Arrays { - internal static List asList(T[] elements) { - return ToJava.ListToList(elements); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Collection.cs b/dotnet/Mammoth/Couscous/java/util/Collection.cs deleted file mode 100644 index a0cae74..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Collection.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.java.util { - interface Collection : Iterable { - bool isEmpty(); - int size(); - bool contains(object value); - - void add(T value); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Deque.cs b/dotnet/Mammoth/Couscous/java/util/Deque.cs deleted file mode 100644 index c954fce..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Deque.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Mammoth.Couscous.java.util { - internal interface Deque { - int size(); - T getFirst(); - T getLast(); - - void add(T value); - T removeLast(); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/HashMap.cs b/dotnet/Mammoth/Couscous/java/util/HashMap.cs deleted file mode 100644 index 38e516e..0000000 --- a/dotnet/Mammoth/Couscous/java/util/HashMap.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Mammoth.Couscous.org.zwobble.mammoth.@internal.util; -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.java.util { - internal class HashMap : Map { - private readonly IDictionary _dictionary; - - internal HashMap() : this(new Dictionary()) { - } - - internal HashMap(IDictionary dictionary) { - _dictionary = dictionary; - } - - public void put(TKey key, TValue value) { - _dictionary[key] = value; - } - - public bool containsKey(TKey key) { - return _dictionary.ContainsKey(key); - } - - public Set> entrySet() { - return new EntrySet(_dictionary); - } - - public Optional _lookup(TKey key) { - if (_dictionary.ContainsKey(key)) { - return new Some(_dictionary[key]); - } else { - return new None(); - } - } - - public IDictionary AsDictionary() { - return _dictionary; - } - - internal class EntrySet : Set> { - private readonly IDictionary _dictionary; - - internal EntrySet(IDictionary dictionary) { - _dictionary = dictionary; - } - - public Iterator> iterator() { - return ToJava.EnumeratorToIterator(_dictionary.Select(entry => Maps.entry(entry.Key, entry.Value)).GetEnumerator()); - } - - public bool isEmpty() { - return _dictionary.Count == 0; - } - - public int size() { - return _dictionary.Count; - } - - public bool contains(object value) { - return value is TKey && _dictionary.ContainsKey((TKey) value); - } - - public void add(Map__Entry value) { - throw new UnsupportedOperationException(); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/HashSet.cs b/dotnet/Mammoth/Couscous/java/util/HashSet.cs deleted file mode 100644 index ac10075..0000000 --- a/dotnet/Mammoth/Couscous/java/util/HashSet.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; - -namespace Mammoth.Couscous.java.util { - internal class HashSet : Set { - private readonly ISet _set; - - internal HashSet() : this(new System.Collections.Generic.HashSet()) { - } - - internal HashSet(ISet set) { - _set = set; - } - - public Iterator iterator() { - return ToJava.EnumeratorToIterator(_set.GetEnumerator()); - } - - public bool isEmpty() { - return _set.Count == 0; - } - - public int size() { - return _set.Count; - } - - public bool contains(object value) { - return value is T && _set.Contains((T)value); - } - - public void add(T value) { - _set.Add(value); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Iterator.cs b/dotnet/Mammoth/Couscous/java/util/Iterator.cs deleted file mode 100644 index 0ae48b2..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Iterator.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Mammoth.Couscous.java.util { - internal interface Iterator { - bool hasNext(); - T next(); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/List.cs b/dotnet/Mammoth/Couscous/java/util/List.cs deleted file mode 100644 index 45a9299..0000000 --- a/dotnet/Mammoth/Couscous/java/util/List.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.java.util { - interface List : Collection { - T get(int index); - T remove(int index); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Map.cs b/dotnet/Mammoth/Couscous/java/util/Map.cs deleted file mode 100644 index 5405c77..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Map.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Mammoth.Couscous.java.util { - internal interface Map { - void put(K key, V value); - bool containsKey(K key); - Set> entrySet(); - - Optional _lookup(K key); - System.Collections.Generic.IDictionary AsDictionary(); - } - - internal interface Map__Entry { - K getKey(); - V getValue(); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/NoSuchElementException.cs b/dotnet/Mammoth/Couscous/java/util/NoSuchElementException.cs deleted file mode 100644 index 4a1ee9c..0000000 --- a/dotnet/Mammoth/Couscous/java/util/NoSuchElementException.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.java.util { - internal class NoSuchElementException : RuntimeException { - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Optional.cs b/dotnet/Mammoth/Couscous/java/util/Optional.cs deleted file mode 100644 index f295688..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Optional.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Mammoth.Couscous.java.util.function; - -namespace Mammoth.Couscous.java.util -{ - internal interface Optional - { - bool isPresent(); - Optional map(Function function); - Optional flatMap(Function> function); - T orElse(T value); - T orElseGet(Supplier supplier); - T orElseThrow(Supplier exceptionSupplier) where TException : Exception; - T get(); - void ifPresent(Consumer consumer); - } - - internal class None : Optional { - public bool isPresent() { - return false; - } - - public Optional map(Function function) { - return new None(); - } - - public Optional flatMap(Function> function) { - return new None(); - } - - public T orElse(T value) { - return value; - } - - public T orElseGet(Supplier supplier) { - return supplier.get(); - } - - public T orElseThrow(Supplier exceptionSupplier) where TException : Exception { - throw exceptionSupplier.get(); - } - - public T get() { - throw new NoSuchElementException(); - } - - public void ifPresent(Consumer consumer) { - } - } - - internal class Some : Optional { - private readonly T _value; - - internal Some(T value) { - _value = value; - } - - public bool isPresent() { - return true; - } - - public Optional map(Function function) { - return new Some(function.apply(_value)); - } - - public Optional flatMap(Function> function) { - return function.apply(_value); - } - - public T orElse(T value) { - return _value; - } - - public T orElseGet(Supplier supplier) { - return _value; - } - - public T orElseThrow(Supplier exceptionSupplier) where TException : Exception { - return _value; - } - - public T get() { - return _value; - } - - public void ifPresent(Consumer consumer) { - consumer.accept(_value); - } - } - - internal static class Optional - { - internal static Optional empty() - { - return new None(); - } - - internal static Optional of(T value) - { - return new Some (value); - } - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/Set.cs b/dotnet/Mammoth/Couscous/java/util/Set.cs deleted file mode 100644 index 34a23ac..0000000 --- a/dotnet/Mammoth/Couscous/java/util/Set.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.java.util { - internal interface Set : Collection { - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs b/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs deleted file mode 100644 index 9479a78..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/BiConsumer.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.util.function { - internal interface BiConsumer { - void accept(T1 first, T2 second); - } -} diff --git a/dotnet/Mammoth/Couscous/java/util/function/BiFunction.cs b/dotnet/Mammoth/Couscous/java/util/function/BiFunction.cs deleted file mode 100644 index 050f85f..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/BiFunction.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Mammoth.Couscous.java.util.function -{ - internal interface BiFunction { - U apply(T1 first, T2 second); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/java/util/function/BiPredicate.cs b/dotnet/Mammoth/Couscous/java/util/function/BiPredicate.cs deleted file mode 100644 index 0419a6e..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/BiPredicate.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Mammoth.Couscous.java.util.function -{ - internal interface BiPredicate { - bool test(T first, U second); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/java/util/function/Consumer.cs b/dotnet/Mammoth/Couscous/java/util/function/Consumer.cs deleted file mode 100644 index f80d426..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/Consumer.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.util.function { - internal interface Consumer { - void accept(T value); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/java/util/function/Function.cs b/dotnet/Mammoth/Couscous/java/util/function/Function.cs deleted file mode 100644 index 2b4d3ae..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/Function.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Mammoth.Couscous.java.util.function -{ - internal interface Function { - U apply(T arg); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/java/util/function/Predicate.cs b/dotnet/Mammoth/Couscous/java/util/function/Predicate.cs deleted file mode 100644 index 2023309..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/Predicate.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.util.function { - internal interface Predicate { - bool test(T value); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/java/util/function/Supplier.cs b/dotnet/Mammoth/Couscous/java/util/function/Supplier.cs deleted file mode 100644 index eab3ffb..0000000 --- a/dotnet/Mammoth/Couscous/java/util/function/Supplier.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mammoth.Couscous.java.util.function { - internal interface Supplier { - T get(); - } -} \ No newline at end of file diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/docx/InMemoryDocxFile.cs b/dotnet/Mammoth/Couscous/mammoth/internal/docx/InMemoryDocxFile.cs deleted file mode 100644 index 9b7efd0..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/docx/InMemoryDocxFile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Mammoth.Couscous.java.io; -using Mammoth.Couscous.java.util; -using System.IO; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.docx { - internal class InMemoryDocxFile { - internal static DocxFile fromStream(InputStream stream) { - var memoryStream = new MemoryStream(); - stream.Stream.CopyTo(memoryStream); - return new ZippedDocxFile(memoryStream); - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/docx/ZippedDocxFile.cs b/dotnet/Mammoth/Couscous/mammoth/internal/docx/ZippedDocxFile.cs deleted file mode 100644 index cf39e63..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/docx/ZippedDocxFile.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.IO.Compression; -using Mammoth.Couscous.java.io; -using Mammoth.Couscous.java.util; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.docx { - internal class ZippedDocxFile : DocxFile { - private readonly ZipArchive _zipFile; - - internal ZippedDocxFile(File file) { - _zipFile = ZipFile.OpenRead(file.Path); - } - - internal ZippedDocxFile(System.IO.Stream stream) { - _zipFile = new ZipArchive(stream); - } - - public Optional tryGetInputStream(string name) { - var entry = _zipFile.GetEntry(name); - if (entry == null) { - return Optional.empty(); - } else { - return Optional.of(ToJava.StreamToInputStream(entry.Open())); - } - } - - public void close() { - _zipFile.Dispose(); - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs deleted file mode 100644 index 6ca9381..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing { - internal class LineParseException : RuntimeException { - private readonly Token _token; - - internal LineParseException(Token token, string message) : base(message) { - _token = token; - } - - internal Token getToken() { - return _token; - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs deleted file mode 100644 index 73f349c..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Mammoth.Couscous.java.lang; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing { - internal class ParseException : RuntimeException { - internal ParseException(string message) : base(message) { - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/StyleMapParser.cs b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/StyleMapParser.cs deleted file mode 100644 index 53315f3..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/StyleMapParser.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.org.zwobble.mammoth.@internal.styles; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing { - internal static class StyleMapParser { - internal static StyleMap parseStyleMappings(List mappings) { - return DefaultStyleMap(); - } - - internal static StyleMap parse(string styleMap) { - return DefaultStyleMap(); - } - - private static StyleMap DefaultStyleMap() { - return StyleMap.builder() - - .mapParagraph(ParagraphMatcher.styleName("Normal"), HtmlPath.element("p")) - - .build(); - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Base64Encoding.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Base64Encoding.cs deleted file mode 100644 index 24d2f9c..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Base64Encoding.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.io; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal static class Base64Encoding { - internal static string streamToBase64(SupplierWithException streamSupplier) { - using (var stream = streamSupplier.get().Stream) { - return streamToBase64(stream); - } - } - - internal static string streamToBase64(System.IO.Stream stream) { - var memoryStream = new System.IO.MemoryStream(); - stream.CopyTo(memoryStream); - return System.Convert.ToBase64String(memoryStream.ToArray()); - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs deleted file mode 100644 index c342e20..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Casts.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Mammoth.Couscous.java.util; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal static class Casts { - internal static Optional tryCast(System.Type type, object value) { - if (value is T) { - return new Some((T) value); - } else { - return new None(); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Iterables.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Iterables.cs deleted file mode 100644 index b1e1477..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Iterables.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.util.function; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util -{ - internal static class Iterables - { - internal static T getFirst(Iterable iterable, T defaultValue) { - var iterator = iterable.iterator(); - if (iterator.hasNext()) { - return iterator.next(); - } else { - return defaultValue; - } - } - - internal static Optional tryFind(Iterable iterable, Predicate predicate) { - var iterator = iterable.iterator(); - while (iterator.hasNext()) { - T value = iterator.next(); - if (predicate.test(value)) { - return new Some(value); - } - } - return new None(); - } - - internal static Iterable lazyFilter(Iterable iterable, Predicate predicate) { - var enumerable = FromJava.IterableToEnumerable(iterable).Where(predicate.test); - return ToJava.EnumerableToIterable(enumerable); - } - - internal static Iterable lazyFilter(Iterable iterable, System.Type type) { - var enumerable = FromJava.IterableToEnumerable(iterable).OfType(); - return ToJava.EnumerableToIterable(enumerable); - } - - internal static Iterable lazyMap(Iterable iterable, Function function) { - var enumerable = FromJava.IterableToEnumerable(iterable) - .Select(function.apply); - return ToJava.EnumerableToIterable(enumerable); - } - - internal static Iterable lazyFlatMap(Iterable iterable, Function> function) { - var enumerable = FromJava.IterableToEnumerable(iterable) - .SelectMany(element => FromJava.IterableToEnumerable(function.apply(element))); - return ToJava.EnumerableToIterable(enumerable); - } - - internal static Iterable lazyConcat(Iterable first, Iterable second) { - var enumerable = FromJava.IterableToEnumerable(first) - .Concat(FromJava.IterableToEnumerable(second)); - return ToJava.EnumerableToIterable(enumerable); - } - } -} - diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Lists.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Lists.cs deleted file mode 100644 index b914a34..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Lists.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.util.function; -using System.Linq; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal static class Lists { - internal static List list(params T[] values) { - return ToJava.ListToList(values); - } - - internal static List toList(Iterable iterable) { - return ToJava.ListToList(FromJava.IterableToEnumerable(iterable).ToList()); - } - - internal static List eagerMap(Iterable iterable, Function function) { - var result = FromJava.IterableToEnumerable(iterable) - .Select(function.apply) - .ToList(); - return ToJava.ListToList(result); - } - - internal static List eagerFlatMap(Iterable iterable, Function> function) { - var result = FromJava.IterableToEnumerable(iterable) - .SelectMany(element => FromJava.IterableToEnumerable(function.apply(element))) - .ToList(); - return ToJava.ListToList(result); - } - - internal static List cons(T head, Iterable tail) { - var result = new T[] { head } - .Concat(FromJava.IterableToEnumerable(tail)) - .ToList(); - return ToJava.ListToList(result); - } - - internal static List eagerConcat(Iterable first, Iterable second) { - var result = FromJava.IterableToEnumerable(first) - .Concat(FromJava.IterableToEnumerable(second)) - .ToList(); - return ToJava.ListToList(result); - } - - internal static List orderedBy(Iterable iterable, Function getKey) { - var result = FromJava.IterableToEnumerable(iterable) - .OrderBy(getKey.apply) - .ToList(); - return ToJava.ListToList(result); - } - - internal static Optional tryGetLast(List list) { - if (list.isEmpty()) { - return new None(); - } else { - return new Some(list.get(list.size() - 1)); - } - } - - internal static Iterable reversed(List list) { - return new ReversedList(list); - } - - private class ReversedList : Iterable { - private readonly List _list; - - internal ReversedList(List list) { - _list = list; - } - - public Iterator iterator() { - return new ReverseIterator(_list); - } - } - - private class ReverseIterator : Iterator { - private readonly List _list; - private int _nextIndex; - - internal ReverseIterator(List list) { - _list = list; - _nextIndex = _list.size() - 1; - } - - public bool hasNext() { - return _nextIndex >= 0; - } - - public T next() { - if (hasNext()) { - return _list.get(_nextIndex--); - } else { - throw new NoSuchElementException(); - } - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs deleted file mode 100644 index bee2dac..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System.Linq; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util.function; -using Mammoth.Couscous; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util -{ - internal static class Maps - { - internal static Map map() { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary()); - } - - internal static Map map(K key1, V value1) { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary { - {key1, value1} - }); - } - - internal static Map map(K key1, V value1, K key2, V value2) { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary { - {key1, value1}, - {key2, value2} - }); - } - - internal static Map toMap(Iterable iterable, Function> function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .Select(function.apply) - .ToDictionary(entry => entry.getKey(), entry => entry.getValue()); - return ToJava.DictionaryToMap(dictionary); - - } - - internal static Map toMapWithKey(Iterable iterable, Function function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .ToDictionary(function.apply); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map> toMultiMapWithKey(Iterable iterable, Function function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .GroupBy(value => function.apply(value)) - .ToDictionary( - grouping => grouping.Key, - grouping => ToJava.ListToList(grouping.ToList())); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Optional lookup(Map map, K key) { - return map._lookup(key); - } - - internal static Map eagerMapKeys(Map map, Function function) { - var dictionary = FromJava.MapToDictionary(map) - .ToDictionary( - entry => function.apply(entry.Key), - entry => entry.Value); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map eagerMapValues(Map map, Function function) { - var dictionary = FromJava.MapToDictionary(map) - .ToDictionary( - entry => entry.Key, - entry => function.apply(entry.Value)); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map__Entry entry(K key, V value) { - return new Entry(key, value); - } - - private class Entry : Map__Entry { - private readonly K _key; - private readonly V _value; - - internal Entry(K key, V value) { - this._key = key; - this._value = value; - } - - public K getKey() { - return _key; - } - - public V getValue() { - return _value; - } - } - - internal static Builder builder() { - return new Builder(); - } - - internal class Builder { - private readonly System.Collections.Generic.IDictionary _values = new System.Collections.Generic.Dictionary(); - - internal Builder put(K key, V value) { - _values[key] = value; - return this; - } - - internal Map build() { - return ToJava.DictionaryToMap(_values); - } - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs deleted file mode 100644 index 88597e3..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/PassThroughException.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.io; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal class PassThroughException : RuntimeException { - internal static T wrap(SupplierWithException supplier) { - try { - return supplier.get(); - } catch (IOException exception) { - throw new PassThroughException(exception); - } - } - - internal static T unwrap(SupplierWithException supplier) { - try { - return supplier.get(); - } catch (PassThroughException exception) { - throw exception._exception; - } - } - - private readonly IOException _exception; - - internal PassThroughException(IOException exception) { - _exception = exception; - } - } -} - diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Paths.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Paths.cs deleted file mode 100644 index ca876eb..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Paths.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal static class Paths { - internal static string getExtension(string path) { - int dotIndex = path.LastIndexOf('.'); - return dotIndex == -1 ? "" : path.Substring(dotIndex + 1); - } - } -} diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Sets.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Sets.cs deleted file mode 100644 index bfce619..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Sets.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.nio.file; -using System; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util -{ - internal static class Sets { - internal static Set set(T[] values) { - return new HashSet(new System.Collections.Generic.HashSet(values)); - } - - internal static Set toSet(Iterable iterable) { - return new HashSet(new System.Collections.Generic.HashSet(FromJava.IterableToEnumerable(iterable))); - } - } -} - diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Strings.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Strings.cs deleted file mode 100644 index 65f5e0b..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Strings.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { - internal static class Strings { - internal static string trimLeft(string value, int character) { - int index = 0; - while (index < value.Length && value[index] == character) { - index++; - } - return value.Substring(index); - } - - internal static bool isNullOrEmpty(string value) { - return string.IsNullOrEmpty(value); - } - } -} - diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/xml/parsing/SimpleSax.cs b/dotnet/Mammoth/Couscous/mammoth/internal/xml/parsing/SimpleSax.cs deleted file mode 100644 index 65f63c3..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/xml/parsing/SimpleSax.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Mammoth.Couscous.java.io; -using Mammoth.Couscous.java.util; -using System.Xml; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.xml.parsing { - internal static class SimpleSax { - internal static void parseStream(InputStream input, SimpleSaxHandler handler) { - var reader = XmlReader.Create(input.Stream); - while (reader.Read()) { - switch (reader.NodeType) { - case XmlNodeType.Element: - var name = new ElementName(reader.NamespaceURI, reader.LocalName); - var attributes = new HashMap(); - var isEmpty = reader.IsEmptyElement; - for (int attributeIndex = 0; attributeIndex < reader.AttributeCount; attributeIndex++) { - reader.MoveToAttribute(attributeIndex); - attributes.put(new ElementName(reader.NamespaceURI, reader.LocalName), reader.Value); - } - handler.startElement(name, attributes); - if (isEmpty) { - handler.endElement(); - } - break; - case XmlNodeType.CDATA: - case XmlNodeType.Text: - case XmlNodeType.SignificantWhitespace: - handler.characters(reader.Value); - break; - case XmlNodeType.EntityReference: - throw new System.NotImplementedException(); - case XmlNodeType.EndElement: - handler.endElement(); - break; - } - } - } - - internal static void parseString(string value, SimpleSaxHandler handler) { - throw new System.NotImplementedException(); - } - } -} diff --git a/dotnet/Mammoth/DocumentConverter.cs b/dotnet/Mammoth/DocumentConverter.cs deleted file mode 100644 index eb8c939..0000000 --- a/dotnet/Mammoth/DocumentConverter.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.IO; -using Mammoth.Couscous; -using Mammoth.Couscous.org.zwobble.mammoth.@internal; -using Mammoth.Couscous.org.zwobble.mammoth.@internal.conversion; - -namespace Mammoth { - public class DocumentConverter { - private readonly DocumentToHtmlOptions options; - - public DocumentConverter() : this(DocumentToHtmlOptions._DEFAULT) { - } - - private DocumentConverter(DocumentToHtmlOptions options) { - this.options = options; - } - - public DocumentConverter IdPrefix(string idPrefix) { - return new DocumentConverter(options.idPrefix(idPrefix)); - } - - public DocumentConverter PreserveEmptyParagraphs() { - return new DocumentConverter(options.preserveEmptyParagraphs()); - } - - public DocumentConverter AddStyleMap(string styleMap) { - return new DocumentConverter(options.addStyleMap(styleMap)); - } - - public DocumentConverter DisableDefaultStyleMap() { - return new DocumentConverter(options.disableDefaultStyleMap()); - } - - public IResult ConvertToHtml(Stream stream) { - return new InternalDocumentConverter(options) - .convertToHtml(ToJava.StreamToInputStream(stream)) - .ToResult(); - } - - public IResult ConvertToHtml(string path) { - return new InternalDocumentConverter(options) - .convertToHtml(new Couscous.java.io.File(path)) - .ToResult(); - } - - public IResult ExtractRawText(Stream stream) { - return new InternalDocumentConverter(options) - .extractRawText(ToJava.StreamToInputStream(stream)) - .ToResult(); - } - - public IResult ExtractRawText(string path) { - return new InternalDocumentConverter(options) - .extractRawText(new Couscous.java.io.File(path)) - .ToResult(); - } - } -} diff --git a/dotnet/Mammoth/IResult.cs b/dotnet/Mammoth/IResult.cs deleted file mode 100644 index 7088f3a..0000000 --- a/dotnet/Mammoth/IResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Collections.Generic; - -namespace Mammoth { - public interface IResult { - T Value { get; } - ISet Warnings { get; } - } -} diff --git a/dotnet/Mammoth/Mammoth.csproj b/dotnet/Mammoth/Mammoth.csproj deleted file mode 100644 index 6e2c473..0000000 --- a/dotnet/Mammoth/Mammoth.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - Debug - AnyCPU - {51C5CBD6-8809-4D5E-BABE-1787A16F5ED8} - Library - Mammoth - Mammoth - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dotnet/Mammoth/Mammoth.nuspec b/dotnet/Mammoth/Mammoth.nuspec deleted file mode 100644 index 943c9c6..0000000 --- a/dotnet/Mammoth/Mammoth.nuspec +++ /dev/null @@ -1,16 +0,0 @@ - - - - $id$ - $version$ - $title$ - $author$ - $author$ - http://opensource.org/licenses/BSD-2-Clause - https://github.com/mwilliamson/dotnet-mammoth - false - $description$ - Copyright 2015 - 2016 Michael Williamson - docx html office word - - diff --git a/dotnet/Mammoth/Properties/AssemblyInfo.cs b/dotnet/Mammoth/Properties/AssemblyInfo.cs deleted file mode 100644 index a1b9415..0000000 --- a/dotnet/Mammoth/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Mammoth")] -[assembly: AssemblyDescription("Convert Word documents from docx to simple HTML")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Michael Williamson")] -[assembly: AssemblyProduct("Mammoth")] -[assembly: AssemblyCopyright("Copyright © Michael Williamson 2015 - 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("0.0.2.0")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/dotnet/Mammoth/SimpleResult.cs b/dotnet/Mammoth/SimpleResult.cs deleted file mode 100644 index f20cd42..0000000 --- a/dotnet/Mammoth/SimpleResult.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; -using Mammoth.Couscous; -using Mammoth.Couscous.org.zwobble.mammoth.@internal.results; - -namespace Mammoth { - internal static class SimpleResult { - internal static IResult ToResult(this InternalResult result) { - var warnings = new HashSet(FromJava.IterableToEnumerable(result.getWarnings())); - return new SimpleResult(result.getValue(), warnings); - } - } - - internal class SimpleResult : IResult { - public T Value { get; } - public ISet Warnings { get; } - - internal SimpleResult(T value, ISet warnings) { - Value = value; - Warnings = warnings; - } - } -} -- cgit v1.2.3