org.jSyncManager.API.Protocol.Util.StdApps

Class AbstractAppBlock

Implemented Interfaces:
Serializable
Known Direct Subclasses:
AddressAppBlock, DateBookAppBlock, ExpenseAppBlock, MailAppBlock, MemoAppBlock, NotepadAppBlock, ToDoListAppBlock

public abstract class AbstractAppBlock
extends DLPBlock

This interface provides the common method signatures for App Block classes.

Field Summary

protected CategoryInfo[]
categories
An array to hold category information.
protected byte
lastUniqueID
The last unique ID in use.
protected int
numCategories
The number of categories in this database.
protected byte
sortOrder
The sort order for this database.

Fields inherited from class org.jSyncManager.API.Protocol.Util.DLPBlock

blockSize, data

Constructor Summary

AbstractAppBlock()
AbstractAppBlock(DLPBlock block)

Method Summary

void
addCategory(CategoryInfo newCategory)
Adds a category to this application block.
int
findCategoryInfo(int i)
Find the category info block, given the category ID.
int
findCategoryInfoByName(String categoryName)
Find a category info object, given the category ID.
CategoryInfo
findCategoryInfoObject(int i)
Find a category info object, given the category ID.
CategoryInfo[]
getCategories()
Return an array of the category info blocks.
CategoryInfo
getCategoryInfo(int i)
Get the category info block given the category index.
byte
getLastUniqueID()
Return the last unique ID.
int
getNumCategories()
Return the number of categories.
byte
getSortOrder()
Get the sort order for the data records.
void
setCategoryInfo(CategoryInfo categoryinfo, int i)
Set the category info block, given the index.
void
setLastUniqueID(byte newValue)
Set the last unique ID value.
void
setSortOrder(byte order)
Set the sort order of this application block.

Methods inherited from class org.jSyncManager.API.Protocol.Util.DLPBlock

generateData, getBlockSize, getData, parseFields, setData, toString

Field Details

categories

protected CategoryInfo[] categories
An array to hold category information.

lastUniqueID

protected byte lastUniqueID
The last unique ID in use.

numCategories

protected int numCategories
The number of categories in this database.

sortOrder

protected byte sortOrder
The sort order for this database.

Constructor Details

AbstractAppBlock

public AbstractAppBlock()

AbstractAppBlock

public AbstractAppBlock(DLPBlock block)
            throws ParseException

Method Details

addCategory

public void addCategory(CategoryInfo newCategory)
Adds a category to this application block.
Parameters:
newCategory - the new category to be added.

findCategoryInfo

public int findCategoryInfo(int i)
Find the category info block, given the category ID.
Parameters:
i - int category ID.
Returns:
the index of the category info block.

findCategoryInfoByName

public int findCategoryInfoByName(String categoryName)
Find a category info object, given the category ID.
Parameters:
categoryName - the name of the category to search for.
Returns:
the index of the category info block, or -1 if not found.

findCategoryInfoObject

public CategoryInfo findCategoryInfoObject(int i)
Find a category info object, given the category ID.
Parameters:
i - int category ID.
Returns:
the matching CategoryInfo object, or null if no matching category object is found.

getCategories

public CategoryInfo[] getCategories()
Return an array of the category info blocks.
Returns:
an array of the category info blocks.

getCategoryInfo

public CategoryInfo getCategoryInfo(int i)
Get the category info block given the category index.
Parameters:
i - int index to the desired category info.
Returns:
the CategoryInfo object containing the requested category information.

getLastUniqueID

public byte getLastUniqueID()
Return the last unique ID.
Returns:
the last unique ID.

getNumCategories

public int getNumCategories()
Return the number of categories.
Returns:
the number of categories.

getSortOrder

public byte getSortOrder()
Get the sort order for the data records.
Returns:
the sort order used by this database.

setCategoryInfo

public void setCategoryInfo(CategoryInfo categoryinfo,
                            int i)
Set the category info block, given the index.
Parameters:
categoryinfo - the CategoryInfo object to set.
i - Index in which to insert of the category info.

setLastUniqueID

public void setLastUniqueID(byte newValue)
Set the last unique ID value.
Parameters:
newValue - the last unique ID value.

setSortOrder

public void setSortOrder(byte order)
Set the sort order of this application block.
Parameters:
order - byte representation of the sort order.