com.azalient.apo.enums
Enum Signal

java.lang.Object
  extended by java.lang.Enum<Signal>
      extended by com.azalient.apo.enums.Signal
All Implemented Interfaces:
ITranslatable, Serializable, Comparable<Signal>

public enum Signal
extends Enum<Signal>
implements ITranslatable

A Signal describes the state of each Turn. A group can also be assigned a Signal, and all Turns having that Group as their Direct Group will have that Signal.


Enum Constant Summary
Barred
          Fixed-signal: barred turn (for example no right turn here, at any time)
Free
          Fixed-signal: free-flow = traffic making this turn does not need to slow down or check for conflicting traffic
GiveWay
          Fixed-signal: a "Give Way" sign
Green
          Variable-signal: green = traffic making this turn does not need to slow down or check for conflicting traffic
GreenStop
          Variable-signal: green, but stop for other traffic.
GreenYield
          Variable-signal: green, yield to opposing traffic = give way to other traffic streams.
Off
          Variable-signal: where a turning arrow can go off, this state is used to represent that.
Red
          Variable-signal: stop, do not proceed under any circumstances.
Stop
          Fixed-signal: a "Stop" sign
Yellow
          Variable-signal: yellow = prepare to stop, proceed only if safe (or, for most people, go faster now)
YellowFlashing
          Variable-signal: flashing yellow = give way to other traffic streams
Yield
          Fixed-signal: yield to other traffic - normally used when turning across an opposing traffic stream, yield to that stream
 
Field Summary
static int COLOUR_GREEN
          SP38 colour value for GREEN state (SP38/TRAFF states reversed, documented as 1)
static int COLOUR_OFF
          SP38 colour value for OFF state
static int COLOUR_RED
          SP38 colour value for RED state (SP38/TRAFF states reversed, documented as 1)
static int COLOUR_RED_YELLOW
          SP38 colour value for RED+YELLOW state
static int COLOUR_YELLOW
          SP38 colour value for YELLOW state
