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