List of usage examples for org.jfree.data.time Minute getMinute
public int getMinute()
From source file:playground.yu.utils.charts.TimeLineChart.java
public void addSeries(final String title, final double[] times, final double[] ys) { // final TimeTableXYDataset series = new TimeTableXYDataset(); for (int i = 0, n = Math.min(times.length, ys.length); i < n; i++) { final Hour hour = new Hour((int) times[i] / 3600, new Day()); final Minute min = new Minute((int) ((times[i] - hour.getHour() * 3600) / 60), hour); final Second sec = new Second((int) (times[i] - hour.getHour() * 3600 - min.getMinute() * 60), min); this.dataset.add(sec, ys[i], title); }// w w w . j a v a2s .co m // this.dataset.addSeries(series); }
From source file:playground.yu.utils.charts.TimeScatterChart.java
/** * Adds a new data series to the chart with the specified title. * <code>xs<code> and <code>ys</code> should have the same length. If not, * only as many items are shown as the shorter array contains. * //from ww w . jav a 2 s . c om * @param title * @param times * The time axle. * @param ys * The y values. */ public void addSeries(final String title, final double[] times, final double[] ys) { // final TimeTableXYDataset series = new TimeTableXYDataset(); for (int i = 0, n = Math.min(times.length, ys.length); i < n; i++) { final Hour hour = new Hour((int) times[i] / 3600, new Day()); final Minute min = new Minute((int) ((times[i] - hour.getHour() * 3600) / 60), hour); final Second sec = new Second((int) (times[i] - hour.getHour() * 3600 - min.getMinute() * 60), min); this.dataset.add(sec, ys[i], title); } // this.dataset.addSeries(series); }
From source file:org.jfree.data.time.MinuteTest.java
/** * In GMT, the 4.55pm on 21 Mar 2002 is java.util.Date(1016729700000L). * Use this to check the Minute constructor. *///from www .j a v a 2s . com @Test public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Locale locale = Locale.getDefault(); // locale should not matter here Minute m1 = new Minute(new Date(1016729699999L), zone, locale); Minute m2 = new Minute(new Date(1016729700000L), zone, locale); assertEquals(54, m1.getMinute()); assertEquals(1016729699999L, m1.getLastMillisecond(zone)); assertEquals(55, m2.getMinute()); assertEquals(1016729700000L, m2.getFirstMillisecond(zone)); }
From source file:org.jfree.data.time.MinuteTest.java
/** * In Singapore, the 4.55pm on 21 Mar 2002 is * java.util.Date(1,014,281,700,000L). Use this to check the Minute * constructor./*w w w.java 2 s . c o m*/ */ @Test public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Asia/Singapore"); Locale locale = Locale.getDefault(); // locale should not matter here Minute m1 = new Minute(new Date(1016700899999L), zone, locale); Minute m2 = new Minute(new Date(1016700900000L), zone, locale); assertEquals(54, m1.getMinute()); assertEquals(1016700899999L, m1.getLastMillisecond(zone)); assertEquals(55, m2.getMinute()); assertEquals(1016700900000L, m2.getFirstMillisecond(zone)); }
From source file:org.jfree.data.time.junit.MinuteTest.java
/** * In GMT, the 4.55pm on 21 Mar 2002 is java.util.Date(1016729700000L). * Use this to check the Minute constructor. *///from w w w .j ava2s . c o m public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Locale locale = Locale.getDefault(); // locale should not matter here Calendar c = new GregorianCalendar(zone); Minute m1 = new Minute(new Date(1016729699999L), zone, locale); Minute m2 = new Minute(new Date(1016729700000L), zone, locale); assertEquals(54, m1.getMinute()); assertEquals(1016729699999L, m1.getLastMillisecond(c)); assertEquals(55, m2.getMinute()); assertEquals(1016729700000L, m2.getFirstMillisecond(c)); }
From source file:org.jfree.data.time.junit.MinuteTest.java
/** * In Singapore, the 4.55pm on 21 Mar 2002 is * java.util.Date(1,014,281,700,000L). Use this to check the Minute * constructor./*w w w . j ava 2 s.c o m*/ */ public void testDateConstructor2() { TimeZone zone = TimeZone.getTimeZone("Asia/Singapore"); Locale locale = Locale.getDefault(); // locale should not matter here Calendar c = new GregorianCalendar(zone); Minute m1 = new Minute(new Date(1016700899999L), zone, locale); Minute m2 = new Minute(new Date(1016700900000L), zone, locale); assertEquals(54, m1.getMinute()); assertEquals(1016700899999L, m1.getLastMillisecond(c)); assertEquals(55, m2.getMinute()); assertEquals(1016700900000L, m2.getFirstMillisecond(c)); }
From source file:org.jfree.data.time.MinuteTest.java
/** * Some checks for the testNext() method. */// ww w . ja v a2 s. co m @Test public void testNext() { Minute m = new Minute(30, 1, 12, 12, 2000); m = (Minute) m.next(); assertEquals(2000, m.getHour().getYear()); assertEquals(12, m.getHour().getMonth()); assertEquals(12, m.getHour().getDayOfMonth()); assertEquals(1, m.getHour().getHour()); assertEquals(31, m.getMinute()); m = new Minute(59, 23, 31, 12, 9999); assertNull(m.next()); }
From source file:org.jfree.data.time.Second.java
/** * Constructs a new Second./*from w w w . j a v a2 s .c om*/ * * @param second the second (0 to 24*60*60-1). * @param minute the minute (<code>null</code> not permitted). */ public Second(int second, Minute minute) { ParamChecks.nullNotPermitted(minute, "minute"); this.day = minute.getDay(); this.hour = (byte) minute.getHourValue(); this.minute = (byte) minute.getMinute(); this.second = (byte) second; peg(Calendar.getInstance()); }
From source file:org.jfree.data.time.Minute.java
/** * Returns an integer indicating the order of this Minute object relative * to the specified object:/*w ww. j a va2 s. c om*/ * * negative == before, zero == same, positive == after. * * @param o1 object to compare. * * @return negative == before, zero == same, positive == after. */ @Override public int compareTo(Object o1) { int result; // CASE 1 : Comparing to another Minute object // ------------------------------------------- if (o1 instanceof Minute) { Minute m = (Minute) o1; result = getHour().compareTo(m.getHour()); if (result == 0) { result = this.minute - m.getMinute(); } } // CASE 2 : Comparing to another TimePeriod object // ----------------------------------------------- else if (o1 instanceof RegularTimePeriod) { // more difficult case - evaluate later... result = 0; } // CASE 3 : Comparing to a non-TimePeriod object // --------------------------------------------- else { // consider time periods to be ordered after general objects result = 1; } return result; }
From source file:org.jfree.data.time.junit.MinuteTest.java
/** * Some checks for the testNext() method. */// www.j a v a 2 s. c o m public void testNext() { Minute m = new Minute(30, 1, 12, 12, 2000); m = (Minute) m.next(); assertEquals(2000, m.getHour().getYear()); assertEquals(12, m.getHour().getMonth()); assertEquals(12, m.getHour().getDayOfMonth()); assertEquals(1, m.getHour().getHour()); assertEquals(31, m.getMinute()); m = new Minute(59, 23, 31, 12, 9999); assertNull(m.next()); }