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.Chain;
008    
009    /**
010     * @author Ciaran O'Reilly
011     * 
012     */
013    public class ProofStepChainContrapositive extends AbstractProofStep {
014            private List<ProofStep> predecessors = new ArrayList<ProofStep>();
015            private Chain contrapositive = null;
016            private Chain contrapositiveOf = null;
017    
018            public ProofStepChainContrapositive(Chain contrapositive,
019                            Chain contrapositiveOf) {
020                    this.contrapositive = contrapositive;
021                    this.contrapositiveOf = contrapositiveOf;
022                    this.predecessors.add(contrapositiveOf.getProofStep());
023            }
024    
025            //
026            // START-ProofStep
027            public List<ProofStep> getPredecessorSteps() {
028                    return Collections.unmodifiableList(predecessors);
029            }
030    
031            public String getProof() {
032                    return contrapositive.toString();
033            }
034    
035            public String getJustification() {
036                    return "Contrapositive: "
037                                    + contrapositiveOf.getProofStep().getStepNumber();
038            }
039            // END-ProofStep
040            //
041    }