fr.emn.spiraclock
Class ShuttleUMSchedule

java.lang.Object
  extended by fr.emn.spiraclock.Schedule
      extended by fr.emn.spiraclock.ShuttleUMSchedule

public class ShuttleUMSchedule
extends Schedule


Field Summary
static java.net.URL ALTERNATE_URL
           
(package private)  java.lang.String[] availableStops
           
(package private)  java.util.Hashtable colors
           
static java.lang.String DEFAULT_URL
           
(package private)  int[] endOffsets
           
(package private)  java.lang.String[] endSchedules
           
(package private)  java.lang.String file
           
(package private)  java.lang.String fileUsed
           
(package private)  java.util.Hashtable friHours
           
(package private)  java.util.Hashtable hours
           
(package private) static int MAX_SCHEDULES
           
(package private)  int nbSchedules
           
(package private)  int[] startOffsets
           
(package private)  java.lang.String[] startSchedules
           
(package private)  ATime validityBegin
           
(package private)  ATime validityEnd
           
 
Fields inherited from class fr.emn.spiraclock.Schedule
app, appointments, baseday, cache, cacheEnabled, common0, common1, currentQueryId, errorMessage, hour_index, hour_max, hour_min, intervalSet, loaded, mn_max, mn_min, nb_index, rday_index, rday0, rday1, res, tmn0, tmn1, view
 
Constructor Summary
protected ShuttleUMSchedule()
           
 
Method Summary
 void beforeClosing()
          Subclass this method to set all schedule needed operations before application close
protected static boolean containsOption(java.util.Vector argv, java.lang.String option)
           
 Appointment[] getDayAppointments(ATime day)
          Subclass this method to return all appointments in the given day.
(package private) static int getHours(java.lang.String hour)
           
static ShuttleUMSchedule getInstance(java.lang.String[] args)
          Returns an instance of shuttle schedule with given arguments.
(package private) static int getMinutes(java.lang.String hour)
           
 java.lang.String getName()
          Subclass this method to return schedule name.
protected static int getPeriod(ATime day)
           
 java.util.Hashtable getProperties()
          Subclass this method to return all schedule properties property name (String) is the hash key and the value is an object
protected static java.io.BufferedReader getReader(java.lang.String file)
          Return a file buffered reader, or the default URL reader if file = null.
protected static java.lang.String getShuttle(java.lang.String stop)
           
protected static java.lang.String[] getStartEndStops(java.lang.String s, java.lang.String[] stoplist)
           
protected static java.lang.String getStop(java.lang.String stop)
           
protected static java.lang.String getStopListString(java.lang.String[] stops)
           
static java.lang.String[] getStops(java.lang.String file)
          Gets the list of shuttle stops from a file
 boolean loadFile(java.lang.String file)
          Reads shuttle data from a file.
static void main(java.lang.String[] args)
           
(package private) static void nextInts(java.util.StringTokenizer tokens, int[] ints, int defaultValue)
           
(package private) static java.lang.String nextString(java.util.StringTokenizer tokens, java.lang.String defaultValue)
           
 boolean processArguments(java.lang.String[] args, boolean reload)
          If reload = false, only processes schedule options and don't reload file.
(package private) static int[][] processHours(java.lang.String stop, java.util.StringTokenizer tokens)
          Returns an array of hours expressed in total minutes since midnight.
protected  boolean processStop(java.util.Vector argv, java.lang.String[] stoplist)
           
 void reload()
          Subclass this method to reload all your data.
protected static java.lang.String[] retreiveOption(java.util.Vector argv, java.lang.String option, int params)
           
 void setProperties(java.util.Hashtable props)
          Subclass this method to set all schedule dependant properties given in parameter
 void setSchedules(java.lang.String[] starts, java.lang.String[] ends, int[] addStarts, int[] addEnds)
          Sets the schedules the user is interested into
 
Methods inherited from class fr.emn.spiraclock.Schedule
addChangeListener, clearCache, fireStateChanged, firstAppointment, getAppointments, getBaseDay, getView, installPopupCommands, isLoadingNeeded, nextAppointment, retreive, setBaseDay, setInterval, setView, updateView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_URL

public static final java.lang.String DEFAULT_URL
See Also:
Constant Field Values

