|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.jmrit.simpleclock.SimpleTimebase
public class SimpleTimebase
Provide basic Timebase implementation from system clock.
This implementation provides for the internal clock and for one hardware clock. A number of hooks and comments are provided below for implementing multiple hardware clocks should that ever be done.
The setTimeValue member is the fast time when the clock started. The startAtTime member is the wall-clock time when the clock was started. Together, those can be used to calculate the current fast time.
The pauseTime member is used to indicate that the timebase was paused. If non-null, it indicates the current fast time when the clock was paused.
| Field Summary |
|---|
| Fields inherited from class jmri.implementation.AbstractNamedBean |
|---|
mSystemName, mUserName |
| Fields inherited from interface jmri.Timebase |
|---|
ANALOG_CLOCK, LCD_CLOCK, NIXIE_CLOCK, NONE |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
SimpleTimebase()
|
|
| Method Summary | |
|---|---|
void |
addMinuteChangeListener(PropertyChangeListener l)
Request a call-back when the minutes place of the time changes. |
void |
addPropertyChangeListener(PropertyChangeListener l)
Request a call-back when the bound Rate or Run property changes. |
void |
dispose()
Remove references to and from this object, so that it can eventually be garbage-collected. |
protected void |
firePropertyChange(String p,
Object old,
Object n)
|
boolean |
getCorrectHardware()
|
boolean |
getInternalMaster()
|
boolean |
getIsInitialized()
|
String |
getMasterName()
|
double |
getRate()
Caution: This method may return a fiddled clock rate if certain hardware clocks are the Time Source. |
boolean |
getRun()
|
int |
getStartClockOption()
|
boolean |
getStartSetTime()
|
boolean |
getStartStopped()
|
Date |
getStartTime()
|
int |
getState()
Provide generic access to internal state. |
boolean |
getSynchronize()
|
Date |
getTime()
|
void |
initializeClock()
|
void |
initializeHardwareClock()
Method to initialize hardware clock at start up Note: This method is always called at start up after all options have been set. |
void |
removeMinuteChangeListener(PropertyChangeListener l)
Remove a request for call-back when the minutes place of the time changes. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a request for a call-back when a bound property changes. |
void |
set12HourDisplay(boolean display,
boolean update)
Set 12 or 24 hour display option |
void |
setCorrectHardware(boolean correct,
boolean update)
|
void |
setInternalMaster(boolean master,
boolean update)
|
void |
setMasterName(String name)
|
void |
setRate(double factor)
Set fast clock rate factor |
void |
setRun(boolean run)
|
void |
setStartClockOption(int option)
|
void |
setStartSetTime(boolean set,
Date time)
|
void |
setStartStopped(boolean stopped)
|
void |
setState(int s)
Provide generic access to internal state. |
void |
setSynchronize(boolean synchronize,
boolean update)
|
void |
setTime(Date d)
Set the current time |
boolean |
use12HourDisplay()
|
double |
userGetRate()
This method is used by Setup Fast Clock when an external change in fast clock rate occurs because of the peculiar way some hardware clocks attempt to synchronize with the JMRI fast clock. |
void |
userSetRate(double factor)
Used when the user changes fast clock rate in Setup Fast Clock and by hardware ClockControl implementations that fiddle with the fast clock rate to synchronize |
void |
userSetTime(Date d)
Special method for when the user changes fast clock time in Setup Fast Clock. |
| Methods inherited from class jmri.implementation.AbstractNamedBean |
|---|
addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, setComment, setProperty, setUserName, updateListenerRef |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.NamedBean |
|---|
addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, setComment, setProperty, setUserName, updateListenerRef |
| Constructor Detail |
|---|
public SimpleTimebase()
| Method Detail |
|---|
public Date getTime()
getTime in interface Timebasepublic void setTime(Date d)
Timebase
setTime in interface Timebasepublic void userSetTime(Date d)
Timebase
userSetTime in interface Timebasepublic void setRun(boolean run)
setRun in interface Timebasepublic boolean getRun()
getRun in interface Timebasepublic void setRate(double factor)
Timebase
setRate in interface Timebasepublic void userSetRate(double factor)
Timebase
userSetRate in interface Timebasepublic double getRate()
Timebase
getRate in interface Timebasepublic double userGetRate()
Timebase
userGetRate in interface Timebase
public void setInternalMaster(boolean master,
boolean update)
setInternalMaster in interface Timebasepublic boolean getInternalMaster()
getInternalMaster in interface Timebasepublic void setMasterName(String name)
setMasterName in interface Timebasepublic String getMasterName()
getMasterName in interface Timebase
public void setSynchronize(boolean synchronize,
boolean update)
setSynchronize in interface Timebasepublic boolean getSynchronize()
getSynchronize in interface Timebase
public void setCorrectHardware(boolean correct,
boolean update)
setCorrectHardware in interface Timebasepublic boolean getCorrectHardware()
getCorrectHardware in interface Timebase
public void set12HourDisplay(boolean display,
boolean update)
Timebase
set12HourDisplay in interface Timebasedisplay - true if a 12-hour display is requested, false for 24-hour displaypublic boolean use12HourDisplay()
use12HourDisplay in interface Timebasepublic void setStartStopped(boolean stopped)
setStartStopped in interface Timebasepublic boolean getStartStopped()
getStartStopped in interface Timebase
public void setStartSetTime(boolean set,
Date time)
setStartSetTime in interface Timebasepublic boolean getStartSetTime()
getStartSetTime in interface Timebasepublic Date getStartTime()
getStartTime in interface Timebasepublic void setStartClockOption(int option)
setStartClockOption in interface Timebasepublic int getStartClockOption()
getStartClockOption in interface Timebasepublic void initializeClock()
initializeClock in interface Timebasepublic void initializeHardwareClock()
initializeHardwareClock in interface Timebasepublic boolean getIsInitialized()
getIsInitialized in interface Timebase
protected void firePropertyChange(String p,
Object old,
Object n)
firePropertyChange in class AbstractNamedBeanpublic void addPropertyChangeListener(PropertyChangeListener l)
Not yet implemented.
addPropertyChangeListener in interface NamedBeanaddPropertyChangeListener in interface TimebaseaddPropertyChangeListener in class AbstractNamedBeanpublic void removePropertyChangeListener(PropertyChangeListener l)
Not yet implemented.
removePropertyChangeListener in interface NamedBeanremovePropertyChangeListener in interface TimebaseremovePropertyChangeListener in class AbstractNamedBeanpublic void dispose()
dispose in interface NamedBeandispose in interface Timebasedispose in class AbstractNamedBeanpublic void addMinuteChangeListener(PropertyChangeListener l)
addMinuteChangeListener in interface Timebasepublic void removeMinuteChangeListener(PropertyChangeListener l)
removeMinuteChangeListener in interface Timebase
public void setState(int s)
throws JmriException
NamedBeanThis generally shouldn't be used by Java code; use the class-specific form instead. (E.g. setCommandedState in Turnout) This provided to make Jython script access easier to read.
setState in interface NamedBeanJmriException - general error when cant do the needed operationpublic int getState()
NamedBeanThis generally shouldn't be used by Java code; use the class-specific form instead. (E.g. getCommandedState in Turnout) This provided to make Jython script access easier to read.
getState in interface NamedBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||