Class MatrixSignalMast

All Implemented Interfaces:
VetoableChangeListener, Comparable<NamedBean>, EventListener, PropertyChangeProvider, NamedBean, Signal, SignalMast

SignalMast implemented via a Binary Matrix (Truth Table) of Apects x Turnout objects.

A MatrixSignalMast is built up from an array of turnouts to control each aspect. System name specifies the creation information (except for the actual output beans):

 IF$xsm:basic:one-searchlight:($0001)-3t
 
The name is a colon-separated series of terms:
  • IF$xsm - defines signal masts of this type (x for matriX)
  • basic - name of the signaling system
  • one-searchlight - name of the particular aspect map/mast model
  • ($0001) - small ordinal number for telling various matrix signal masts apart
  • name ending in -nt for (binary) Turnout outputs where n = the number of binary outputs, between 1 and mastBitNum i.e. -3t
  • Field Details

  • Constructor Details

  • Method Details

    • setBitsForAspect

      public void setBitsForAspect(String aspect, char[] bitArray)
      Store bits in aspectToOutput hashmap, synchronized.

      Length of bitArray should match the number of outputs defined, so one digit per output.

      Parameters:
      aspect - String valid aspect to define
      bitArray - char[] of on/off outputs for the aspect, like "00010"
    • getBitsForAspect

      public char[] getBitsForAspect(String aspect)
      Look up the pattern for an aspect.
      Parameters:
      aspect - String describing a (valid) signal mast aspect, like "Clear" only called for an already existing mast
      Returns:
      char[] of on/off outputs per aspect, like "00010" length of array should match the number of outputs defined when a mast is changed in the interface, extra 0's are added or superfluous elements deleted by the Add Mast panel
    • setAspect

      public void setAspect(@Nonnull String aspect)
      Description copied from interface: SignalMast
      Set aspect to a valid name in the current signal system definition.
      Specified by:
      setAspect in interface SignalMast
      Overrides:
      setAspect in class AbstractSignalMast
      Parameters:
      aspect - the new aspect shown
    • setLit

      public void setLit(boolean newLit)
      Description copied from class: AbstractSignalMast
      Set the lit property.

      This acts on all the SignalHeads included in this SignalMast

      Specified by:
      setLit in interface Signal
      Specified by:
      setLit in interface SignalMast
      Overrides:
      setLit in class AbstractSignalMast
      Parameters:
      newLit - the new value of lit
    • setUnLitBits

      public void setUnLitBits(@Nonnull char[] bits)
    • setUnLitBits

      public void setUnLitBits(@Nonnull String bitString)
      Receive unLitBits from xml and store.
      Parameters:
      bitString - String for 1-n 1/0 chararacters setting an unlit aspect
    • getUnLitBits

      @Nonnull public char[] getUnLitBits()
      Provide Unlit bits to panel for editing.
      Returns:
      char[] containing a series of 1's and 0's set for Unlit mast
    • getUnLitChars

      Hand unLitBits to xml.
      Returns:
      String for 1-n 1/0 chararacters setting an unlit aspect
    • getOutputHandle

      Fetch output from outputsToBeans hashmap. Used?
      Parameters:
      colNum - int index (1 up to mastBitNum) for the column of the desired output
      Returns:
      NamedBeanHandle to the configured turnout output
    • getOutputName

      @Nonnull public String getOutputName(int colnum)
      Fetch output from outputsToBeans hashmap and provide to xml.
      Parameters:
      colnum - int index (1 up to mastBitNum) for the column of the desired output
      Returns:
      String with the desplay name of the configured turnout output
      See Also:
    • setBitstring

      public void setBitstring(@Nonnull String aspect, @Nonnull String bitString)
      Receive aspect name from xml and store matching setting in outputsToBeans hashmap.
      Parameters:
      aspect - String describing (valid) signal mast aspect, like "Clear"
      bitString - String of 1/0 digits representing on/off outputs per aspect, like "00010"
      See Also:
    • setBitstring

      public void setBitstring(String aspect, char[] bitArray)
      Receive aspect name from xml and store matching setting in outputsToBeans hashmap.
      Parameters:
      aspect - String describing (valid) signal mast aspect, like "Clear"
      bitArray - char[] of 1/0 digits representing on/off outputs per aspect, like {0,0,0,1,0}
    • getBitstring

      Provide one series of on/off digits from aspectToOutput hashmap to xml.
      Parameters:
      aspect - String describing valid signal mast aspect, like "Clear"
      Returns:
      bitString String of 1 (= on) and 0 (= off) chars
    • getOutputs

      Provide the names of the on/off turnout outputs from outputsToBeans hashmap to xml.
      Returns:
      outputlist List<String> of display names for the outputs in order 1 to (max) mastBitNum
    • setOutput

      public void setOutput(@Nonnull String colname, @Nonnull String turnoutname)
      Receive properties from xml, convert name to NamedBeanHandle, store in hashmap outputsToBeans.
      Parameters:
      colname - String describing the name of the corresponding output, like "output1"
      turnoutname - String for the display name of the output, like "LT1"
    • updateOutputs

      public void updateOutputs(char[] bits)
      Send hardware instruction.
      Parameters:
      bits - char[] of on/off outputs per aspect, like "00010" Length of array should match the number of outputs defined
    • resetPreviousStates

      public void resetPreviousStates(boolean boo)
      If the signal mast driver requires the previous state to be cleared down before the next state is set.
      Parameters:
      boo - true to configure for intermediate reset step
    • resetPreviousStates

      public boolean resetPreviousStates()
    • isTurnoutUsed

      public boolean isTurnoutUsed(Turnout t)
    • getLastRef

      public static int getLastRef()
      Returns:
      highest ordinal of all MatrixSignalMasts in use
    • setLastRef

      protected static void setLastRef(int newVal)
      Parameters:
      newVal - for ordinal of all MatrixSignalMasts in use
    • vetoableChange

      Description copied from class: AbstractNamedBean
      Specified by:
      vetoableChange in interface NamedBean
      Specified by:
      vetoableChange in interface VetoableChangeListener
      Overrides:
      vetoableChange in class AbstractSignalMast
      Throws:
      PropertyVetoException
    • setBitNum

      public void setBitNum(int number)
      Store number of outputs from integer.
      Parameters:
      number - int for the number of outputs defined for this mast
      See Also:
      • mastBitNum
    • setBitNum

      public void setBitNum(char[] bits)
      Store number of outputs from integer.
      Parameters:
      bits - char[] for outputs defined for this mast
      See Also:
      • mastBitNum
    • getBitNum

      public int getBitNum()
    • setAspectDisabled

      public void setAspectDisabled(String aspect)
      Overrides:
      setAspectDisabled in class AbstractSignalMast
    • setMatrixMastCommandDelay

      public void setMatrixMastCommandDelay(int delay)
      Set the delay between issuing Matrix Output commands to the outputs on this specific mast. Mast Delay will be extended by a connection specific Output Delay set in the connection config.
      Parameters:
      delay - the new delay in milliseconds
      See Also:
    • getMatrixMastCommandDelay

      Get the delay between issuing Matrix Output commands to the outputs on this specific mast. Delay be extended by a connection specific Output Delay set in the connection config.
      Returns:
      the delay in milliseconds
      See Also: