avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler CronTimeTrigger.java PeriodicTimeTrigger.java TimeTrigger.java
Date Thu, 12 Sep 2002 10:24:33 GMT
donaldp     2002/09/12 03:24:33

  Modified:    src/java/org/apache/avalon/cornerstone/services/scheduler
                        CronTimeTrigger.java PeriodicTimeTrigger.java
                        TimeTrigger.java
  Log:
  Improved the javadocs.
  
  Submitted by: Greg Steuck <greg-avalon-apps@nest.cx>
  
  Revision  Changes    Path
  1.8       +6 -4      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/CronTimeTrigger.java
  
  Index: CronTimeTrigger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/CronTimeTrigger.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CronTimeTrigger.java	5 Aug 2002 14:12:14 -0000	1.7
  +++ CronTimeTrigger.java	12 Sep 2002 10:24:32 -0000	1.8
  @@ -65,14 +65,16 @@
       }
   
       /**
  -     * Retrieve the next time at which this trigger activates.
  +     * Returns the next time after the given <tt>moment</tt> when
  +     * this trigger goes off.
        *
  -     * @return the time at which the trigger will activate
  +     * @param moment base point in milliseconds
  +     * @return the time in milliseconds when this trigger goes off
        */
  -    public long getTimeAfter( final long time )
  +    public long getTimeAfter( final long moment )
       {
           //first create calendars
  -        final Date timeMarker = new Date( time );
  +        final Date timeMarker = new Date( moment );
           final GregorianCalendar relativeTo = new GregorianCalendar();
           relativeTo.setTime( timeMarker );
           relativeTo.set( Calendar.SECOND, 0 );
  
  
  
  1.6       +21 -7     jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/PeriodicTimeTrigger.java
  
  Index: PeriodicTimeTrigger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/PeriodicTimeTrigger.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PeriodicTimeTrigger.java	5 Aug 2002 14:12:14 -0000	1.5
  +++ PeriodicTimeTrigger.java	12 Sep 2002 10:24:32 -0000	1.6
  @@ -8,7 +8,9 @@
   package org.apache.avalon.cornerstone.services.scheduler;
   
   /**
  - * This is the triggers based on a start time and period.
  + * Goes off every <tt>period</tt> milliseconds after waiting for
  + * <tt>offset</tt> milliseconds from the moment the trigger was
  + * <tt>reset</tt>.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @author <a href="mailto:ram.chidambaram@telus.com">Ram Chidambaram</a>
  @@ -20,6 +22,16 @@
       protected final long m_period;
       private long m_triggerTime;
   
  +    /**
  +     * Creates a periodic trigger. It goes off the first time after
  +     * <tt>offset</tt> milliseconds from the time it was
  +     * <tt>reset</tt> and then every <tt>offset</tt>
  +     * milliseconds. The trigger is <tt>reset</tt> as
  +     * part of its construction.
  +     *
  +     * @param offset initial delay in milliseconds, -1 means fire immediately
  +     * @param period after initial delay in milliseconds, -1 means fire only once after
initial delay
  +     */
       public PeriodicTimeTrigger( final int offset, final int period )
       {
           m_offset = offset;
  @@ -29,22 +41,24 @@
       }
   
       /**
  -     * Retrieve the next time at which this trigger activates.
  +     * Returns the next time after the given <tt>moment</tt> when
  +     * this trigger goes off.
        *
  -     * @return the time at which the trigger will activate
  +     * @param moment base point in milliseconds
  +     * @return the time in milliseconds when this trigger goes off
        */
  -    public long getTimeAfter( final long time )
  +    public long getTimeAfter( final long moment )
       {
  -        if( time <= m_triggerTime )
  +        if( moment <= m_triggerTime )
               return m_triggerTime;
           else
           {
               if( -1 == m_period ) return -1;
   
  -            final long over = time - m_triggerTime;
  +            final long over = moment - m_triggerTime;
               final long remainder = over % m_period;
   
  -            return time + ( m_period - remainder );
  +            return moment + ( m_period - remainder );
           }
       }
   
  
  
  
  1.5       +7 -4      jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/TimeTrigger.java
  
  Index: TimeTrigger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/scheduler/TimeTrigger.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TimeTrigger.java	5 Aug 2002 14:12:14 -0000	1.4
  +++ TimeTrigger.java	12 Sep 2002 10:24:32 -0000	1.5
  @@ -8,7 +8,8 @@
   package org.apache.avalon.cornerstone.services.scheduler;
   
   /**
  - * This is the marker interface for time-based Triggers.
  + * A kind of trigger that makes the determination to go off based
  + * on time.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @author <a href="mailto:ram.chidambaram@telus.com">Ram Chidambaram</a>
  @@ -17,9 +18,11 @@
       extends Trigger
   {
       /**
  -     * Retrieve the next time at trigger activates relative to another time.
  +     * Returns the next time after the given <tt>moment</tt> when
  +     * this trigger goes off.
        *
  -     * @return the time at which the trigger activates
  +     * @param moment base point in milliseconds
  +     * @return the time in milliseconds when this trigger goes off
        */
  -    long getTimeAfter( long time );
  +    long getTimeAfter( long moment );
   }
  
  
  

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


Mime
View raw message