com.primus.searchstudio
Class Categories

java.lang.Object
  extended by com.primus.searchstudio.Categories
All Implemented Interfaces:
java.io.Serializable

public class Categories
extends java.lang.Object
implements java.io.Serializable

Collection to store the categories (aka topics) for a given or search request. This object comprises a collection of individual Category objects.

See Also:
Serialized Form

Constructor Summary
Categories()
           
 
Method Summary
 void addCategory(Category category)
          Add a single Category to Categories collection
 Category[] getCategories()
          Return an array of contained categories.
 Category getCategories(int index)
          Get a single Category based on its index in the Categories collection
 Category getCategories(java.lang.String path)
          Get a single Category based on category (i.e.
 int getCategoryCount()
          Return the number of Category objects.
 Category[] getChildCategories(Category category)
          Gets the child Categories for a given parent Category object
 CategoryResultObjects getCombinedResults()
          returns a combined collection of CategoryPrefAnswer objects from all Categories
 Category getParentCategory(Category cat)
          Gets the parent Category for a given Category object
 ConstantQueryID getQueryId()
          Deprecated. always returns 0
 int getSize()
          Return size of Categories collection
 boolean hasCategory(Category category)
          Check if a given Category exists in the Categories collection
 boolean hasCategory(java.lang.String path)
          Check if a given category exists exists in the Categories collection based on category (i.e.
 void insertCategoryAt(Category category, int index)
          Insert a category at a give index
 void setCategories(Category[] categories)
          Appends a set of Category objects to this Categories object.
 void setQueryId(ConstantQueryID queryId)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Categories

public Categories()
Method Detail

getQueryId

public ConstantQueryID getQueryId()
Deprecated. always returns 0

Returns:
the ID of the associated query

setQueryId

public void setQueryId(ConstantQueryID queryId)
Deprecated. 

Parameters:
queryId - the ID of the associated query

getCategoryCount

public int getCategoryCount()
Return the number of Category objects.

Returns:
number of individual categories available

getSize

public int getSize()
Return size of Categories collection

Returns:
the number of invidual Category objects in the current Categories collection

getCategories

public Category[] getCategories()
Return an array of contained categories.

Returns:
an array of contained categories
See Also:
setCategories(com.primus.searchstudio.Category[])

getCombinedResults

public CategoryResultObjects getCombinedResults()
returns a combined collection of CategoryPrefAnswer objects from all Categories

Returns:
a combined collection of CategoryPrefAnswer objects from all Categories

setCategories

public void setCategories(Category[] categories)
Appends a set of Category objects to this Categories object.

Parameters:
categories - an array of Category objects to add
See Also:
getCategories()

getCategories

public Category getCategories(int index)
                       throws java.lang.IndexOutOfBoundsException
Get a single Category based on its index in the Categories collection

Parameters:
index - which category
Returns:
Category object
Throws:
java.lang.IndexOutOfBoundsException
See Also:
setCategories(com.primus.searchstudio.Category[])

getCategories

public Category getCategories(java.lang.String path)
Get a single Category based on category (i.e. "/Topic/...") path

Parameters:
path - the path to the Category object (e.g. starting with "/Topics/..")
Returns:
Category object if found. Null if no Category is found

addCategory

public void addCategory(Category category)
Add a single Category to Categories collection

Parameters:
category - single category to add

hasCategory

public boolean hasCategory(Category category)
Check if a given Category exists in the Categories collection

Parameters:
category - the Category object for which to look
Returns:
boolean if the given Category exists in the collection

hasCategory

public boolean hasCategory(java.lang.String path)
Check if a given category exists exists in the Categories collection based on category (i.e. "/Topics/...") path

Parameters:
path - the category (i.e. "/Topics/...") path for the Category
Returns:
boolean if the given Category exists in the collection

getParentCategory

public Category getParentCategory(Category cat)
Gets the parent Category for a given Category object

Parameters:
cat - the child Category for which the parent Category should be returned
Returns:
the parent Category object if it exists. Otherwise, a Null is returned

insertCategoryAt

public void insertCategoryAt(Category category,
                             int index)
Insert a category at a give index

Parameters:
category - the Category object to be inserted into the Categories collecction
index - the index in the Categories collection in to which the given Category should be inserted

getChildCategories

public Category[] getChildCategories(Category category)
Gets the child Categories for a given parent Category object

Parameters:
category - the (parent) Category for which the child Categories should be returned
Returns:
an array of Category objects