|
Transportation Pattern A
[Previous]  [Next] 
|
![]() |
User Manual [Previous]  [Next] Transportation Pattern ATransportation systems for airlines, bus networks and train networks have many things in common. This is a high level pattern to capture one way of representing common features of those models. The pattern consists of traits representing
This is only one possible design for a transportation system, but it illustrates some possibilities. The two examples show how the design has been applied to create an airline system and a bus system. Experiment with the diagrams in UmpleOnline. You can use control-G and Control-E to switch layout; you can use control-R to toggle between viewing traits or collapsed classes. Transportation pattern code that is imported by specifying use lib:TransportationPatternA.ump
// This is a library of traits that can be used
// to build the core of transportation systems
use lib:AbstractionOccurrence.ump;
// A route such as a flight or bus route
trait Route <Stop> {
routeID; // generic ID for all runs on this route, e.g. bus route number the public sees
* -- * Stop;
}
// A run pattern at a particular time of day that
// is repeated on multiple days
trait RegularlyScheduledRun <Route, ScheduledStop> {
isA Abstraction;
runId; // e.g. a flight number / Bus systems tend to hide this from public
String plannedDaysOfWeek; // e.g. "135" for Mon, Wed, Fri
* -- 1 Route;
Boolean forwardDirection; // only relevent if routeID is same in both directions
1 -- * ScheduledStop; // contains the times of the stops in order; not all runs may stop at all stops on route.
}
// A stop on a particular regular run
trait ScheduledStop <Stop> {
* -- 1 Stop;
Time expectedArrivalTime; // null for departure only
Time expectedDepartureTime; // May be same as arrival time for busses. Null for arrival only
}
trait Stop {
stopName; // e.g. Airport, bus station etc.
}
// People can book on this for flights. It can be late or cancelled
trait ActualRun <RegularlyScheduledRun, Vehicle> {
isA Occurrence <Abstraction = RegularlyScheduledRun>;
Date runDate;
Boolean isCancelled;
* -- 1 Vehicle vehicleUsed;
}
// Specific plane, bus, etc.
trait Vehicle {
vehicleID;
}
Load the above code into UmpleOnline Example of use of the above transportation pattern for an airline
/* Example of using builtin Umple pattern files
*/
use lib:AbstractionOccurrence.ump;
use lib:TransportationPatternA.ump
// This shows how a general pattern for
// transportation can be adapted to
// describe an airline
class AirlineRoute {
isA Route <Stop = Airport>;
}
class RegularFlight {
isA RegularlyScheduledRun <
Route = AirlineRoute,
ScheduledStop = AirportStop
>;
}
class AirportStop {
isA ScheduledStop <Stop = Airport>;
}
class Airport {
isA Stop;
}
class SpecificFlight {
isA ActualRun <
RegularlyScheduledRun = RegularFlight,
Vehicle = Airplane
>;
}
class Airplane {
isA Vehicle;
}
Load the above code into UmpleOnline Example of use of the above transportation pattern for a bus system
/* Example of using builtin Umple pattern files
to create a bus system
*/
use lib:AbstractionOccurrence.ump;
use lib:TransportationPatternA.ump
// This shows how a general pattern for
// transportation can be adapted to
// describe a bus system
class BusRoute {
Integer routeNumber;
isA Route <Stop = BusStop>;
}
class RegularlyTimedBusRun {
isA RegularlyScheduledRun <
Route = BusRoute,
ScheduledStop = TimedStopAtBusStop
>;
}
class TimedStopAtBusStop {
isA ScheduledStop <Stop = BusStop>;
}
class BusStop {
isA Stop;
}
class BusRun {
isA ActualRun <
RegularlyScheduledRun = RegularlyTimedBusRun,
Vehicle = Bus
>;
}
class Bus {
isA Vehicle;
}
Load the above code into UmpleOnline |