001 package aima.basic.vaccum; 002 003 import java.util.Hashtable; 004 005 /** 006 * @author Ravi Mohan 007 * 008 */ 009 public class VaccumEnvironmentModel { 010 private Hashtable<String, String> model; 011 012 public VaccumEnvironmentModel() { 013 model = new Hashtable<String, String>(); 014 } 015 016 public void setLocationStatus(String location, String locationStatus) { 017 model.put(location, locationStatus); 018 } 019 020 public String getStatusOf(String location) { 021 return model.get(location); 022 } 023 024 public boolean bothLocationsClean() { 025 String loc1Status = getStatusOf("A"); 026 String loc2Status = getStatusOf("B"); 027 return ((loc1Status != null) && (loc1Status.equals("Clean"))) 028 && ((loc2Status != null) && (loc2Status.equals("Clean"))); 029 } 030 031 }