File: Duration.java

package info (click to toggle)
gpsprune 26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,824 kB
  • sloc: java: 52,154; sh: 25; makefile: 21; python: 15
file content (27 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package tim.prune.function.comparesegments;

import tim.prune.gui.DisplayUtils;

/**
 * Defines a duration in the table, so that the presentation
 * is independent of the sort order
 */
class Duration implements Comparable<Duration>
{
	private final long _seconds;
	private final String _displayValue;

	public Duration(long inSeconds)
	{
		_seconds = inSeconds;
		_displayValue = DisplayUtils.buildDurationString(inSeconds);
	}

	public String toString() {
		return _displayValue;
	}

	public int compareTo(Duration inOther) {
		return Long.compare(_seconds, inOther._seconds);
	}
}