net.kolls.railworld.play.ra
Class SideOn

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by net.kolls.railworld.play.RailAccident
                  extended by net.kolls.railworld.play.ra.SideOn
All Implemented Interfaces:
java.io.Serializable

public class SideOn
extends RailAccident

A merging collision or overlap which occurs which two trains merge at a switch, cross at a four-way, or enter on top of each other.

Author:
Steve Kollmansberger
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.kolls.railworld.play.RailAccident
pos, t1, t2
 
Constructor Summary
SideOn(Train first, Train second, java.awt.geom.Point2D p)
          Create a side-on collision.
 
Method Summary
 java.lang.String midbody()
          The midbody of the report is the section that comes before the second train, if any, is described but after the first train is described.
 java.lang.String title()
          The title of this accident type
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SideOn

public SideOn(Train first,
              Train second,
              java.awt.geom.Point2D p)
Create a side-on collision. Simply calls super constructor.

Parameters:
first - First train
second - Second train
p - Location of accident
Method Detail

midbody

public java.lang.String midbody()
Description copied from class: RailAccident
The midbody of the report is the section that comes before the second train, if any, is described but after the first train is described. It is a sentence fragment like "collided head-on with a" (which becomes "A southbound 40-ton train collided head-on with a 30-ton train...") Do not end the phrase with a period or start with a capital. If you want the direction for the second train, you can insert {2d} into the string and that will be replaced by the second train direction.

Specified by:
midbody in class RailAccident
Returns:
midbody phrase

title

public java.lang.String title()
Description copied from class: RailAccident
The title of this accident type

Specified by:
title in class RailAccident
Returns:
Title based on kind of accident