jmri
Interface Timebase

All Superinterfaces:
NamedBean
All Known Implementing Classes:
SimpleTimebase

public interface Timebase
extends NamedBean

Provide access to clock capabilities in hardware or software.

The Rate parameter determines how much faster than real time this timebase runs. E.g. a value of 2.0 means that the value returned by getTime will advance an hour for every half-hour of wall-clock time elapsed.

The Rate and Run parameters are bound, so you can listen for them changing. The Time parameters is not bound, because it changes continuously. Ask for its value when needed, or add a a listener for the changes in the "minute" value using addMinuteChangeListener(java.beans.PropertyChangeListener)

This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Author:
Bob Jacobsen Copyright (C) 2004, 2007, 2008

Field Summary
static int ANALOG_CLOCK
           
static int LCD_CLOCK
           
static int NIXIE_CLOCK
           
static int NONE
           
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
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.
 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()
           
 boolean getSynchronize()
           
 Date getTime()
           
 void initializeClock()
           
 void initializeHardwareClock()
          Initialize hardware clock at start up after all options are set up.
 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 y)
           
 void setStartClockOption(int option)
           
 void setStartSetTime(boolean set, Date time)
           
 void setStartStopped(boolean stopped)
           
 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 interface jmri.NamedBean
addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getState, getSystemName, getUserName, setComment, setProperty, setState, setUserName, updateListenerRef
 

Field Detail

NONE

static final int NONE
See Also:
Constant Field Values

NIXIE_CLOCK

static final int NIXIE_CLOCK
See Also:
Constant Field Values

ANALOG_CLOCK

static final int ANALOG_CLOCK
See Also:
Constant Field Values

LCD_CLOCK

static final int LCD_CLOCK
See Also:
Constant Field Values
Method Detail

setTime

void setTime(Date d)
Set the current time


userSetTime

void userSetTime(Date d)
Special method for when the user changes fast clock time in Setup Fast Clock.


getTime

Date getTime()

setRun

void setRun(boolean y)

getRun

boolean getRun()

setRate

void setRate(double factor)
             throws TimebaseRateException
Set fast clock rate factor

Throws:
TimebaseRateException - if the implementation can't do the requested rate

userSetRate

void userSetRate(double factor)
                 throws TimebaseRateException
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

Throws:
TimebaseRateException

getRate

double getRate()
Caution: This method may return a fiddled clock rate if certain hardware clocks are the Time Source. Use "userGetRate" if you want the real clock rate instead.


userGetRate

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. This call will return the "true" rate even if the master Timebase rate has been fiddled by a hardware clock.


setInternalMaster

void setInternalMaster(boolean master,
                       boolean update)

getInternalMaster

boolean getInternalMaster()

setMasterName

void setMasterName(String name)

getMasterName

String getMasterName()

setSynchronize

void setSynchronize(boolean synchronize,
                    boolean update)

getSynchronize

boolean getSynchronize()

setCorrectHardware

void setCorrectHardware(boolean correct,
                        boolean update)

getCorrectHardware

boolean getCorrectHardware()

set12HourDisplay

void set12HourDisplay(boolean display,
                      boolean update)
Set 12 or 24 hour display option

Parameters:
display - true if a 12-hour display is requested, false for 24-hour display

use12HourDisplay

boolean use12HourDisplay()

setStartStopped

void setStartStopped(boolean stopped)

getStartStopped

boolean getStartStopped()

setStartSetTime

void setStartSetTime(boolean set,
                     Date time)

getStartSetTime

boolean getStartSetTime()

getStartTime

Date getStartTime()

setStartClockOption

void setStartClockOption(int option)

getStartClockOption

int getStartClockOption()

initializeClock

void initializeClock()

initializeHardwareClock

void initializeHardwareClock()
Initialize hardware clock at start up after all options are set up.

Note: This method is always called at start up. It should be ignored if there is no communication with a hardware clock


getIsInitialized

boolean getIsInitialized()
Returns:
true if call to initialize Hardware Clock has occurred

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener l)
Request a call-back when the bound Rate or Run property changes.

Specified by:
addPropertyChangeListener in interface NamedBean

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener l)
Remove a request for a call-back when a bound property changes.

Specified by:
removePropertyChangeListener in interface NamedBean

addMinuteChangeListener

void addMinuteChangeListener(PropertyChangeListener l)
Request a call-back when the minutes place of the time changes.


removeMinuteChangeListener

void removeMinuteChangeListener(PropertyChangeListener l)
Remove a request for call-back when the minutes place of the time changes.


dispose

void dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.

Specified by:
dispose in interface NamedBean


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads