source: tmcsimulator/trunk/src/tmcsim/cadsimulator/videocontrol/DVDRange.java @ 2

Revision 2, 1.6 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.cadsimulator.videocontrol;
2
3
4/**
5 * DVDRange is a container class used within video control.  It contains a
6 * minimum and maximum speed range, an associated title number and duration for
7 * that title.  The DVDController uses the DVDRange to determine
8 * which DVD title is to be played according to current traffic speed.
9 *
10 * @author Matthew Cechini
11 * @version
12 */
13public class DVDRange {
14
15    /** Minimum speed for this range. */
16    public float minSpeed;
17
18    /** Maximum speed for this range. */
19    public float maxSpeed;
20
21    /** DVD title to play for this range. */
22    public int   dvdTitle;
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 title Title to play for range.
30     * @param duration Length (in seconds) of range title.
31     */
32    public DVDRange(float min, float max, int title) {
33        minSpeed      = min;
34        maxSpeed      = max;
35        dvdTitle      = title;
36    }
37
38    /**
39     * Tests if the parameter speed is >= the minimum speed and
40     * < the maximum speed for this range.
41     *
42     * @param speed Speed value to test for inclusion in range.
43     * @return True if the parameter is within the range, false if not.
44     */ 
45    public boolean isWithin(float speed) {
46        return speed >= minSpeed && speed < maxSpeed;
47    }               
48
49    public boolean equals(DVDRange range) {
50        return dvdTitle == range.dvdTitle &&
51               minSpeed == range.minSpeed &&
52               maxSpeed == range.maxSpeed;
53    }
54}
Note: See TracBrowser for help on using the repository browser.