001 package aima.probability.decision; 002 003 import aima.util.Triplet; 004 005 /** 006 * @author Ravi Mohan 007 * 008 */ 009 010 public class MDPTransition<STATE_TYPE, ACTION_TYPE> { 011 private Triplet<STATE_TYPE, ACTION_TYPE, STATE_TYPE> triplet; 012 013 public MDPTransition(STATE_TYPE initial, ACTION_TYPE action, 014 STATE_TYPE destination) { 015 this.triplet = new Triplet<STATE_TYPE, ACTION_TYPE, STATE_TYPE>( 016 initial, action, destination); 017 } 018 019 public STATE_TYPE getInitialState() { 020 return triplet.getFirst(); 021 } 022 023 public ACTION_TYPE getAction() { 024 return triplet.getSecond(); 025 } 026 027 public STATE_TYPE getDestinationState() { 028 return triplet.getThird(); 029 } 030 031 @Override 032 public boolean equals(Object o) { 033 if (o == this) { 034 return true; 035 } 036 if (!(o instanceof MDPTransition)) { 037 return false; 038 } 039 MDPTransition<STATE_TYPE, ACTION_TYPE> other = (MDPTransition<STATE_TYPE, ACTION_TYPE>) (o);// weird 040 // typing 041 // issue 042 // work 043 // out 044 // later 045 return triplet.equals(other.triplet); 046 } 047 048 @Override 049 public int hashCode() { 050 return triplet.hashCode(); 051 } 052 053 @Override 054 public String toString() { 055 return triplet.toString(); 056 } 057 058 }