You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2016/06/13 13:00:39 UTC
svn commit: r1748213 - in
/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource:
MultiTreeWordList.java MultiTreeWordListPersistence.java TreeWordList.java
Author: pkluegl
Date: Mon Jun 13 13:00:38 2016
New Revision: 1748213
URL: http://svn.apache.org/viewvc?rev=1748213&view=rev
Log:
UIMA-4781
- fixed javadoc warnings
Modified:
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordListPersistence.java
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
Modified: uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java?rev=1748213&r1=1748212&r2=1748213&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java (original)
+++ uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordList.java Mon Jun 13 13:00:38 2016
@@ -36,6 +36,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.apache.commons.io.IOUtils;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Feature;
import org.apache.uima.cas.Type;
@@ -65,6 +66,7 @@ public class MultiTreeWordList implement
/**
* Default constructor.
+ * @throws IOException - should not happen but required by called constructor
*/
public MultiTreeWordList() throws IOException {
this(new String[] {}, null);
@@ -75,6 +77,10 @@ public class MultiTreeWordList implement
*
* @param pathname
* the pathname of the used file.
+ * @param base
+ * the relative base
+ * @throws IOException
+ * When there is a problem reading pathname.
*/
public MultiTreeWordList(String pathname, File base) throws IOException {
this(new FileSystemResource(pathname));
@@ -119,6 +125,8 @@ public class MultiTreeWordList implement
* the stream to read the file from.
* @param name
* associated name
+ * @throws IOException
+ * When there is a problem reading the input stream.
*/
public MultiTreeWordList(InputStream stream, String name) throws IOException {
this.root = new MultiTextNode();
@@ -135,6 +143,9 @@ public class MultiTreeWordList implement
*
* @param pathnames
* path of the file to create a TextWordList from
+ * @param base - the relative base
+ * @throws IOException
+ * When there is a problem reading a path.
*/
public MultiTreeWordList(String[] pathnames, File base) throws IOException {
this.root = new MultiTextNode();
@@ -145,6 +156,11 @@ public class MultiTreeWordList implement
}
}
+ /**
+ * @param files - the input files
+ * @param base - the relative base
+ * @throws IOException - When there is a problem reading the files.
+ */
public MultiTreeWordList(List<File> files, File base) throws IOException {
this.root = new MultiTextNode();
this.costMap = new EditDistanceCostMap();
@@ -202,9 +218,7 @@ public class MultiTreeWordList implement
throw new IllegalArgumentException("File name should end with .mtwl or .txt, found " + name);
}
} finally {
- if (stream != null) {
- stream.close();
- }
+ IOUtils.closeQuietly(stream);
}
}
@@ -965,6 +979,7 @@ public class MultiTreeWordList implement
* @param query - The query string.
* @param distance - The specified edit distance.
* @param ignoreCase - Indicates whether we search case sensitive or not.
+ * @param ignoreToken - the characters to ignore
* @param fragment - Indicates whether we search for fragments of the query string or not.
* @return A map with all strings with a specified edit distance to the string query as keys and
* the files they belong to as values.
Modified: uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordListPersistence.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordListPersistence.java?rev=1748213&r1=1748212&r2=1748213&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordListPersistence.java (original)
+++ uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/MultiTreeWordListPersistence.java Mon Jun 13 13:00:38 2016
@@ -49,7 +49,7 @@ public class MultiTreeWordListPersistenc
* - the root node of the tree
* @param path
* - path of the word list
- * @throws IOException
+ * @throws IOException - when there is a problem reading the stream
*/
public void readMTWL(MultiTextNode root, String path) throws IOException {
readMTWL(root, new FileInputStream(path), "UTF-8");
@@ -61,6 +61,7 @@ public class MultiTreeWordListPersistenc
* @param is
* the inputStream to sniff. Must support {@link InputStream#markSupported()}
* @return true if this stream starts with '{@literal <?xml}'
+ * @throws IOException - when there is a problem reading the stream
*/
public static boolean isSniffedXmlContentType(InputStream is) throws IOException {
if (is == null)
Modified: uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java?rev=1748213&r1=1748212&r2=1748213&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java (original)
+++ uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/resource/TreeWordList.java Mon Jun 13 13:00:38 2016
@@ -71,8 +71,9 @@ public class TreeWordList implements Rut
* Constructs a TreeWordList from a resource.
*
* @param resource - Resource to create a TextWordList from
- * @throws IOException
- * @throws IllegalArgumentException
+ * @param dictRemoveWS - option to remove whitespaces fromt he resource
+ * @throws IOException - when there is a problem reading the resource
+ * @throws IllegalArgumentException - for an invalid name or file ending
*/
public TreeWordList(Resource resource, boolean dictRemoveWS) throws IOException {
this.dictRemoveWS = dictRemoveWS;
@@ -103,6 +104,7 @@ public class TreeWordList implements Rut
*
* @param pathname - path of the file to create a TextWordList from
* @param dictRemoveWS - remove whitespaces
+ * @throws IOException - when there is a problem reading the pathname
*/
public TreeWordList(String pathname, boolean dictRemoveWS) throws IOException {
this(new FileSystemResource(pathname), dictRemoveWS);
@@ -113,7 +115,9 @@ public class TreeWordList implements Rut
*
* @param stream
* path of the file to create a TextWordList from
+ * @param name - the name of the resource in the stream
* @param dictRemoveWS - remove whitespaces
+ * @throws IOException - when there is a problem reading the stream
*/
public TreeWordList(InputStream stream, String name, boolean dictRemoveWS) throws IOException {
this.dictRemoveWS = dictRemoveWS;
@@ -145,6 +149,7 @@ public class TreeWordList implements Rut
* @param stream
* Open InputStream containing the word for the treeWordList, this method will close the
* stream.
+ * @throws IOException - when there is a problem reading the stream
*/
public void buildNewTree(InputStream stream) throws IOException {
Scanner scan = new Scanner(stream, "UTF-8");
@@ -194,9 +199,6 @@ public class TreeWordList implements Rut
pointer.setWordEnd(s.length() > 0);
}
- /**
- * Checks if TreeWordList contains String s
- */
public boolean contains(String s, boolean ignoreCase, int size, char[] ignoreChars,
int maxIgnoreChars, boolean ignoreWS) {
if (s == null) {