// Era privado, pero al sacar esta clase fuera ahora es público public static ISet <Literal> getLiterals(Sentence disjunctiveSentence) { ISet <Literal> result = new HashSet <Literal>(); LiteralCollector literalCollector = new LiteralCollector(); result = disjunctiveSentence.Accept(literalCollector, result); return(result); }
public override ISet <Clause> VisitBinarySentence(ComplexSentence s, ISet <Clause> arg) { if (s.IsAndSentence()) { s.GetSimplerSentence(0).Accept(this, arg); s.GetSimplerSentence(1).Accept(this, arg); } else if (s.IsOrSentence()) { IList <Literal> literals = new List <Literal>(LiteralCollector.getLiterals(s)); //ArrayList arg.Add(new Clause(literals)); } else { throw new ArgumentException("Sentence is not in CNF: " + s); //IllegalArgumentException } return(arg); }