brf.j2me.dynaworks.db.palm
Class DatebookRec

java.lang.Object
  |
  +--brf.j2me.dynaworks.db.Record
        |
        +--brf.j2me.dynaworks.db.palm.PalmRec
              |
              +--brf.j2me.dynaworks.db.palm.DatebookRec
All Implemented Interfaces:
Dataset

public class DatebookRec
extends PalmRec

A DatebookRec represents a record in the Palm build-in datebook database.

Version:
1.0
Author:
Bernd R. Fix
See Also:
PalmRec, DatebookDB

Field Summary
private  int descLength
           
private  int descStart
          parameters to address the description in the record.

private  short[] exceptions
          exception list in case FLG_EXCEPTIONS is set.
private  int flags
          flags coded as a bit-masked integer.
static int FLG_ALARM
           
static int FLG_CHANGED
           
static int FLG_DESCRIPTION
           
static int FLG_EXCEPTIONS
           
static int FLG_NOTE
           
static int FLG_REPEAT
           
static int FLG_UNK1
           
static int FLG_UNK2
           
private  int noteLength
           
private  int noteStart
          parameters to address the note in the record.
static int REPEAT_DAILY
           
static int REPEAT_MONTHLY_BY_DATE
           
static int REPEAT_MONTHLY_BY_DAY
           
static int REPEAT_NONE
          repeat types.
static int REPEAT_WEEKLY
           
static int REPEAT_YEARLY
           
private  int repeatPos
          start of repeat information.
static int UNIT_DAYS
           
static int UNIT_HOURS
           
static int UNIT_MINUTES
          alarm units.
 
Fields inherited from class brf.j2me.dynaworks.db.Record
content, fields, sequence
 
Constructor Summary
DatebookRec()
          constructor.
 
Method Summary
 int getAlarmAdvance()
          If this is an alarm entry, get the alarm advance.
 int getAlarmUnit()
          If this is an alarm entry, get the alarm advance unit.
 Date getDate()
          Get the date for this appointment.
 java.lang.String getDescription()
          Get the description for this appointment.
 Time getEndTime()
          Get the end time for this appointment.
 Date[] getExceptions()
          If this is an repeating appointment with exceptions, get the list of exception dates in chronological order.
 java.lang.String getNote()
          Get the note attached to this appointment.
 int getRepeatAt()
          If this is an repeating appointment, get the code for the repetition.
 int getRepeatDayBase()
          In case this is a repeating appointment and you have a type based on the "day of week (dow)" number, the value returned by this method addresses the base day.
 Date getRepeatEnd()
          If this is an repeating appointment, get the end date for the repetition.
 int getRepeatFrequency()
          If this is an repeating appointment, get the repeat frequency.
 int getRepeatType()
          If this is an repeating appointment, get the type of repetition.
 Time getStartTime()
          Get the start time for this appointment.
 boolean hasExceptions()
          In case this is a repeating event, do we have any exceptions to the repeat list?
 boolean isAlarm()
          Is this an alarm entry?
 boolean isChanged()
          Has the entry been changed?
 boolean isRepeat()
          Is this a repeating event?
protected  void update(boolean tomem)
          Transfer the record content to the field variables.
 
Methods inherited from class brf.j2me.dynaworks.db.palm.PalmRec
bitCount, intValue, shortValue
 
Methods inherited from class brf.j2me.dynaworks.db.Record
addField, getBytes, getContent, getField, getInt, getShort, getString, readField, setBytes, setContent, setField, setInt, setShort, setString, size, writeField
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

noteStart

private int noteStart
parameters to address the note in the record.

These values are only valid if FLG_NOTE is set.


noteLength

private int noteLength

descStart

private int descStart
parameters to address the description in the record.


descLength

private int descLength

exceptions

private short[] exceptions
exception list in case FLG_EXCEPTIONS is set.

repeatPos

private int repeatPos
start of repeat information.

flags

private int flags
flags coded as a bit-masked integer.

FLG_UNK1

public static final int FLG_UNK1

FLG_UNK2

public static final int FLG_UNK2

FLG_DESCRIPTION

public static final int FLG_DESCRIPTION

FLG_EXCEPTIONS

public static final int FLG_EXCEPTIONS

FLG_NOTE

public static final int FLG_NOTE

FLG_REPEAT

public static final int FLG_REPEAT

FLG_ALARM

public static final int FLG_ALARM

FLG_CHANGED

public static final int FLG_CHANGED

UNIT_MINUTES

public static final int UNIT_MINUTES
alarm units.

UNIT_HOURS

public static final int UNIT_HOURS

UNIT_DAYS

public static final int UNIT_DAYS

REPEAT_NONE

