net.rim.device.api.command.registrar
Class CategoryCollection

java.lang.Object
  extended by net.rim.device.api.command.registrar.CategoryCollection
Direct Known Subclasses:
NullCategoryCollection

public class CategoryCollection
extends Object

Collection of category strings.

Since:
BlackBerry API 6.0.0

Constructor Summary
CategoryCollection()
          Creates a CategoryCollection instance.
CategoryCollection(String category)
          Creates a CategoryCollection instance with one category.
CategoryCollection(String[] categories)
          Creates a CategoryCollection instance with categories contained in a specified string array.
CategoryCollection(CategoryCollection categories)
          Creates a CategoryCollection instance with categories contained in a specified CategoryCollection.
 
Method Summary
 boolean add(String category)
          Adds a category to the collection.
 boolean addAll(String[] categories)
          Adds all categories contained within a specified array to the collection.
 boolean addAll(CategoryCollection categories)
          Adds all categories contained within a CategoryCollection to the collection.
 void clear()
          Removes all categories in the collection.
 boolean contains(String category)
          Determines if a category is contained within the collection.
 boolean containsAll(CategoryCollection categories)
          Determines if all specified categories are contained within the collection.
 boolean containsAny(CategoryCollection categories)
          Determines if any specified categories are contained within the collection.
 boolean isEmpty()
          Determines if the collection is empty.
 boolean remove(String category)
          Removes a specified category from the collection.
 boolean removeAll(CategoryCollection categories)
          Removes all categories specified in a CategoryCollection.
 boolean retainAll(CategoryCollection categories)
          Removes all categories except ones specified in a CategoryCollection.
 int size()
          Returns the number of categories in the collection.
 String toString()
          Returns a string representation of the collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

CategoryCollection

public CategoryCollection()
Creates a CategoryCollection instance.

Since:
BlackBerry API 6.0.0

CategoryCollection

public CategoryCollection(String category)
Creates a CategoryCollection instance with one category.

Parameters:
category - Category string.
Throws:
IllegalArgumentException - if category is null or empty, exceeds 255 characters, or does not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]*
Since:
BlackBerry API 6.0.0

CategoryCollection

public CategoryCollection(CategoryCollection categories)
Creates a CategoryCollection instance with categories contained in a specified CategoryCollection.

Parameters:
categories - Collection of categories.
Since:
BlackBerry API 6.0.0

CategoryCollection

public CategoryCollection(String[] categories)
Creates a CategoryCollection instance with categories contained in a specified string array.

Parameters:
categories - Array of categories.
Throws:
IllegalArgumentException - if any of the categories in the array are null or empty, exceed 255 characters, or do not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]*
Since:
BlackBerry API 6.0.0


Method Detail

add

public boolean add(String category)
Adds a category to the collection. A category will be added only if it is not already in the collection.

Parameters:
category - Category to add.
Returns:
true if the category was added, false otherwise.
Throws:
IllegalArgumentException - if category is null or empty, exceeds 255 characters, or does not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]*
Since:
BlackBerry API 6.0.0

addAll

public boolean addAll(CategoryCollection categories)
Adds all categories contained within a CategoryCollection to the collection.

Parameters:
categories - Collection of categories to add.
Returns:
true if at least one category was added, false otherwise. If categories is null then false is returned.
Since:
BlackBerry API 6.0.0

addAll

public boolean addAll(String[] categories)
Adds all categories contained within a specified array to the collection.

Parameters:
categories - Array of categories to add. If categories is null, the collection is not modified.
Returns:
true if at least one category was added, false otherwise.
Throws:
IllegalArgumentException - if any of the categories in the array are null or empty, exceed 255 characters, or do not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]* If categories is null then false is returned.
Since:
BlackBerry API 6.0.0

clear

public void clear()
Removes all categories in the collection.

Since:
BlackBerry API 6.0.0

contains

public boolean contains(String category)
Determines if a category is contained within the collection.

Parameters:
category - Category to check.
Returns:
true if the collection contains category, false otherwise.
Throws:
IllegalArgumentException - if category is null or empty, exceeds 255 characters, or does not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]*
Since:
BlackBerry API 6.0.0

containsAll

public boolean containsAll(CategoryCollection categories)
Determines if all specified categories are contained within the collection.

Parameters:
categories - Collection of categories to check for.
Returns:
true if the collection contains all the categories in categories, false otherwise.
Since:
BlackBerry API 6.0.0

containsAny

public boolean containsAny(CategoryCollection categories)
Determines if any specified categories are contained within the collection.

Parameters:
categories - Collection of categories to check for.
Returns:
true if the collection is empty, is null or contains at least one of the categories in categories, false otherwise.
Since:
BlackBerry API 6.0.0

isEmpty

public boolean isEmpty()
Determines if the collection is empty.

Returns:
true if the collection is empty, false otherwise.
Since:
BlackBerry API 6.0.0

remove

public boolean remove(String category)
Removes a specified category from the collection.

Parameters:
category - Category to remove.
Returns:
true if the category was removed, false otherwise.
Throws:
IllegalArgumentException - if category is null or empty, exceeds 255 characters, or does not match the following regular expression: ([a-zA-Z]|_|:)[a-zA-Z0-9\.\-_:]*
Since:
BlackBerry API 6.0.0

removeAll

public boolean removeAll(CategoryCollection categories)
Removes all categories specified in a CategoryCollection.

Parameters:
categories - Categories to remove.
Returns:
true if at least one category was removed, false otherwise. If categories is null then false is returned.
Since:
BlackBerry API 6.0.0

retainAll

public boolean retainAll(CategoryCollection categories)
Removes all categories except ones specified in a CategoryCollection.

Parameters:
categories - Categories to not remove.
Returns:
true if at least one category was removed, false otherwise. If categories is null then false is returned.
Since:
BlackBerry API 6.0.0

size

public int size()
Returns the number of categories in the collection.

Returns:
The number of categories in the collection.
Since:
BlackBerry API 6.0.0

toString

public String toString()
Returns a string representation of the collection.

Overrides:
toString in class Object
Returns:
A string representation of the collection.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal