本文整理汇总了Java中org.jfree.data.time.Quarter类的典型用法代码示例。如果您正苦于以下问题:Java Quarter类的具体用法?Java Quarter怎么用?Java Quarter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Quarter类属于org.jfree.data.time包,在下文中一共展示了Quarter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Quarter q = new Quarter(2, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
assertEquals(-623347200000L, q.getFirstMillisecond(zone));
// try null calendar
boolean pass = false;
try {
q.getFirstMillisecond((TimeZone) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例2: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Quarter q = new Quarter(1, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
assertEquals(978307200000L, q.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
q.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例3: testGetLastMillisecondWithTimeZone
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithTimeZone() {
Quarter q = new Quarter(2, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
assertEquals(-615488400001L, q.getLastMillisecond(zone));
// try null calendar
boolean pass = false;
try {
q.getLastMillisecond((TimeZone) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例4: testGetLastMillisecondWithCalendar
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithCalendar() {
Quarter q = new Quarter(3, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
assertEquals(1001890799999L, q.getLastMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
q.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例5: testDateConstructor1
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* In GMT, the end of Q1 2002 is java.util.Date(1017619199999L). Use this
* to check the quarter constructor.
*/
public void testDateConstructor1() {
TimeZone zone = TimeZone.getTimeZone("GMT");
Calendar c = new GregorianCalendar(zone);
Quarter q1 = new Quarter(new Date(1017619199999L), zone,
Locale.getDefault());
Quarter q2 = new Quarter(new Date(1017619200000L), zone,
Locale.getDefault());
assertEquals(1, q1.getQuarter());
assertEquals(1017619199999L, q1.getLastMillisecond(c));
assertEquals(2, q2.getQuarter());
assertEquals(1017619200000L, q2.getFirstMillisecond(c));
}
示例6: testDateConstructor2
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L). Use
* this to check the quarter constructor.
*/
public void testDateConstructor2() {
TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
Calendar c = new GregorianCalendar(zone);
Quarter q1 = new Quarter(new Date(1017608399999L), zone,
Locale.getDefault());
Quarter q2 = new Quarter(new Date(1017608400000L), zone,
Locale.getDefault());
assertEquals(1, q1.getQuarter());
assertEquals(1017608399999L, q1.getLastMillisecond(c));
assertEquals(2, q2.getQuarter());
assertEquals(1017608400000L, q2.getFirstMillisecond(c));
}
示例7: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Quarter q = new Quarter(2, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = new GregorianCalendar(zone);
assertEquals(-623347200000L, q.getFirstMillisecond(c));
// try null calendar
boolean pass = false;
try {
q.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例8: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Quarter q = new Quarter(1, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
assertEquals(978307200000L, q.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
q.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例9: testGetLastMillisecondWithTimeZone
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithTimeZone() {
Quarter q = new Quarter(2, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = new GregorianCalendar(zone);
assertEquals(-615488400001L, q.getLastMillisecond(c));
// try null calendar
boolean pass = false;
try {
q.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例10: testGetLastMillisecondWithCalendar
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithCalendar() {
Quarter q = new Quarter(3, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
assertEquals(1001894399999L, q.getLastMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
q.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例11: testEquals
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
PeriodAxis a1 = new PeriodAxis("Test");
PeriodAxis a2 = new PeriodAxis("Test");
assertTrue(a1.equals(a2));
assertTrue(a2.equals(a1));
a1.setFirst(new Year(2000));
assertFalse(a1.equals(a2));
a2.setFirst(new Year(2000));
assertTrue(a1.equals(a2));
a1.setLast(new Year(2004));
assertFalse(a1.equals(a2));
a2.setLast(new Year(2004));
assertTrue(a1.equals(a2));
a1.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
assertFalse(a1.equals(a2));
a2.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
assertTrue(a1.equals(a2));
a1.setAutoRangeTimePeriodClass(Quarter.class);
assertFalse(a1.equals(a2));
a2.setAutoRangeTimePeriodClass(Quarter.class);
assertTrue(a1.equals(a2));
PeriodAxisLabelInfo info[] = new PeriodAxisLabelInfo[1];
info[0] = new PeriodAxisLabelInfo(Month.class, "MMM");
a1.setLabelInfo(info);
assertFalse(a1.equals(a2));
a2.setLabelInfo(info);
assertTrue(a1.equals(a2));
}
示例12: setUp
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Common test setup.
*/
protected void setUp() {
this.q1Y1900 = new Quarter(1, 1900);
this.q2Y1900 = new Quarter(2, 1900);
this.q3Y9999 = new Quarter(3, 9999);
this.q4Y9999 = new Quarter(4, 9999);
}
示例13: testDateConstructor1
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* In GMT, the end of Q1 2002 is java.util.Date(1017619199999L). Use this to check the
* quarter constructor.
*/
public void testDateConstructor1() {
final TimeZone zone = TimeZone.getTimeZone("GMT");
final Quarter q1 = new Quarter(new Date(1017619199999L), zone);
final Quarter q2 = new Quarter(new Date(1017619200000L), zone);
assertEquals(1, q1.getQuarter());
assertEquals(1017619199999L, q1.getLastMillisecond(zone));
assertEquals(2, q2.getQuarter());
assertEquals(1017619200000L, q2.getFirstMillisecond(zone));
}
示例14: testDateConstructor2
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L). Use this to check the
* quarter constructor.
*/
public void testDateConstructor2() {
final TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
final Quarter q1 = new Quarter(new Date(1017608399999L), zone);
final Quarter q2 = new Quarter(new Date(1017608400000L), zone);
assertEquals(1, q1.getQuarter());
assertEquals(1017608399999L, q1.getLastMillisecond(zone));
assertEquals(2, q2.getQuarter());
assertEquals(1017608400000L, q2.getFirstMillisecond(zone));
}
示例15: testHashcode
import org.jfree.data.time.Quarter; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
final Quarter q1 = new Quarter(2, 2003);
final Quarter q2 = new Quarter(2, 2003);
assertTrue(q1.equals(q2));
final int h1 = q1.hashCode();
final int h2 = q2.hashCode();
assertEquals(h1, h2);
}