Java Q&A

by Cliff Berg



Example 1:

(a)

addDate("3/23/98", "9:00A", "5:00P", "Attend JavaOne/98", "Can't wait!");



(b)

addDate(new PilotDate(time), new PilotDate(time + 3600000), "Take much needed nap");



(c)

addDate2("1/2/98", "9:00a", "1:45", "Meet with staff");







Listing One

public void addMemo(String memo);





Listing Two

public void addDate(String day, String startTime, String endTime, String desc, String note);



public void addDate(String day, String startTime, String endTime, String desc);



public void addDate(PilotDate, PilotDate, String, String);



public void addDate(PilotDate startDate, PilotDate endDate, String desc);

    long time = System.currentTimeMillis();



public void addDate2(String day, String startTime, String duration, String desc, String note);



public void addDate2(String day, String startTime, String duration, String desc);



Listing Three

public int getNumDates();

public DatebookEntry getNthDate(int);

public int getNumUpdatedDates();

public DatebookEntry getNthUpdatedDate(int);

public int getNumNewDates();

public DatebookEntry getNthNewDate(int);

public void setStartDate(DatebookEntry, PilotDate);

public void setEndDate(DatebookEntry, PilotDate);

public void appendDescription(DatebookEntry, String);

public void appendNote(DatebookEntry, String);



Listing Four

public PilotDate();

public PilotDate(PilotDate);

public PilotDate(String);

public PilotDate(String,String);

public PilotDate(int);

public PilotDate(long);

public void copy(PilotDate);

public String getDateString();

public String getTimeString();

public long getNumSeconds();

public int getYear();

public int getMonth();



public int getDay();

public int getHour();

public int getMinute();



Listing Five

public interface interface MemoAddedListener implements EventListener {

    public abstract void memoAdded(MemoAddedEvent);

}

public interface interface DateAddedListener implements EventListener {

    public abstract void dateAdded(DateAddedEvent);

}

public interface interface DateModifiedListener implements EventListener {

    public abstract void dateModified(DateModifiedEvent);

}



Listing Six

public synchronized void addMemoAddedListener(MemoAddedListener);

public synchronized void removeMemoAddedListener(MemoAddedListener);

public synchronized void addDateAddedListener(DateAddedListener);

public synchronized void removeDateAddedListener(DateAddedListener);

public synchronized void addDateModifiedListener(DateModifiedListener);

public synchronized void removeDateModifiedListener(DateModifiedListener);





2



