本文整理匯總了Java中org.jfree.data.time.Minute.getFirstMillisecond方法的典型用法代碼示例。如果您正苦於以下問題:Java Minute.getFirstMillisecond方法的具體用法?Java Minute.getFirstMillisecond怎麽用?Java Minute.getFirstMillisecond使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.data.time.Minute
的用法示例。
在下文中一共展示了Minute.getFirstMillisecond方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Minute m = new Minute(59, 15, 1, 4, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
assertEquals(-623289660000L, m.getFirstMillisecond(zone));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((TimeZone) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例2: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Minute m = new Minute(40, 2, 15, 4, 2000);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
assertEquals(955762800000L, m.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例3: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Minute m = new Minute(59, 15, 1, 4, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = new GregorianCalendar(zone);
assertEquals(-623289660000L, m.getFirstMillisecond(c));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例4: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Minute m = new Minute(40, 2, 15, 4, 2000);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
assertEquals(955766400000L, m.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例5: createChart
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
private static JFreeChart createChart(XYDataset xydataset) {
JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Flink Exactly-Once on Kafka with YARN Chaos Monkey", "Date", "Value", xydataset, true, true, false);
XYPlot xyplot = (XYPlot) jfreechart.getPlot();
XYLineAndShapeRenderer r0 = (XYLineAndShapeRenderer) xyplot.getRenderer(0);
// draw data points as points
r0.setSeriesShapesVisible(2, true);
r0.setSeriesLinesVisible(2, true);
// order elements as assed
xyplot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
Number first = xydataset.getX(0, 0);
Minute minute = new Minute(new Date((Long)first));
System.out.println("first = "+first);
RelativeDateFormat relativedateformat = new RelativeDateFormat(minute.getFirstMillisecond());
relativedateformat.setSecondFormatter(new DecimalFormat("00"));
dateaxis.setDateFormatOverride(relativedateformat);
//dateaxis.setDateFormatOverride(new SimpleDateFormat("mm:ss"));
ValueAxis valueaxis = xyplot.getRangeAxis();
valueaxis.setAutoRangeMinimumSize(1.0D);
valueaxis.setLabel("Elements/Core");
xyplot.getRenderer().setSeriesPaint(2, ChartColor.DARK_MAGENTA);
return jfreechart;
}
示例6: testBug25
import org.jfree.data.time.Minute; //導入方法依賴的package包/類
/**
* Test for bug #25 at Github.
*
* https://github.com/jfree/jfreechart/issues/25
*
*/
@Test
public void testBug25() {
TimeZone tz = TimeZone.getTimeZone("GMT");
GregorianCalendar cal = new GregorianCalendar(tz, Locale.UK);
MyDateAxis axis = new MyDateAxis("25");
axis.setTimeZone(tz);
// YEAR
DateTickUnit ydtu = new DateTickUnit(DateTickUnitType.YEAR, 5);
Year y = new Year(2015);
long ymillis = y.getFirstMillisecond(cal); // 1420070400000L
Date yprev = axis.previousStandardDate(new Date(ymillis), ydtu);
assertEquals(new Year(2010).getFirstMillisecond(cal), yprev.getTime());
// MONTH
DateTickUnit mdtu = new DateTickUnit(DateTickUnitType.MONTH, 3);
Month m = new Month(12, 2016);
long mmillis = m.getFirstMillisecond(cal);
Date mprev = axis.previousStandardDate(new Date(mmillis), mdtu);
assertEquals(new Month(9, 2016).getFirstMillisecond(cal),
mprev.getTime());
// DAY
DateTickUnit ddtu = new DateTickUnit(DateTickUnitType.DAY, 7);
Day d = new Day(14, 1, 2016);
long dmillis = d.getFirstMillisecond(cal);
Date dprev = axis.previousStandardDate(new Date(dmillis), ddtu);
assertEquals(new Day(7, 1, 2016).getFirstMillisecond(cal),
dprev.getTime());
// HOUR
DateTickUnit hdtu = new DateTickUnit(DateTickUnitType.HOUR, 6);
Hour h = new Hour(18, 24, 8, 2016);
long hmillis = h.getFirstMillisecond(cal);
Date hprev = axis.previousStandardDate(new Date(hmillis), hdtu);
assertEquals(new Hour(12, 24, 8, 2016).getFirstMillisecond(cal),
hprev.getTime());
// MINUTE
DateTickUnit mindtu = new DateTickUnit(DateTickUnitType.MINUTE, 5);
Minute min = new Minute(10, 12, 24, 8, 2016);
long minmillis = min.getFirstMillisecond(cal); // 1472040600000L GMT
Date minprev = axis.previousStandardDate(new Date(minmillis), mindtu);
assertEquals(1472040600000L - 5 * 60 * 1000L, minprev.getTime());
// SECOND
DateTickUnit sdtu = new DateTickUnit(DateTickUnitType.SECOND, 10);
Second s = new Second(50, 30, 18, 24, 8, 2016);
long smillis = s.getFirstMillisecond(cal);
Date sprev = axis.previousStandardDate(new Date(smillis), sdtu);
assertEquals(new Second(40, 30, 18, 24, 8, 2016)
.getFirstMillisecond(cal), sprev.getTime());
// MILLISECOND
DateTickUnit msdtu = new DateTickUnit(DateTickUnitType.MILLISECOND, 10);
Millisecond ms = new Millisecond(500, 50, 30, 18, 24, 8, 2016);
long msmillis = ms.getFirstMillisecond(cal);
Date msprev = axis.previousStandardDate(new Date(msmillis), msdtu);
assertEquals(new Millisecond(490, 50, 30, 18, 24, 8, 2016)
.getFirstMillisecond(cal), msprev.getTime());
}