@@ -50,18 +50,41 @@ public What3Words(String apiKey) {
5050 * given language.
5151 *
5252 * @param apiKey
53- * @param language default Language
53+ * @param language
54+ * default Language
5455 */
5556 public What3Words (String apiKey , String language ) {
5657 this .apiKey = apiKey ;
5758 this .language = language ;
5859 }
5960
61+ /**
62+ * Converts 3 words object (in the given language) into a position object.
63+ *
64+ * @param threeWords
65+ * "w3w-address" object in the given language
66+ * @param language
67+ * string defining the language of the words (e.g. "de")
68+ * @return coordinates object holding the coordinates reprsenting the given
69+ * words
70+ * @throws IOException
71+ * @throws What3WordsException
72+ */
6073 public Coordinates wordsToPosition (ThreeWords threeWords , String language ) throws IOException , What3WordsException {
6174 double [] doubleCoordinates = wordsToPosition (new String []{threeWords .getFirst (), threeWords .getSecond (), threeWords .getThird ()});
6275 return new Coordinates (doubleCoordinates [0 ], doubleCoordinates [1 ]);
6376 }
6477
78+ /**
79+ * Converts 3 words object into a position object.
80+ *
81+ * @param threeWords
82+ * "w3w-address" object in the given language
83+ * @return coordinates object holding the coordinates reprsenting the given
84+ * words
85+ * @throws IOException
86+ * @throws What3WordsException
87+ */
6588 public Coordinates wordsToPosition (ThreeWords threeWords ) throws IOException , What3WordsException {
6689 return wordsToPosition (threeWords , this .language );
6790 }
@@ -123,11 +146,30 @@ public double[] wordsToPosition(String[] words, String language) throws IOExcept
123146
124147 }
125148
149+ /**
150+ * Converts a position object into a "w3w-address" object (in the given
151+ * language)
152+ *
153+ * @param position object holding the coordinates to be transformed
154+ * @param language string defining the language of the words (e.g. "de")
155+ * @return "w3w-address" object in the given language
156+ * @throws IOException
157+ * @throws What3WordsException
158+ */
126159 public ThreeWords positionToWords (Coordinates coordinates , String language ) throws IOException , What3WordsException {
127160 String [] words = positionToWords (new double []{coordinates .getLatitude (), coordinates .getLongitude ()}, language );
128161 return new ThreeWords (words [0 ], words [1 ], words [2 ]);
129162 }
130163
164+ /**
165+ * Converts a position object into a "w3w-address" object with default
166+ * language.
167+ *
168+ * @param position object holding the coordinates to be transformed
169+ * @return "w3w-address" object
170+ * @throws IOException
171+ * @throws What3WordsException
172+ */
131173 public ThreeWords positionToWords (Coordinates coordinates ) throws IOException , What3WordsException {
132174 return positionToWords (coordinates , this .language );
133175 }
0 commit comments