Package jmri.jmrit.timetable
Class Layout
- java.lang.Object
-
- jmri.jmrit.timetable.Layout
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener,java.util.EventListener
public class Layout extends java.lang.Object implements java.beans.VetoableChangeListener
Define the content of a Layout record.The fast clock, scale and metric values affect the scale mile / scale km. When these are changed, the stop times for all of the trains have to be re-calculated. Depending on the schedule limits, this can result in calculation errors. When this occurs, exceptions occur which trigger rolling back the changes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) TimeTableDataManager_dmstatic java.lang.StringSCALE_RATIO
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LayoutgetCopy()Make a copy of the layout.intgetFastClock()intgetLayoutId()java.lang.StringgetLayoutName()booleangetMetric()doublegetRatio()ScalegetScale()doublegetScaleMK()intgetThrottles()voidsetFastClock(int newClock)Set a new fast clock speed, update smile/skm.voidsetLayoutName(java.lang.String newName)voidsetMetric(boolean newMetric)Set metric flag, update smile/skm.voidsetScale(Scale newScale)voidsetScaleMK()Calculate the length of a scale mile or scale kilometer.voidsetThrottles(int newThrottles)Set the new value for throttles.java.lang.StringtoString()voidvetoableChange(java.beans.PropertyChangeEvent evt)Listen for ratio changes to my current scale.
-
-
-
Field Detail
-
SCALE_RATIO
public static final java.lang.String SCALE_RATIO
- See Also:
- Constant Field Values
-
-
Method Detail
-
setScaleMK
public void setScaleMK()
Calculate the length of a scale mile or scale kilometer. The values are adjusted for scale and fast clock ratio. The resulting value is the real feet or meters. The final step is to re-calculate the train times.- Throws:
java.lang.IllegalArgumentException- The calculate can throw an exception which will get re-thrown.
-
getScaleMK
public double getScaleMK()
-
getLayoutId
public int getLayoutId()
-
getLayoutName
public java.lang.String getLayoutName()
-
setLayoutName
public void setLayoutName(java.lang.String newName)
-
getRatio
public double getRatio()
-
getFastClock
public int getFastClock()
-
setFastClock
public void setFastClock(int newClock)
Set a new fast clock speed, update smile/skm.- Parameters:
newClock- The value to be used.- Throws:
java.lang.IllegalArgumentException- (CLOCK_LT_1) if the value is less than 1. will also re-throw a recalc error.
-
getThrottles
public int getThrottles()
-
setThrottles
public void setThrottles(int newThrottles)
Set the new value for throttles.- Parameters:
newThrottles- The new throttle count.- Throws:
java.lang.IllegalArgumentException- (THROTTLES_USED, THROTTLES_LT_0) when the new count is less than train references or a negative number was passed.
-
getMetric
public boolean getMetric()
-
setMetric
public void setMetric(boolean newMetric)
Set metric flag, update smile/skm.- Parameters:
newMetric- True for metric units.- Throws:
java.lang.IllegalArgumentException- if there was a recalc error.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
vetoableChange
public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
Listen for ratio changes to my current scale. Verify that the new ratio is neither too small nor too large. Too large can cause train times to move outside of the schedule window. If the new ratio is invalid, the change will be vetoed.- Specified by:
vetoableChangein interfacejava.beans.VetoableChangeListener- Parameters:
evt- The scale ratio property change event.- Throws:
java.beans.PropertyVetoException- The message will depend on the actual error.
-
-