turbine-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/schedule JobEntry.java
Date Sat, 10 Nov 2001 19:52:19 GMT
This is not the same implementation as is in Fulcrum, but JobEntry
does need to implement Comparable.

dlr@apache.org writes:

> dlr         01/11/09 17:05:10
>
>   Modified:    src/java/org/apache/turbine/services/schedule JobEntry.java
>   Log:
>   Patch by Scott Eade <seade@backstagetech.com.au> to implement
>   Comparable.
>   
>   Revision  Changes    Path
>   1.3       +28 -1     jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntry.java
>   
>   Index: JobEntry.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntry.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -u -r1.2 -r1.3
>   --- JobEntry.java	2001/11/02 17:29:39	1.2
>   +++ JobEntry.java	2001/11/10 01:05:10	1.3
>   @@ -66,9 +66,10 @@
>     * Unix scheduler cron.
>     *
>     * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
>   - * @version $Id: JobEntry.java,v 1.2 2001/11/02 17:29:39 dobbs Exp $
>   + * @version $Id: JobEntry.java,v 1.3 2001/11/10 01:05:10 dlr Exp $
>     */
>    public class JobEntry extends BaseObject
>   +    implements Comparable
>    {
>        /** Valid entry ( 0-60 ). **/
>        private int second = -1;
>   @@ -546,6 +547,32 @@
>                    throw new Exception("Error in JobEntry. Bad Job parameter.");
>    
>                return DAY_OF_MONTH;
>   +        }
>   +    }
>   +
>   +    /**
>   +     * Used for ordering Jobentries
>   +     * Note: this comparator imposes orderings that are inconsistent with
>   +     * equals.
>   +     *
>   +     * @param je The first <code>JobEntry</code> object.
>   +     * @return An <code>int</code> indicating the result of the comparison.
>   +     */
>   +    public int compareTo(Object je)
>   +    {
>   +        long obj1Time = this.getNextRuntime();
>   +        long obj2Time = ((JobEntry)je).getNextRuntime();
>   +        if (obj1Time > obj2Time)
>   +        {
>   +            return 1;
>   +        }
>   +        else if (obj1Time < obj2Time)
>   +        {
>   +            return -1;
>   +        }
>   +        else
>   +        {
>   +            return 0;
>            }
>        }
>    
>   
>   
>   
>
> --
> To unsubscribe, e-mail:   <mailto:turbine-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:turbine-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-dev-help@jakarta.apache.org>


Mime
View raw message