static int FLASHING_MASK
          SP38 colour mask for FLASHING (can be OR'd with other colours)
static Signal[] GroupStates
          An array of all possible states for groups
static Signal[] OffStates
          An array of all possible states for the "filter" state of a turn - if its primary group goes to off, what state should it be if its filter group is green?
static Signal[] Signalised
          An array of all possible states for variable signalised turns
static Signal[] Unsignalised
          An array of all possible states for fixed unsignalised turns
static Signal[] ZERO
           
 
Method Summary
 String abbreviation()
          Returns an abbreviation code for this Signal
 SignalColour colour()
          Return the equivalent colour value for the SP38 interface
 String description()
          Return a text description of the signal
 boolean hasPriorityOver(Signal that)
          Returns true if traffic controlled by 'this' Signal has priority over traffic controlled by 'that' signal, or false if equal or lower priority
 Icon icon()
          Return an icon that represents this signal state
 Image image()
          Return an image that represents this signal state
 int integerPriorityOver(Signal that)
          Returns +1 if traffic controlled by 'this' Signal has priority over traffic controlled by 'that' signal, -1 if lower priority and 0 if equal priority
static Signal intSP38colour(int colour)
          Convert from SP38 colour integer to Signal
static String intSP38colourStr(int colour)
          Convert from SP38 colour integer to Signal description
static Signal parseString(String s)
          Given a string, return the matching signal state, or null, if no match
static Signal parseString(String s, Signal fallback)
          Given a string, return the matching signal state, or the fallback state, if no match
 String qpName()
          Used for import/export to Q-Paramics format
 String toString()
           
 String toStringTranslated()
           
static Signal valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Signal[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 boolean variable()
          A variable signal is a traffic light signal
 boolean yield()
          This is true for signals that can cause blocking on an intersection, and those that use the yoeldAdvance field in a Stream
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Free

public static final Signal Free
Fixed-signal: free-flow = traffic making this turn does not need to slow down or check for conflicting traffic


Yield

public static final Signal Yield
Fixed-signal: yield to other traffic - normally used when turning across an opposing traffic stream, yield to that stream


GiveWay

public static final Signal GiveWay
Fixed-signal: a "Give Way" sign


Stop

public static final Signal Stop
Fixed-signal: a "Stop" sign


Barred

public static final Signal Barred
Fixed-signal: barred turn (for example no right turn here, at any time)


Green

public static final Signal Green
Variable-signal: green = traffic making this turn does not need to slow down or check for conflicting traffic


Yellow

public static final Signal Yellow
Variable-signal: yellow = prepare to stop, proceed only if safe (or, for most people, go faster now)


YellowFlashing

public static final Signal YellowFlashing
Variable-signal: flashing yellow = give way to other traffic streams


GreenYield

public static final Signal GreenYield
Variable-signal: green, yield to opposing traffic = give way to other traffic streams. This is used where traffic sees a green roundel, but must cross an opposing traffic stream


GreenStop

public static final Signal GreenStop
Variable-signal: green, but stop for other traffic. This is used where traffic can proceed cautiously, for example at turn-on-red signals


Red

public static final Signal Red
Variable-signal: stop, do not proceed under any circumstances. Turn on red is handled using GreenStop


Off

public static final Signal Off
Variable-signal: where a turning arrow can go off, this state is used to represent that. For example, a green arrow may be off, while a green roundel is on, to indicate that the turn (movement) is allowed, but must yield to opposing traffic

Field Detail

Unsignalised

public static Signal[] Unsignalised
An array of all possible states for fixed unsignalised turns


Signalised

public static Signal[] Signalised
An array of all possible states for variable signalised turns


GroupStates

public static Signal[] GroupStates
An array of all possible states for groups


OffStates

public static Signal[] OffStates
An array of all possible states for the "filter" state of a turn - if its primary group goes to off, what state should it be if its filter group is green?


ZERO

public static final Signal[] ZERO

COLOUR_OFF

public static final int COLOUR_OFF
SP38 colour value for OFF state

See Also:
Constant Field Values

COLOUR_RED

public static final int COLOUR_RED
SP38 colour value for RED state (SP38/TRAFF states reversed, documented as 1)

See Also:
Constant Field Values

COLOUR_YELLOW

public static final int COLOUR_YELLOW
SP38 colour value for YELLOW state

See Also:
Constant Field Values

COLOUR_GREEN

public static final int COLOUR_GREEN
SP38 colour value for GREEN state (SP38/TRAFF states reversed, documented as 1)

See Also:
Constant Field Values

COLOUR_RED_YELLOW

public static final int COLOUR_RED_YELLOW
SP38 colour value for RED+YELLOW state

See Also:
Constant Field Values

FLASHING_MASK

public static final int FLASHING_MASK
SP38 colour mask for FLASHING (can be OR'd with other colours)

See Also:
Constant Field Values
Method Detail

values

public static Signal[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Signal c : Signal.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Signal valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

description

public String description()
Return a text description of the signal


toString

public String toString()
Overrides:
toString in class Enum<Signal>

toStringTranslated

public String toStringTranslated()
Specified by:
toStringTranslated in interface ITranslatable

qpName

public String qpName()
Used for import/export to Q-Paramics format


colour

public SignalColour colour()
Return the equivalent colour value for the SP38 interface


variable

public boolean variable()
A variable signal is a traffic light signal


icon

public Icon icon()
Return an icon that represents this signal state


image

public Image image()
Return an image that represents this signal state


parseString

public static Signal parseString(String s)
Given a string, return the matching signal state, or null, if no match


parseString

public static Signal parseString(String s,
                                 Signal fallback)
Given a string, return the matching signal state, or the fallback state, if no match


intSP38colourStr

public static String intSP38colourStr(int colour)
Convert from SP38 colour integer to Signal description


intSP38colour

public static Signal intSP38colour(int colour)
Convert from SP38 colour integer to Signal


hasPriorityOver

public boolean hasPriorityOver(Signal that)
Returns true if traffic controlled by 'this' Signal has priority over traffic controlled by 'that' signal, or false if equal or lower priority


integerPriorityOver

public int integerPriorityOver(Signal that)
Returns +1 if traffic controlled by 'this' Signal has priority over traffic controlled by 'that' signal, -1 if lower priority and 0 if equal priority


yield

public boolean yield()
This is true for signals that can cause blocking on an intersection, and those that use the yoeldAdvance field in a Stream


abbreviation

public String abbreviation()
Returns an abbreviation code for this Signal