rzo1 commented on code in PR #458:
URL: https://github.com/apache/opennlp/pull/458#discussion_r1049720087


##########
opennlp-tools/src/main/java/opennlp/tools/parser/ParserModel.java:
##########
@@ -367,4 +367,27 @@ else if (ParserType.TREEINSERT.equals(modelType)) {
       throw new InvalidFormatException("Missing the head rules!");
     }
   }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(artifactMap.get("manifest.properties"),
+            artifactMap.get(PARSER_TAGGER_MODEL_ENTRY_NAME));
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj == this) {
+      return true;
+    }
+
+    if (obj instanceof ParserModel) {
+      ParserModel model = (ParserModel) obj;
+      Map<String, Object> artifactMapToCheck = model.artifactMap;
+      AbstractModel abstractModel = (AbstractModel) 
artifactMapToCheck.get(BUILD_MODEL_ENTRY_NAME);
+
+      return 
artifactMap.get("manifest.properties").equals(artifactMapToCheck.get("manifest.properties"))
 &&

Review Comment:
   Note for reviewers: 
   
   It looks like `artifactMap.get("manifest.properties")` is always populated 
as it is validated in the super class(es), so it is guaranteed to be always 
present in the map; so it is guaranteed to be never `null` 
(`BaseModel#validateArtifactMap()`).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to