Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hypergraph-prototype/attempt1/org/statmt/hg4/VertexState.java')
-rw-r--r--hypergraph-prototype/attempt1/org/statmt/hg4/VertexState.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/hypergraph-prototype/attempt1/org/statmt/hg4/VertexState.java b/hypergraph-prototype/attempt1/org/statmt/hg4/VertexState.java
new file mode 100644
index 000000000..ff75c00bf
--- /dev/null
+++ b/hypergraph-prototype/attempt1/org/statmt/hg4/VertexState.java
@@ -0,0 +1,35 @@
+package org.statmt.hg4;
+
+import java.util.HashMap;
+
+public class VertexState extends HashMap<String, Comparable> {
+
+ private static final long serialVersionUID = 421421L;
+ @Override
+ public int hashCode() {
+ int hc = 0;
+ for (String x : this.keySet()) {
+ hc *= 37;
+ hc += x.hashCode();
+ }
+ for (Object o : this.values()) {
+ hc *= 37;
+ hc += o.hashCode();
+ }
+ return hc;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ VertexSignature v = (VertexSignature)o;
+ int cs = v.size();
+ for (String x : this.keySet()) {
+ Object ot = this.get(x);
+ if (!ot.equals(v.get(x)))
+ return false;
+ cs--;
+ }
+ return cs == 0;
+ }
+
+}