This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new efb9bf0 WIP Javadoc.
efb9bf0 is described below
commit efb9bf09ec0e485f5d186915318af00449fcc5fb
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Mar 23 13:30:36 2022 -0700
WIP Javadoc.
---
.../scala/org/apache/nlpcraft/NCPropertyMap.java | 59 ++++++++++++++--------
.../org/apache/nlpcraft/NCPropertyMapAdapter.java | 3 +-
.../main/scala/org/apache/nlpcraft/NCToken.java | 4 ++
3 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.java
index bc2fba5..18630d5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.java
@@ -21,71 +21,88 @@ import java.util.Optional;
import java.util.Set;
/**
+ * Map-like container that provides support for mutable runtime-only propertes
or metadata.
*
+ * @see NCPropertyMapAdapter
*/
public interface NCPropertyMap {
/**
+ * Returns the value to which the specified key is mapped, or {@code null}
if this map contains no mapping for the key.
*
- * @param key
- * @param <T>
- * @return
+ * @param key The key whose associated value is to be returned.
+ * @param <T> Type of the returned value.
+ * @return The value to which the specified key is mapped, or {@code null}
if this map contains no mapping for the key.
*/
<T> T get(String key);
/**
+ * Returns the value to which the specified key is mapped as an optional.
This method is equivalent to:
+ * <pre class="brush: java">
+ * return Optional.ofNullable((T)map.get(key));
+ * </pre>
*
- * @param key
- * @param <T>
- * @return
+ * @param key The key whose associated value is to be returned.
+ * @param <T> Type of the returned value.
+ * @return The value to which the specified key is mapped as an optional.
*/
<T> Optional<T> getOpt(String key);
/**
+ * Associates the specified value with the specified key in this map. If
the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
*
- * @param key
- * @param obj
+ * @param key Key with which the specified value is to be associated.
+ * @param obj Value to be associated with the specified key.
+ * @param <T> Type of the value.
+ * @return The previous value associated with key, or {@code null} if
there was no mapping for key.
*/
<T> T put(String key, Object obj);
/**
+ * If the specified key is not already associated with a value (or is
mapped to {@code null}) associates it with
+ * the given value and returns {@code null}, else returns the current
value.
*
- * @param key
- * @param obj
- * @param <T>
- * @return
+ * @param key Key with which the specified value is to be associate
+ * @param obj Value to be associated with the specified key
+ * @param <T> Type of the value.
+ * @return The previous value associated with the specified key, or {@code
null} if there was no mapping for the key.
*/
<T> T putIfAbsent(String key, T obj);
/**
+ * Returns {@code true} if this map contains a mapping for the specified
key.
*
- * @param key
- * @return
+ * @return {@code true} if this map contains a mapping for the specified
key.
*/
boolean contains(String key);
/**
+ * Removes the mapping for a key from this map if it is present.
*
- * @param key
- * @return
+ * @param key Key whose mapping is to be removed from the map.
+ * @param <T> Type of the value.
+ * @return The previous value associated with key, or {@code null} if
there was no mapping for key.
*/
<T> T remove(String key);
/**
+ * Removes the entry for the specified key only if it is currently mapped
to the specified value.
*
- * @param key
- * @param obj
- * @return
+ * @param key Key with which the specified value is associated value.
+ * @param obj Value expected to be associated with the specified key.
+ * @return {@code true} if the value was removed
*/
boolean remove(String key, Object obj);
/**
+ * Returns a set view of the keys contained in this map.
*
- * @return
+ * @return A set view of the keys contained in this map
*/
Set<String> keysSet();
/**
- *
+ * Removes all of the mappings from this map. The map will be empty after
this call returns.
*/
void clear();
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMapAdapter.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMapAdapter.java
index 86bb3d0..a9f6f6c 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMapAdapter.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMapAdapter.java
@@ -23,8 +23,9 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
- *
+ * Convenient adapter for {@link NCPropertyMap} interface.
*/
+@SuppressWarnings("unchecked")
public class NCPropertyMapAdapter implements NCPropertyMap {
private final Map<String, Object> map = new ConcurrentHashMap<>();
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.java
index 9cb6e68..e812d93 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.java
@@ -19,6 +19,10 @@ package org.apache.nlpcraft;
/**
*
+ * @see NCEntity
+ * @see NCTokenParser
+ * @see NCTokenEnricher
+ * @see NCTokenValidator
*/
public interface NCToken extends NCPropertyMap {
/**