From 1a4d6ff35dc54cda4b648d72618213313737aba9 Mon Sep 17 00:00:00 2001 From: Richeeyyy <richard.schmidt@mailbox.tu-dresden.de> Date: Fri, 26 Jul 2019 18:19:46 +0200 Subject: [PATCH] Get rid of jcommander dependency --- build.gradle | 3 +-- .../brailleplot/csvparser/CsvOrientation.java | 10 ++++++---- .../mci/brailleplot/csvparser/CsvType.java | 10 ++++++---- .../inf/mci/brailleplot/csvparser/Point.java | 6 ++---- .../brailleplot/csvparser/PointListList.java | 20 +++++++++++++------ .../inf/mci/brailleplot/csvparser/Range.java | 5 ++--- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 67634137..ceed1ff3 100644 --- a/build.gradle +++ b/build.gradle @@ -40,8 +40,7 @@ dependencies { compile group: 'tec.units', name: 'unit-ri', version: '1.0.3' compile "com.opencsv:opencsv:4.0" - // https://mvnrepository.com/artifact/com.beust/jcommander - compile group: 'com.beust', name: 'jcommander', version: '1.64' + // https://mvnrepository.com/artifact/org.slf4j/slf4j-api compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.24' } diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvOrientation.java b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvOrientation.java index c20bbc54..25b35351 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvOrientation.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvOrientation.java @@ -1,7 +1,5 @@ package de.tudresden.inf.mci.brailleplot.csvparser; -import com.beust.jcommander.IStringConverter; - /** * Enumeration of the two possible CSV orientations. */ @@ -25,13 +23,17 @@ public enum CsvOrientation { /** * Converter class that converts strings to CsvOrientation. */ - public static class CsvOrientationConverter implements IStringConverter<CsvOrientation> { + public static class CsvOrientationConverter { public CsvOrientationConverter() { super(); } - @Override + /** + * Converts a String value into the corresponding CsvOrientation. + * @param value String + * @return CsvOrientation + */ public CsvOrientation convert(final String value) { CsvOrientation convertedValue = CsvOrientation.fromString(value); return convertedValue; diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvType.java b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvType.java index 878d1c9e..06aac91c 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvType.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/CsvType.java @@ -1,7 +1,5 @@ package de.tudresden.inf.mci.brailleplot.csvparser; -import com.beust.jcommander.IStringConverter; - /** * Determines what data is represented how by the CSV file. The values are * structural properties, whereas the {@link XType} held by every value @@ -39,13 +37,17 @@ public enum CsvType { /** * Converter class that converts strings to CsvType. */ - public static class CsvTypeConverter implements IStringConverter<CsvType> { + public static class CsvTypeConverter { public CsvTypeConverter() { super(); } - @Override + /** + * Converts a String value into the corresponding CsvType. + * @param value String + * @return CsvType + */ public CsvType convert(final String value) { CsvType convertedValue = CsvType.fromString(value); return convertedValue; diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Point.java b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Point.java index aaa24e1e..14da0b21 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Point.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Point.java @@ -2,8 +2,6 @@ package de.tudresden.inf.mci.brailleplot.csvparser; import org.w3c.dom.Element; -import com.beust.jcommander.IStringConverter; - /** * A point in a coordinate system specified by an mX and mY coordinate. Can also @@ -159,15 +157,15 @@ public class Point implements Comparable<Point> { * Converts a string value to the corresponding point object. * */ - public static class Converter implements IStringConverter<Point> { + public static class Converter { /** * Convert a formatted string to a point. The format is: * {@code [<mX>][,<mY>]} Omitted values will default to 0. * * @param value * | formatted string + * @return converted Range */ - @Override public Point convert(final String value) { String[] s = value.split(","); double x; diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/PointListList.java b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/PointListList.java index 32173f08..4001b125 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/PointListList.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/PointListList.java @@ -4,8 +4,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import com.beust.jcommander.IStringConverter; - /** * * @author Gregor Harlan, Jens Bornschein Idea and supervising by Jens @@ -125,8 +123,13 @@ public class PointListList extends ArrayList<PointListList.PointList> { /** * Converts a string value to a corresponding PointListList. */ - public static class Converter implements IStringConverter<PointListList> { - @Override + public static class Converter { + + /** + * Converts a String value into the corresponding PointListList. + * @param value String + * @return PointListList + */ public PointListList convert(final String value) { return new PointListList(value); } @@ -323,8 +326,13 @@ public class PointListList extends ArrayList<PointListList.PointList> { /** * Converts a string value to the corresponding PointList. */ - public class Converter implements IStringConverter<PointList> { - @Override + public class Converter { + + /** + * Converts a String value into the corresponding PointList. + * @param value String + * @return PointList + */ public PointList convert(final String value) { return new PointList(value.trim()); } diff --git a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Range.java b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Range.java index e64f6c4b..dd062bec 100644 --- a/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Range.java +++ b/src/main/java/de/tudresden/inf/mci/brailleplot/csvparser/Range.java @@ -1,6 +1,5 @@ package de.tudresden.inf.mci.brailleplot.csvparser; -import com.beust.jcommander.IStringConverter; /** * * @author Gregor Harlan, Jens Bornschein @@ -56,7 +55,7 @@ public class Range { /** * Converter class for parsing ranges mFrom strings. */ - public static class Converter implements IStringConverter<Range> { + public static class Converter { /** * Converts a range specified by a string mTo a {@link Range} instance. * The syntax is: {@code [["]<mName>["]::]<mFrom>:<mTo>[:<mName>]}. @@ -64,8 +63,8 @@ public class Range { * The mFrom and mTo parameters should be parsable as Double. * * @param value | correctly formatted range string + * @return converted Range */ - @Override public Range convert(final String value) { String[] parts = value.split("::"); String[] s; -- GitLab