001    package aima.search.online;
002    
003    import aima.basic.Percept;
004    
005    public class ActionState {
006            private final Object action;
007            private final Percept state;
008    
009            public ActionState(Object action, Percept state) {
010                    this.action = action;
011                    this.state = state;
012            }
013    
014            public Object getAction() {
015                    return action;
016            }
017    
018            public Percept getState() {
019                    return state;
020            }
021    
022            @Override
023            public boolean equals(Object o) {
024                    if (o == null || !(o instanceof ActionState)) {
025                            return super.equals(o);
026                    }
027                    return (action.equals(((ActionState) o).action) && state
028                                    .equals(((ActionState) o).state));
029            }
030    
031            @Override
032            public int hashCode() {
033                    return action.hashCode() + state.hashCode();
034            }
035    
036            @Override
037            public String toString() {
038                    return "(" + action + ", " + state + ")";
039            }
040    }