net.kolls.railworld
Interface SignalProgram

All Superinterfaces:
SaveLoad
All Known Implementing Classes:
Green, Red, Yellow

public interface SignalProgram
extends SaveLoad

Describes the necessary operations to be a signal program (control a signal).

Author:
Steve Kollmansberger

Method Summary
 void enter(Train t)
          Called by the signal when a train enters the signal from the facing side only.
 javax.swing.Icon icon()
          For use by the signal chooser.
 void reacting(Train t)
          Indication that a train's controller is monitoring, responding to or waiting on the signal.
 java.awt.Color status()
          Indicate the current color of the signal.
 java.lang.String toString()
          Indicates the name of the program to display to the user as a tooltip.
 
Methods inherited from interface net.kolls.railworld.io.SaveLoad
load, newInstance, save
 

Method Detail

toString

java.lang.String toString()
Indicates the name of the program to display to the user as a tooltip.

Specified by:
toString in interface SaveLoad
Overrides:
toString in class java.lang.Object
Returns:
Information to display over signal and in chooser window.

enter

void enter(Train t)
Called by the signal when a train enters the signal from the facing side only. Train entering in the opposite direction will not cause notification. May be called arbitrarily often while the train is passing or stationary in the signal in the facing direction.

Parameters:
t - The Train entering the signal.

reacting

void reacting(Train t)
Indication that a train's controller is monitoring, responding to or waiting on the signal. This means the train is "in range" of the signal and could be influenced by it. Called by the controller arbitrarily often.

Parameters:
t - The Train monitoring/responding/waiting.

status

java.awt.Color status()
Indicate the current color of the signal. (Green = go, yellow = 5 MPH, red = stop). This is the displayed color and also what trains may respond to. Signal calls this to find out what color it should display.

Returns:
Current color

icon

javax.swing.Icon icon()
For use by the signal chooser.

Returns:
A 24x24 icon representing this signal program.