All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.environment.vacuum.VacuumWorldActions Maven / Gradle / Ivy

package aima.core.environment.vacuum;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import aima.core.agent.Action;
import aima.core.search.framework.problem.ActionsFunction;

/**
 * Specifies the actions available to the agent at state s
 * 
 * @author Andrew Brown
 */
public class VacuumWorldActions implements ActionsFunction {

	private static final Set _actions;
	static {
		Set actions = new HashSet();
		actions.add(VacuumEnvironment.ACTION_SUCK);
		actions.add(VacuumEnvironment.ACTION_MOVE_LEFT);
		actions.add(VacuumEnvironment.ACTION_MOVE_RIGHT);
		// Ensure cannot be modified.
		_actions = Collections.unmodifiableSet(actions);
	}

	/**
	 * Returns possible actions given this state
	 * 
	 * @param s
	 * @return possible actions given this state.
	 */
	@Override
	public Set actions(Object s) {
		return _actions;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy