/*
Dexter Travis
Bradley University
2001/2002 Senior Project Botdock
http://pioneer1.bradley.edu
http://cegt201.bradley.edu/projects/proj2002/botdock/
*/

//***************************************************/
//this class will implement all of the finding and 
//localization for the web controlled robot.
//Dexter Travis
//initial creation: Feb 7 2002
//Autonomous Recharging system for Web robotics
//***************************************************/

import java.io.*;
import java.net.*;
import java.lang.*;
import java.util.*;

class find
{	
	public static int count = 0;
	//create a new stack object.
	private static Stack findstack = new Stack();
	
	public static void start()
	{
		push("end");
	}
	
	//all pushes will come through find.push rather then direct
	//this way all find related activity is done in this class
	public static void push(String movement)
	{
		StringTokenizer mov = new StringTokenizer(movement, " ", false);
		String inversemove = new String(mov.nextToken());
		String secondtoken = new String(mov.nextToken());
		Float Fparameter = new Float(secondtoken);
		float fparameter = Fparameter.floatValue();
		fparameter = fparameter * (-1);
		inversemove.concat(" " +fparameter);
		findstack.push(inversemove);
	}
	private static String pop()
	{
		String popvalue = new String((findstack.pop()).toString());
		return(popvalue);
	}
	
	public static boolean find()
	{
		//reverse the stack operations.
		String stackelement = new String(pop());
		while(findstack.empty() == false)
		{
			if(stackelement.equals("end"))
			{
				return(true);
			}
			else
			{
				embeddedinterface.move(stackelement);
				stackelement = pop();
			}
		}
		return(false);
	}
	
	
	
}