001    package aima.logic.fol.inference.proof;
002    
003    import java.util.ArrayList;
004    import java.util.Collections;
005    import java.util.List;
006    
007    import aima.logic.fol.kb.data.Clause;
008    import aima.logic.fol.parsing.ast.TermEquality;
009    
010    /**
011     * @author Ciaran O'Reilly
012     * 
013     */
014    public class ProofStepClauseDemodulation extends AbstractProofStep {
015            private List<ProofStep> predecessors = new ArrayList<ProofStep>();
016            private Clause demodulated = null;
017            private Clause origClause = null;
018            private TermEquality assertion = null;
019    
020            public ProofStepClauseDemodulation(Clause demodulated, Clause origClause,
021                            TermEquality assertion) {
022                    this.demodulated = demodulated;
023                    this.origClause = origClause;
024                    this.assertion = assertion;
025                    this.predecessors.add(origClause.getProofStep());
026            }
027    
028            //
029            // START-ProofStep
030            public List<ProofStep> getPredecessorSteps() {
031                    return Collections.unmodifiableList(predecessors);
032            }
033    
034            public String getProof() {
035                    return demodulated.toString();
036            }
037    
038            public String getJustification() {
039                    return "Demodulation: " + origClause.getProofStep().getStepNumber()
040                                    + ", [" + assertion + "]";
041            }
042            // END-ProofStep
043            //
044    }