javapns.notification
Class PushedNotifications

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<PushedNotification>
              extended by javapns.notification.PushedNotifications
All Implemented Interfaces:
Serializable, Cloneable, Iterable<PushedNotification>, Collection<PushedNotification>, List<PushedNotification>, RandomAccess

public class PushedNotifications
extends Vector<PushedNotification>
implements List<PushedNotification>

A list of PushedNotification objects.

This list can be configured to retain a maximum number of objects. When that maximum is reached, older objects are removed from the list before new ones are added.

Internally, this list extends Vector.

Author:
Sylvain Pedneault
See Also:
Serialized Form

Constructor Summary
PushedNotifications()
          Construct an empty list of PushedNotification objects.
PushedNotifications(int capacity)
          Construct an empty list of PushedNotification objects with a suggested initial capacity.
PushedNotifications(PushedNotifications parent)
          Construct an empty list of PushedNotification objects, and copy the maxRetained property from the provided parent list.
 
Method Summary
 boolean add(PushedNotification notification)
           
 boolean addAll(Collection<? extends PushedNotification> notifications)
           
 void addElement(PushedNotification notification)
           
 PushedNotifications getFailedNotifications()
          Filter a list of pushed notifications and return only the ones that failed.
 int getMaxRetained()
          Get the maximum number of objects that this list retains.
 PushedNotifications getSuccessfulNotifications()
          Filter a list of pushed notifications and return only the ones that were successful.
 void setMaxRetained(int maxRetained)
          Set the maximum number of objects that this list retains.
 
Methods inherited from class java.util.Vector
add, addAll, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

PushedNotifications

public PushedNotifications()
Construct an empty list of PushedNotification objects.


PushedNotifications

public PushedNotifications(int capacity)
Construct an empty list of PushedNotification objects with a suggested initial capacity.

Parameters:
capacity -

PushedNotifications

public PushedNotifications(PushedNotifications parent)
Construct an empty list of PushedNotification objects, and copy the maxRetained property from the provided parent list.

Parameters:
parent -
Method Detail

getSuccessfulNotifications

public PushedNotifications getSuccessfulNotifications()
Filter a list of pushed notifications and return only the ones that were successful.

Returns:
a filtered list containing only notifications that were succcessful

getFailedNotifications

public PushedNotifications getFailedNotifications()
Filter a list of pushed notifications and return only the ones that failed.

Returns:
a filtered list containing only notifications that were not successful

add

public boolean add(PushedNotification notification)
Specified by:
add in interface Collection<PushedNotification>
Specified by:
add in interface List<PushedNotification>
Overrides:
add in class Vector<PushedNotification>

addElement

public void addElement(PushedNotification notification)
Overrides:
addElement in class Vector<PushedNotification>

addAll

public boolean addAll(Collection<? extends PushedNotification> notifications)
Specified by:
addAll in interface Collection<PushedNotification>
Specified by:
addAll in interface List<PushedNotification>
Overrides:
addAll in class Vector<PushedNotification>

setMaxRetained

public void setMaxRetained(int maxRetained)
Set the maximum number of objects that this list retains. When this maximum is reached, older objects are removed from the list before new ones are added.

Parameters:
maxRetained - the maxRetained value currently configured (default is 1000)

getMaxRetained

public int getMaxRetained()
Get the maximum number of objects that this list retains.

Returns:
the maximum number of objects that this list retains