public static final int REPEAT_NONE
repeat types.

REPEAT_DAILY

public static final int REPEAT_DAILY

REPEAT_WEEKLY

public static final int REPEAT_WEEKLY

REPEAT_MONTHLY_BY_DAY

public static final int REPEAT_MONTHLY_BY_DAY

REPEAT_MONTHLY_BY_DATE

public static final int REPEAT_MONTHLY_BY_DATE

REPEAT_YEARLY

public static final int REPEAT_YEARLY
Constructor Detail

DatebookRec

public DatebookRec()
constructor.

Method Detail

update

protected void update(boolean tomem)
Transfer the record content to the field variables.

Although an DatebkRecord is derived from a "normal" record, it's not using the RecordField mechanism to access its data but it stores and retreives its fields in a different way (directly from the content byte array).

Overrides:
update in class Record
Parameters:
tomem - boolean - direction of transfer

getStartTime

public Time getStartTime()
Get the start time for this appointment.

Returns:
time brf.j2me.dynaworks.util.Time - start time for appointment.
See Also:
Time

getEndTime

public Time getEndTime()
Get the end time for this appointment.

Returns:
time brf.j2me.dynaworks.util.Time - end time for appointment.
See Also:
Time

getDate

public Date getDate()
Get the date for this appointment.

Returns:
time brf.j2me.dynaworks.util.Date - date for appointment.
See Also:
Date

isChanged

public boolean isChanged()
Has the entry been changed?

Returns:
boolean - entry changed.

isAlarm

public boolean isAlarm()
Is this an alarm entry?

Returns:
boolean - alarm set for this appointment?

isRepeat

public boolean isRepeat()
Is this a repeating event?

Returns:
boolean - repeating appointment.

hasExceptions

public boolean hasExceptions()
In case this is a repeating event, do we have any exceptions to the repeat list?

Returns:
boolean - exceptions present.
See Also:
getExceptions()

getNote

public java.lang.String getNote()
Get the note attached to this appointment.

Returns:
String - note (or empty string)

getDescription

public java.lang.String getDescription()
Get the description for this appointment.

Returns:
String - description of appointment.

getAlarmAdvance

public int getAlarmAdvance()
If this is an alarm entry, get the alarm advance. This is a number between 1 and 255.

Returns:
int - alarm advance.
See Also:
isAlarm(), getAlarmUnit()

getAlarmUnit

public int getAlarmUnit()
If this is an alarm entry, get the alarm advance unit.

Returns:
int - alarm advance unit.
See Also:
isAlarm(), getAlarmAdvance(), UNIT_MINUTES

getRepeatEnd

public Date getRepeatEnd()
If this is an repeating appointment, get the end date for the repetition.

Returns:
brf.j2me.dynaworks.util.Date - end date for repetition (or null for no end date available).
See Also:
Date, isRepeat()

getRepeatFrequency

public int getRepeatFrequency()
If this is an repeating appointment, get the repeat frequency.

Returns:
int - repeat frequency (every ??? days/weeks...).
See Also:
isRepeat()

getRepeatAt

public int getRepeatAt()
If this is an repeating appointment, get the code for the repetition.

If the type of repetion (see method 'getRepeatType()' for further details) is REPEAT_WEEKLY, the code denotes the day of week the event is scheduled for.

If the repetition type is REPEAT_MONTHLY_BY_DAY, the code is split: the week number is "code / 7 + 1" and the day of the week is (code % 7)

In order to find the correct name of the scheduled day of the week, you have to take dayBase into account. See the method 'getRepeatDayBase()' for further details.

Returns:
brf.j2me.dynaworks.util.Date - end date for repetition (or null for no end date available).
See Also:
Date, isRepeat(), getRepeatDayBase(), getRepeatType()

getRepeatDayBase

public int getRepeatDayBase()
In case this is a repeating appointment and you have a type based on the "day of week (dow)" number, the value returned by this method addresses the base day.

How does this work:

Days are numbered from '0' (Sunday) to '6' (Saturday). Assume you have a dow value of '5' and this method return '1'. So the needed number is '5' - '1' = '4' which means "Wednesday" in the table of day names.

Returns:
int - day base for repetition.
See Also:
getRepeatType(), getRepeatAt(), isRepeat()

getExceptions

public Date[] getExceptions()
If this is an repeating appointment with exceptions, get the list of exception dates in chronological order.

Returns:
brf.pilot.util.Date[] - array of exception dates.
See Also:
Date, isRepeat(), hasExceptions()

getRepeatType

public int getRepeatType()
If this is an repeating appointment, get the type of repetition.

Returns:
int - type of repetition
See Also:
REPEAT_NONE, isRepeat()