| Revision 2,
1.4 KB
checked in by jdalbey, 10 years ago
(diff) |
|
Initial Import of project files
|
| Line | |
|---|
| 1 | package tmcsim.cadsimulator.stillimagecontrol; |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * ImageRange is a container class used within the CAD still image control. |
|---|
| 5 | * It contains a minimum and maximum speed range and an associated image |
|---|
| 6 | * file name to be shown. The ImageController class uses the ImageRange |
|---|
| 7 | * to determine which image is to be shown on the ATMS according to |
|---|
| 8 | * current traffic speed. |
|---|
| 9 | * |
|---|
| 10 | * @author Matthew Cechini |
|---|
| 11 | * @version |
|---|
| 12 | */ |
|---|
| 13 | public class ImageRange { |
|---|
| 14 | |
|---|
| 15 | /** Minimum speed for this range. */ |
|---|
| 16 | public float minSpeed; |
|---|
| 17 | |
|---|
| 18 | /** Maximum speed for this range. */ |
|---|
| 19 | public float maxSpeed; |
|---|
| 20 | |
|---|
| 21 | /** Filename of the image to be shown for this range. */ |
|---|
| 22 | public String fileName; |
|---|
| 23 | |
|---|
| 24 | /** |
|---|
| 25 | * Constructor. Initialize member data with parameter values. |
|---|
| 26 | * |
|---|
| 27 | * @param min Minimum speed in range. |
|---|
| 28 | * @param max Maximum speed in range. |
|---|
| 29 | * @param file Filename if associated image file. |
|---|
| 30 | */ |
|---|
| 31 | public ImageRange(float min, float max, String file) { |
|---|
| 32 | minSpeed = min; |
|---|
| 33 | maxSpeed = max; |
|---|
| 34 | fileName = file; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | * Tests if the parameter speed is >= the minimum speed and |
|---|
| 39 | * < the maximum speed for this range. |
|---|
| 40 | * |
|---|
| 41 | * @param speed Speed value to test for inclusion in range. |
|---|
| 42 | * @return True if the parameter is within the range, false if not. |
|---|
| 43 | */ |
|---|
| 44 | public boolean isWithin(float speed) { |
|---|
| 45 | return speed >= minSpeed && speed < maxSpeed; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.