superwaba.ext.palm.io.builtin
Class Memo

java.lang.Object
  |
  +--superwaba.ext.palm.io.builtin.Memo

public class Memo
extends Object
implements Storable

Provides a link to the standard Palm Memo database. Note: if you call getMemo and null is returned, its because that memo was deleted. The deleted memos stays on the catalog, but you can't access them. So to do a search for a title, use the method findMemo.

Here is an example for storing a memo:

 Memo m2 = new Memo();
 m2.text = "a new memo";
 Memo.addMemo(m2);
 


Field Summary
 String text
          the text of the memo.
 
Constructor Summary
Memo()
          Constructs a new empty memo
 
Method Summary
static boolean addMemo(Memo memo)
          Adds a new Memo to the database
static Memo findMemo(String title, boolean ignoreCase)
          Search through the Memo to find records that starts with the given title. ignoreCase searches are much slower, since the string is converted to lowercase before comparision.
 byte getID()
          Gets a unique ID for this class.
 Storable getInstance()
          Returns an object of the same class as this object.
static Memo getMemo(int i)
          Gets a Memo from the database
static boolean getMemo(int i, Memo memo)
          Gets a Memo from the database and places it into the given Memo.
 void loadState(DataStream ds)
          Load state information from the given DataStream into this object If any Storable objects need to be loaded as part of the state, their loadState() method can be called too.
static int memoCount()
          Gets the number of Memos in the database
 void saveState(DataStream ds)
          Send the state information of this object to the given object catalog using the given DataStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

text

public String text
the text of the memo. Note: to read and write this text, you must use DataStream.read/writeCString.
Constructor Detail

Memo

public Memo()
Constructs a new empty memo
Method Detail

memoCount

public static int memoCount()
Gets the number of Memos in the database
Returns:
the number of memos

getMemo

public static Memo getMemo(int i)
Gets a Memo from the database
Parameters:
i - the index to get
Returns:
the retrieved memo or null if the memo with that index was deleted.

getMemo

public static boolean getMemo(int i,
                              Memo memo)
Gets a Memo from the database and places it into the given Memo. Any previous data in the memo is erased.
Parameters:
i - the index to get
memo - the memo object to place the memo into.

addMemo

public static boolean addMemo(Memo memo)
Adds a new Memo to the database
Parameters:
memo - the memo to add
Returns:
true if successful, false otherwise guich changed this method to be public.

saveState

public void saveState(DataStream ds)
Send the state information of this object to the given object catalog using the given DataStream. If any Storable objects need to be saved as part of the state, their saveState() method can be called too.
Specified by:
saveState in interface Storable

loadState

public void loadState(DataStream ds)
Load state information from the given DataStream into this object If any Storable objects need to be loaded as part of the state, their loadState() method can be called too.
Specified by:
loadState in interface Storable

getID

public byte getID()
Gets a unique ID for this class. It is up to the user to ensure that the ID of each class of Storable contained in a single ObjectCatalog is unique and the ID of each instance in a class is the same.
Specified by:
getID in interface Storable

getInstance

public Storable getInstance()
Returns an object of the same class as this object.
Specified by:
getInstance in interface Storable
Returns:
a class. Any data is irrelevent.

findMemo

public static Memo findMemo(String title,
                            boolean ignoreCase)
Search through the Memo to find records that starts with the given title. ignoreCase searches are much slower, since the string is converted to lowercase before comparision.
Returns:
null if the Memo was deleted or not found; the Memo otherwise.