// Path: src/main/java/com/github/vangj/jbayes/inf/exact/graph/util/PotentialUtil.java
// public static String asString(Map<String, String> entries) {
//   return entries.entrySet().stream()
//       .map(entry -> (new StringBuilder())
//           .append(entry.getKey())
//           .append('=')
//           .append(entry.getValue())
//           .toString())
//       .collect(Collectors.joining(",", "[", "]"));
// }
// 
// Path: src/main/java/com/github/vangj/jbayes/inf/exact/graph/util/PotentialUtil.java
// public static Map<String, String> sortByKeys(Map<String, String> map) {
//   Map<String, String> out = new TreeMap<>(map);
//   return out;
// }


import static com.github.vangj.jbayes.inf.exact.graph.util.PotentialUtil.asString;
import static com.github.vangj.jbayes.inf.exact.graph.util.PotentialUtil.sortByKeys;
import java.util.LinkedHashMap;
import java.util.Map;
  public PotentialEntry setValue(Double value) {
    this.value = value;
    return this;
  }

  /**
   * Checks if the specified potential entry matches. This potential entry must contain, at the very
   * least, all the same key-value pairs as the specified potential entry passed in.
   *
   * @param that Potential entry.
   * @return Boolean.
   */
  public boolean match(PotentialEntry that) {
    for (Map.Entry<String, String> entry : that.entries.entrySet()) {
      String k = entry.getKey();
      String v = entry.getValue();

      if (!this.entries.containsKey(k)) {
        return false;
      } else {
        if (!this.entries.get(k).equalsIgnoreCase(v)) {
          return false;
        }
      }
    }
    return true;
  }

  @Override
  public int hashCode() {
// Path: src/main/java/com/github/vangj/jbayes/inf/exact/graph/util/PotentialUtil.java
// public static String asString(Map<String, String> entries) {
//   return entries.entrySet().stream()
//       .map(entry -> (new StringBuilder())
//           .append(entry.getKey())
//           .append('=')
//           .append(entry.getValue())
//           .toString())
//       .collect(Collectors.joining(",", "[", "]"));
// }
// 
// Path: src/main/java/com/github/vangj/jbayes/inf/exact/graph/util/PotentialUtil.java
// public static Map<String, String> sortByKeys(Map<String, String> map) {
//   Map<String, String> out = new TreeMap<>(map);
//   return out;
// }


// Path: src/main/java/com/github/vangj/jbayes/inf/exact/graph/lpd/PotentialEntry.java
import static com.github.vangj.jbayes.inf.exact.graph.util.PotentialUtil.asString;
import static com.github.vangj.jbayes.inf.exact.graph.util.PotentialUtil.sortByKeys;
import java.util.LinkedHashMap;
import java.util.Map;

  public PotentialEntry setValue(Double value) {
    this.value = value;
    return this;
  }

  /**
   * Checks if the specified potential entry matches. This potential entry must contain, at the very
   * least, all the same key-value pairs as the specified potential entry passed in.
   *
   * @param that Potential entry.
   * @return Boolean.
   */
  public boolean match(PotentialEntry that) {
    for (Map.Entry<String, String> entry : that.entries.entrySet()) {
      String k = entry.getKey();
      String v = entry.getValue();

      if (!this.entries.containsKey(k)) {
        return false;
      } else {
        if (!this.entries.get(k).equalsIgnoreCase(v)) {
          return false;
        }
      }
    }
    return true;
  }

  @Override
  public int hashCode() {
    return asString(sortByKeys(entries)).hashCode();