Repository: opennlp
Updated Branches:
  refs/heads/master f1f241370 -> 0733d7c2b


OPENNLP-1027: Add tests for Event. This closes apache/opennlp#165


Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/0733d7c2
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/0733d7c2
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/0733d7c2

Branch: refs/heads/master
Commit: 0733d7c2ba214415a8d2e4efba5c6e26b61d3291
Parents: f1f2413
Author: koji <[email protected]>
Authored: Wed Apr 19 07:00:49 2017 +0900
Committer: koji <[email protected]>
Committed: Wed Apr 19 07:00:49 2017 +0900

----------------------------------------------------------------------
 .../src/main/java/opennlp/tools/ml/model/Event.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/opennlp/blob/0733d7c2/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java 
b/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java
index b6a41f3..fbf58a2 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java
@@ -18,22 +18,24 @@
 package opennlp.tools.ml.model;
 
 
+import java.util.Objects;
+
 /**
  * The context of a decision point during training.  This includes
  * contextual predicates and an outcome.
  */
 public class Event {
-  private String outcome;
-  private String[] context;
-  private float[] values;
+  private final String outcome;
+  private final String[] context;
+  private final float[] values;
 
   public Event(String outcome, String[] context) {
     this(outcome,context,null);
   }
 
   public Event(String outcome, String[] context, float[] values) {
-    this.outcome = outcome;
-    this.context = context;
+    this.outcome = Objects.requireNonNull(outcome, "outcome must not be null");
+    this.context = Objects.requireNonNull(context, "context must not be null");
     this.values = values;
   }
 

Reply via email to