bloritsch    2002/08/07 16:30:48

  Modified:    event/src/java/org/apache/excalibur/event AbstractQueue.java
                        DefaultQueue.java EventHandler.java
                        FixedSizeQueue.java
  Log:
  Update the JavaDocs so they are a little better.
  
  Revision  Changes    Path
  1.10      +10 -4     
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/AbstractQueue.java
  
  Index: AbstractQueue.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/AbstractQueue.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractQueue.java        7 Aug 2002 23:08:25 -0000       1.9
  +++ AbstractQueue.java        7 Aug 2002 23:30:48 -0000       1.10
  @@ -50,7 +50,7 @@
   package org.apache.excalibur.event;
   
   /**
  - * The default queue implementation is a variable size queue.
  + * Provides the base functionality for the other <code>Queue</code> types.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a>
  @@ -78,8 +78,9 @@
       }
   
       /**
  -     * Default for isFull(). The method uses the maxSize() and size() methods
  -     * to determine whether the queue is full.
  +     * Check to see if the <code>Queue</code> is full. The method uses the
  +     * <code>maxSize</code> and <code>size</code> methods to determine
  +     * whether the queue is full.
        */
       public boolean isFull()
       {
  @@ -88,7 +89,8 @@
       }
   
       /**
  -     * Set the timeout
  +     * Set the timeout for the <code>Queue</code> in milliseconds.  The
  +     * default timeout is 0, which means that we don't wait at all.
        */
       public void setTimeout( final long millis )
       {
  @@ -102,6 +104,10 @@
           }
       }
   
  +    /**
  +     * Encapsulates the logic to block the <code>Queue</code> for the amount
  +     * of time specified by the timeout.
  +     */
       protected void block( Object lock )
       {
           if( m_timeout > 0 )
  
  
  
  1.15      +26 -2     
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/DefaultQueue.java
  
  Index: DefaultQueue.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/DefaultQueue.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultQueue.java 7 Aug 2002 23:08:25 -0000       1.14
  +++ DefaultQueue.java 7 Aug 2002 23:30:48 -0000       1.15
  @@ -55,8 +55,8 @@
   
   /**
    * The default queue implementation is a variable size queue.  This queue is
  - * ThreadSafe, however the overhead in synchronization costs a few extra
  - * millis.
  + * thread safe, however the overhead in synchronization costs a few extra
  + * milliseconds.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
    */
  @@ -67,6 +67,15 @@
       private int m_reserve;
       private final int m_maxSize;
   
  +    /**
  +     * Construct a new DefaultQueue with the specified number of elements.
  +     * if the number of elements is greater than zero, then the
  +     * <code>Queue</code> is bounded by that number.  Otherwise, the
  +     * <code>Queue</code> is not bounded at all.
  +     *
  +     * @param  size  The maximum number of elements in the 
<code>Queue</code>.
  +     *               Any number less than 1 means there is no limit.
  +     */
       public DefaultQueue( int size )
       {
           int maxSize;
  @@ -87,16 +96,31 @@
           m_maxSize = maxSize;
       }
   
  +    /**
  +     * Create an unbounded DefaultQueue.
  +     */
       public DefaultQueue()
       {
           this( -1 );
       }
   
  +    /**
  +     * Return the number of elements currently in the <code>Queue</code>.
  +     *
  +     * @return <code>int</code> representing the number of elements.
  +     */
       public int size()
       {
           return m_elements.size();
       }
   
  +    /**
  +     * Return the maximum number of elements that will fit in the
  +     * <code>Queue</code>.  A number below 1 indecates an unbounded
  +     * <code>Queue</code>, which means there is no limit.
  +     *
  +     * @return <code>int</code> representing the maximum number of elements
  +     */
       public int maxSize()
       {
           return m_maxSize;
  
  
  
  1.6       +2 -2      
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/EventHandler.java
  
  Index: EventHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/EventHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EventHandler.java 7 Aug 2002 23:08:25 -0000       1.5
  +++ EventHandler.java 7 Aug 2002 23:30:48 -0000       1.6
  @@ -50,8 +50,8 @@
   package org.apache.excalibur.event;
   
   /**
  - * An EventHandler takes care of processing specific events in an Event Based
  - * architecture.
  + * An <code>EventHandler</code> takes care of processing specific events in
  + * an event-based architecture.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
    */
  
  
  
  1.11      +10 -3     
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/FixedSizeQueue.java
  
  Index: FixedSizeQueue.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/FixedSizeQueue.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FixedSizeQueue.java       7 Aug 2002 23:08:25 -0000       1.10
  +++ FixedSizeQueue.java       7 Aug 2002 23:30:48 -0000       1.11
  @@ -52,9 +52,9 @@
   import org.apache.avalon.excalibur.concurrent.Mutex;
   
   /**
  - * The default queue implementation is a variable size queue.  This queue is
  - * ThreadSafe, however the overhead in synchronization costs a few extra
  - * millis.
  + * An implementation of the <code>Queue</code> that has a fixed size.  Once
  + * the maximum number of elements are set, this <code>Queue</code> cannot be
  + * changed.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
    */
  @@ -67,8 +67,15 @@
       private int m_end = 0;
       private int m_reserve = 0;
   
  +    /**
  +     * Create a <code>FixedSizedQueue</code> with the specified maximum size.
  +     * The maximum size must be 1 or more.
  +     */
       public FixedSizeQueue( int size )
       {
  +        if ( size < 1 )
  +            throw new IllegalArgument("Cannot specify an unbounded Queue");
  +
           m_elements = new QueueElement[ size + 1 ];
           m_mutex = new Mutex();
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to