Ejemplo n.º 1
0
 @Override
 public boolean equals(Object object) {
   if (object == null) {
     return false;
   }
   if (getClass() != object.getClass()) {
     return false;
   }
   Hypothesis otherHypothesis = (Hypothesis) object;
   for (Literal literal : getLiterals()) {
     if (!literal.equals(otherHypothesis.getLiteral(literal.getAttribute()))) {
       return false;
     }
   }
   return true;
 }
Ejemplo n.º 2
0
 public Hypothesis subsume(Hypothesis otherHypothesis) {
   LinkedList<Literal> newLiterals = new LinkedList<Literal>();
   for (Literal otherLiteral : otherHypothesis.literalMap.values()) {
     Literal correspondingLiteral = literalMap.get(otherLiteral.getAttribute());
     if (correspondingLiteral == null) {
       continue;
     }
     if (otherLiteral.equals(correspondingLiteral)) {
       newLiterals.add(otherLiteral);
       continue;
     }
     if (otherLiteral.contradicts(literalMap.get(otherLiteral.getAttribute()))) {
       return null;
     }
   }
   return new Hypothesis(newLiterals);
 }