Package ptolemy.domains.metroII.kernel
Class EventTimeComparator
- java.lang.Object
-
- ptolemy.domains.metroII.kernel.EventTimeComparator
-
public class EventTimeComparator extends java.lang.Object
EventTimeComparator compares time tags of MetroII events.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Liangpeng Guo
- Pt.AcceptedRating:
- Red (glp)
- Pt.ProposedRating:
- Red (glp)
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EventTimeComparator()
EventTimeComparator is a singleton.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
compare(metroIIcomm.Event.Time time1, metroIIcomm.Event.Time time2)
Compare two timetags.static long
convert(long timeValue, double fromResolution, double toResolution)
Convert a time value from one resolution to another resolution.
-
-
-
Method Detail
-
convert
public static long convert(long timeValue, double fromResolution, double toResolution)
Convert a time value from one resolution to another resolution. Note that this method may result in a loss of precision.- Parameters:
timeValue
- input time value in type 'long'fromResolution
- the resolution associated with timeValuetoResolution
- the resolution it's converting to- Returns:
- the new time value.
-
compare
public static int compare(metroIIcomm.Event.Time time1, metroIIcomm.Event.Time time2)
Compare two timetags.- Parameters:
time1
- the first timetag to be comparedtime2
- the second timetag to be compared- Returns:
- a negative integer, zero, or a positive integer as the first timetag is less than, equal to, or greater than the second.
-
-