Example usage for org.jfree.data.time Second getSecond

List of usage examples for org.jfree.data.time Second getSecond

Introduction

In this page you can find the example usage for org.jfree.data.time Second getSecond.

Prototype

public int getSecond() 

Source Link

Document

Returns the second within the minute.

Usage

From source file:org.jfree.data.time.SecondTest.java

/**
 * In GMT, the 4.55:59pm on 21 Mar 2002 is java.util.Date(1016729759000L).
 * Use this to check the Second constructor.
 *//* w  w w . j  a v  a  2  s.c o  m*/
@Test
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016729758999L), zone, locale);
    Second s2 = new Second(new Date(1016729759000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016729758999L, s1.getLastMillisecond(zone));

    assertEquals(59, s2.getSecond());
    assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
}

From source file:org.jfree.data.time.SecondTest.java

/**
 * In Chicago, the 4.55:59pm on 21 Mar 2002 is
 * java.util.Date(1016751359000L). Use this to check the Second constructor.
 *///from w ww  .  j a  va2  s . com
@Test
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("America/Chicago");
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016751358999L), zone, locale);
    Second s2 = new Second(new Date(1016751359000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016751358999L, s1.getLastMillisecond(zone));

    assertEquals(59, s2.getSecond());
    assertEquals(1016751359000L, s2.getFirstMillisecond(zone));
}

From source file:org.jfree.data.time.Millisecond.java

/**
 * Constructs a millisecond./*from   w w  w .j a v a2 s  .c  o  m*/
 *
 * @param millisecond  the millisecond (0-999).
 * @param second  the second.
 */
public Millisecond(int millisecond, Second second) {
    this.millisecond = millisecond;
    this.second = (byte) second.getSecond();
    this.minute = (byte) second.getMinute().getMinute();
    this.hour = (byte) second.getMinute().getHourValue();
    this.day = second.getMinute().getDay();
    peg(Calendar.getInstance());
}

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * In Chicago, the 4.55:59pm on 21 Mar 2002 is
 * java.util.Date(1016751359000L). Use this to check the Second constructor.
 *//*  w ww . jav  a  2 s  .co  m*/
public void testDateConstructor2() {
    TimeZone zone = TimeZone.getTimeZone("America/Chicago");
    Calendar c = new GregorianCalendar(zone);
    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016751358999L), zone, locale);
    Second s2 = new Second(new Date(1016751359000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016751358999L, s1.getLastMillisecond(c));

    assertEquals(59, s2.getSecond());
    assertEquals(1016751359000L, s2.getFirstMillisecond(c));
}

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * In GMT, the 4.55:59pm on 21 Mar 2002 is java.util.Date(1016729759000L).
 * Use this to check the Second constructor.
 *///from w  w  w.  j  a va2s .c o  m
public void testDateConstructor1() {
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);

    Locale locale = Locale.getDefault(); // locale shouldn't matter here
    Second s1 = new Second(new Date(1016729758999L), zone, locale);
    Second s2 = new Second(new Date(1016729759000L), zone, locale);

    assertEquals(58, s1.getSecond());
    assertEquals(1016729758999L, s1.getLastMillisecond(c));

    assertEquals(59, s2.getSecond());
    assertEquals(1016729759000L, s2.getFirstMillisecond(c));
}

From source file:org.jfree.data.time.SecondTest.java

/**
 * Some checks for the testNext() method.
 *///from  www .  j  a va 2  s.c  om
@Test
public void testNext() {
    Second s = new Second(55, 30, 1, 12, 12, 2000);
    s = (Second) s.next();
    assertEquals(2000, s.getMinute().getHour().getYear());
    assertEquals(12, s.getMinute().getHour().getMonth());
    assertEquals(12, s.getMinute().getHour().getDayOfMonth());
    assertEquals(1, s.getMinute().getHour().getHour());
    assertEquals(30, s.getMinute().getMinute());
    assertEquals(56, s.getSecond());
    s = new Second(59, 59, 23, 31, 12, 9999);
    assertNull(s.next());
}

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * Some checks for the testNext() method.
 *//*  w  ww.  j av a2 s  .  c om*/
public void testNext() {
    Second s = new Second(55, 30, 1, 12, 12, 2000);
    s = (Second) s.next();
    assertEquals(2000, s.getMinute().getHour().getYear());
    assertEquals(12, s.getMinute().getHour().getMonth());
    assertEquals(12, s.getMinute().getHour().getDayOfMonth());
    assertEquals(1, s.getMinute().getHour().getHour());
    assertEquals(30, s.getMinute().getMinute());
    assertEquals(56, s.getSecond());
    s = new Second(59, 59, 23, 31, 12, 9999);
    assertNull(s.next());
}