
package LRSVisitor;

import LRSVisitor.*;
import LRStructure.*;
public class GetMax
	extends AGetExtrema
{
	/** @SBGen Singleton Variable   */
	private static GetMax singleton = null;

	/** @SBGen Singleton   */
	public static GetMax Singleton()
	{
		// SBgen: Ensure single instance
		if (singleton == null) 
			singleton = new GetMax();
		return(singleton);
		// SBgen: End singleton
	}
	/** @SBGen Constructor   */
	private GetMax()
	{
	}
	/**
	 * @param host 
	 * @param param 
	 */
	public Object nullCase(LRStruct host, Object param)
	{
        return(new Integer(Integer.MIN_VALUE));   // The empty list has a valid return object that will always fail a compare.
	}

	/**
	 * @param host 
	 * @param param 
	 */
	public Object nonNullCase(LRStruct host, Object param)
	{
        Integer tmp = (Integer) host.getRest().execute(this, param);  // Get the min of the rest of the list

        //return the data that passes the compare test.
        if(tmp.intValue() > ((Integer)host.getFirst()).intValue())  return (tmp);
        else return (host.getFirst());
	}
}

