directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r326063 - in /directory/network: branches/0.7/src/java/org/apache/mina/util/ trunk/src/java/org/apache/mina/util/
Date Tue, 18 Oct 2005 09:37:52 GMT
Author: trustin
Date: Tue Oct 18 02:37:34 2005
New Revision: 326063

URL: http://svn.apache.org/viewcvs?rev=326063&view=rev
Log:
Now provides all methods in java.util.Queue in JDK 1.5


Modified:
    directory/network/branches/0.7/src/java/org/apache/mina/util/BlockingQueue.java
    directory/network/branches/0.7/src/java/org/apache/mina/util/Queue.java
    directory/network/trunk/src/java/org/apache/mina/util/BlockingQueue.java
    directory/network/trunk/src/java/org/apache/mina/util/Queue.java

Modified: directory/network/branches/0.7/src/java/org/apache/mina/util/BlockingQueue.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/util/BlockingQueue.java?rev=326063&r1=326062&r2=326063&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/util/BlockingQueue.java (original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/util/BlockingQueue.java Tue Oct
18 02:37:34 2005
@@ -112,6 +112,19 @@
         }
     }
 
+    public synchronized boolean offer( Object o )
+    {
+        if( super.offer( o ) )
+        {
+            notifyAdded();
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
     private void notifyAdded()
     {
         if( waiters > 0 )
@@ -247,4 +260,26 @@
     {
         return super.toArray( arg0 );
     }
+
+    public synchronized Object element()
+    {
+        return super.element();
+    }
+
+    public synchronized Object peek()
+    {
+        return super.peek();
+    }
+
+    public synchronized Object poll()
+    {
+        return super.poll();
+    }
+
+    public synchronized Object remove()
+    {
+        return super.remove();
+    }
+    
+    
 }

Modified: directory/network/branches/0.7/src/java/org/apache/mina/util/Queue.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/util/Queue.java?rev=326063&r1=326062&r2=326063&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/util/Queue.java (original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/util/Queue.java Tue Oct 18 02:37:34
2005
@@ -22,6 +22,7 @@
 import java.util.AbstractList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 /**
  * A unbounded circular queue.
@@ -305,5 +306,43 @@
         decreaseSize();
 
         return removed;
+    }
+
+    ///////////////////////////////////////////
+    // java.util.Queue compatibility methods //
+    ///////////////////////////////////////////
+
+    public boolean offer( Object o )
+    {
+        push( o );
+        return true;
+    }
+
+    public Object poll()
+    {
+        return pop();
+    }
+
+    public Object remove()
+    {
+        if( size == 0 )
+        {
+            throw new NoSuchElementException();
+        }
+        return pop();
+    }
+
+    public Object peek()
+    {
+        return first();
+    }
+
+    public Object element()
+    {
+        if( size == 0 )
+        {
+            throw new NoSuchElementException();
+        }
+        return first();
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/util/BlockingQueue.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/util/BlockingQueue.java?rev=326063&r1=326062&r2=326063&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/util/BlockingQueue.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/util/BlockingQueue.java Tue Oct 18 02:37:34
2005
@@ -112,6 +112,19 @@
         }
     }
 
+    public synchronized boolean offer( Object o )
+    {
+        if( super.offer( o ) )
+        {
+            notifyAdded();
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
     private void notifyAdded()
     {
         if( waiters > 0 )
@@ -247,4 +260,26 @@
     {
         return super.toArray( arg0 );
     }
+
+    public synchronized Object element()
+    {
+        return super.element();
+    }
+
+    public synchronized Object peek()
+    {
+        return super.peek();
+    }
+
+    public synchronized Object poll()
+    {
+        return super.poll();
+    }
+
+    public synchronized Object remove()
+    {
+        return super.remove();
+    }
+    
+    
 }

Modified: directory/network/trunk/src/java/org/apache/mina/util/Queue.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/util/Queue.java?rev=326063&r1=326062&r2=326063&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/util/Queue.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/util/Queue.java Tue Oct 18 02:37:34 2005
@@ -22,6 +22,7 @@
 import java.util.AbstractList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 /**
  * A unbounded circular queue.
@@ -305,5 +306,43 @@
         decreaseSize();
 
         return removed;
+    }
+
+    ///////////////////////////////////////////
+    // java.util.Queue compatibility methods //
+    ///////////////////////////////////////////
+
+    public boolean offer( Object o )
+    {
+        push( o );
+        return true;
+    }
+
+    public Object poll()
+    {
+        return pop();
+    }
+
+    public Object remove()
+    {
+        if( size == 0 )
+        {
+            throw new NoSuchElementException();
+        }
+        return pop();
+    }
+
+    public Object peek()
+    {
+        return first();
+    }
+
+    public Object element()
+    {
+        if( size == 0 )
+        {
+            throw new NoSuchElementException();
+        }
+        return first();
     }
 }



Mime
View raw message