/**
* {@inheritDoc}
*/
- public override bool add (G item) {
- return offer (item);
- }
-
- /**
- * {@inheritDoc}
- */
public abstract int capacity { get; }
/**
/**
* {@inheritDoc}
*/
- public abstract bool offer (G element);
-
- /**
- * {@inheritDoc}
- */
public abstract G? peek ();
/**
* {@inheritDoc}
*/
public abstract G? poll ();
-
- /**
- * {@inheritDoc}
- */
- public virtual int drain (Collection<G> recipient, int amount = -1) {
- G? item = null;
- int drained = 0;
- while((amount == -1 || --amount >= 0) && (item = poll ()) != null) {
- recipient.add(item);
- drained++;
- }
- return drained;
- }
}
/**
* {@inheritDoc}
*/
+ public override bool add (G element) {
+ return offer_tail (element);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public override bool contains (G item) {
return find_index(item) != -1;
}
/**
* {@inheritDoc}
*/
- public override bool offer (G element) {
- return offer_tail (element);
- }
-
- /**
- * {@inheritDoc}
- */
public override G? peek () {
return peek_head ();
}
/**
* {@inheritDoc}
*/
- public override bool offer (G element) {
+ public bool offer (G element) {
if (_r == null) {
_r = new Type1Node<G> (element);
_p = _r;
/**
* {@inheritDoc}
*/
- public override int drain (Collection<G> recipient, int amount = -1) {
+ public int drain (Collection<G> recipient, int amount = -1) {
if (amount == -1) {
amount = this._size;
}
* inserted into a Queue, as ``null`` is also used as a special return value by
* the poll method to indicate that the queue contains no elements.
*/
+[GenericAccessors]
public interface Gee.Queue<G> : Collection<G> {
/**
*
* @return ``true`` if the element was added to the queue
*/
- public abstract bool offer (G element);
+ public virtual bool offer (G element) {
+ return add (element);
+ }
/**
* Peeks (retrieves, but not remove) an element from this queue.
*
* @return the amount of elements that were actually drained
*/
- public abstract int drain (Collection<G> recipient, int amount = -1);
+ public virtual int drain (Collection<G> recipient, int amount = -1) {
+ G? item = null;
+ int drained = 0;
+ while((amount == -1 || --amount >= 0) && (item = poll ()) != null) {
+ recipient.add (item);
+ drained++;
+ }
+ return drained;
+ }
}