001    
002    package lrs.visitor;
003    
004    import lrs.visitor.*;
005    import lrs.*;
006    import logic.*;
007    
008    public class GetMax extends AGetExtrema {
009    
010     public static GetMax Singleton = new GetMax();
011    
012     private GetMax()
013     {
014     }
015     /**
016      * @param host 
017      * @param param 
018      */
019     public Object emptyCase(LRStruct host, Object... param)
020     {
021            return(Integer.MIN_VALUE);   // The empty list has a valid return object that will always fail a compare.
022     }
023    
024    
025     /**
026      * @param host 
027      * @param param 
028      */
029     public Object nonEmptyCase(LRStruct host, Object... param)
030     {
031            Integer tmp = (Integer) host.getRest().execute(this, param);  // Get the min of the rest of the list
032    
033            //return the data that passes the compare test.
034    //        if(tmp.intValue() > ((Integer)host.getFirst()).intValue())  return (tmp);
035    //        else return (host.getFirst());
036            
037            return BooleanFactory.Singleton.makeBoolean(tmp > (Integer) host.getFirst()).execute(BooleanChoice.Singleton, tmp, host.getFirst());
038              
039     }
040    }
041