ALTERNATE_URL

public static final java.net.URL ALTERNATE_URL

MAX_SCHEDULES

static final int MAX_SCHEDULES
See Also:
Constant Field Values

colors

java.util.Hashtable colors

hours

java.util.Hashtable hours

friHours

java.util.Hashtable friHours

validityBegin

ATime validityBegin

validityEnd

ATime validityEnd

availableStops

java.lang.String[] availableStops

file

java.lang.String file

startSchedules

java.lang.String[] startSchedules

endSchedules

java.lang.String[] endSchedules

startOffsets

int[] startOffsets

endOffsets

int[] endOffsets

nbSchedules

int nbSchedules

fileUsed

java.lang.String fileUsed
Constructor Detail

ShuttleUMSchedule

protected ShuttleUMSchedule()
Method Detail

main

public static void main(java.lang.String[] args)

reload

public void reload()
Description copied from class: Schedule
Subclass this method to reload all your data.

Specified by:
reload in class Schedule

getProperties

public java.util.Hashtable getProperties()
Description copied from class: Schedule
Subclass this method to return all schedule properties property name (String) is the hash key and the value is an object

Specified by:
getProperties in class Schedule

setProperties

public void setProperties(java.util.Hashtable props)
Description copied from class: Schedule
Subclass this method to set all schedule dependant properties given in parameter

Specified by:
setProperties in class Schedule

getInstance

public static ShuttleUMSchedule getInstance(java.lang.String[] args)
Returns an instance of shuttle schedule with given arguments. Returns null if arguments are not correct or if they don't ask to run the application.


processArguments

public boolean processArguments(java.lang.String[] args,
                                boolean reload)
If reload = false, only processes schedule options and don't reload file.


processStop

protected boolean processStop(java.util.Vector argv,
                              java.lang.String[] stoplist)

getStartEndStops

protected static java.lang.String[] getStartEndStops(java.lang.String s,
                                                     java.lang.String[] stoplist)

containsOption

protected static boolean containsOption(java.util.Vector argv,
                                        java.lang.String option)

retreiveOption

protected static java.lang.String[] retreiveOption(java.util.Vector argv,
                                                   java.lang.String option,
                                                   int params)

setSchedules

public void setSchedules(java.lang.String[] starts,
                         java.lang.String[] ends,
                         int[] addStarts,
                         int[] addEnds)
Sets the schedules the user is interested into


getName

public java.lang.String getName()
Description copied from class: Schedule
Subclass this method to return schedule name.

Specified by:
getName in class Schedule

getDayAppointments

public Appointment[] getDayAppointments(ATime day)
Description copied from class: Schedule
Subclass this method to return all appointments in the given day. Appointments that does not start & end the same day are NOT returned. (This method does not need to be fast).

Specified by:
getDayAppointments in class Schedule

getPeriod

protected static int getPeriod(ATime day)

getReader

protected static java.io.BufferedReader getReader(java.lang.String file)
Return a file buffered reader, or the default URL reader if file = null. Returns null if file does not exist or URL is not accessible.


getStops

public static java.lang.String[] getStops(java.lang.String file)
Gets the list of shuttle stops from a file


getStopListString

protected static java.lang.String getStopListString(java.lang.String[] stops)

getShuttle

protected static java.lang.String getShuttle(java.lang.String stop)

getStop

protected static java.lang.String getStop(java.lang.String stop)

loadFile

public boolean loadFile(java.lang.String file)
Reads shuttle data from a file. Returns true if success.


processHours

static int[][] processHours(java.lang.String stop,
                            java.util.StringTokenizer tokens)
Returns an array of hours expressed in total minutes since midnight. processHours[0] contains hours from monday to thursday. processHours[1] contains friday hours. Stop param is for debugging


getHours

static int getHours(java.lang.String hour)

getMinutes

static int getMinutes(java.lang.String hour)

nextInts

static void nextInts(java.util.StringTokenizer tokens,
                     int[] ints,
                     int defaultValue)

nextString

static java.lang.String nextString(java.util.StringTokenizer tokens,
                                   java.lang.String defaultValue)

beforeClosing

public void beforeClosing()
Description copied from class: Schedule
Subclass this method to set all schedule needed operations before application close

Specified by:
beforeClosing in class Schedule