FileDocCategorySizeDatePackage
SubscriptionList.javaAPI DocphoneME MR2 API (J2ME)3085Wed May 02 18:00:42 BST 2007gov.nist.siplite.stack

SubscriptionList

public class SubscriptionList extends Object
Class representing a list of subscription.

Fields Summary
private Vector
subscriptionVector
Vector of the active subscriptions
Constructors Summary
public SubscriptionList()
Default constructor.

        subscriptionVector = new Vector();
    
Methods Summary
public voidaddSubscription(Subscription s)
Adds a new subscription to the list.

param
s a subscription to add

        if (s != null) {
            // System.out.println("*** Adding a new SUBSCRIPTION");
            subscriptionVector.addElement(s);
        }
    
public SubscriptiongetMatchingSubscription(Message message)
Finds a subscription matching the given response or NOTIFY.

param
message response or NOTIFY message
return
a subscription matching to the given response or NOTIFY or null if the subscription was not found

        Enumeration en = subscriptionVector.elements();

        while (en.hasMoreElements()) {
            Subscription s = (Subscription)en.nextElement();
            if (s.containsSubscription(message)) {
                // System.out.println("*** Matching SUBSCRIPTION found!");
                return s;
            }
        }

        // System.out.println("*** Matching SUBSCRIPTION NOT found!");
        return null;
    
public booleanisEmpty()
Checks if the subscription list is empty.

return
true if the subscription list is empty, false otherwise

        return subscriptionVector.isEmpty();
    
public voidremoveSubscription(Subscription s)
Removes the given subscription from the list.

param
s a subscription to remove

        if (s != null) {
            // System.out.println("*** Removing SUBSCRIPTION");
            subscriptionVector.removeElement(s);
        }