File: DateForTable.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 (32 lines) | stat: -rw-r--r-- 671 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
28
29
30
31
32
package tim.prune.function.comparesegments;

import java.util.TimeZone;

import tim.prune.data.Timestamp;

class DateForTable implements Comparable<DateForTable>
{
	private final Timestamp _timestamp;
	private final String _asString;
	DateForTable(Timestamp inTimestamp, TimeZone inTimezone)
	{
		_timestamp = inTimestamp;
		_asString = inTimestamp.getDateText(inTimezone);
	}

	/** Comparison function for sorting */
	public int compareTo(DateForTable inOther)
	{
		if (_timestamp.isBefore(inOther._timestamp)) {
			return -1;
		}
		else if (_timestamp.isEqual(inOther._timestamp)) {
			return 0;
		}
		return 1;
	}

	public String toString() {
		return _asString;
	}
}