Java 类org.jfree.data.time.Hour 实例源码

项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Hour h = new Hour(15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623293200000L, h.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Hour h = new Hour(2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(955760400000L, h.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Hour h = new Hour(2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-614959200001L, h.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(987886799999L, h.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Hour h = new Hour(15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623293200000L, h.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Hour h = new Hour(2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(955760400000L, h.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Hour h = new Hour(2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-614959200001L, h.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(987886799999L, h.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:offspring    文件:OffspringChartComposite.java   
private IntervalXYDataset createVolumeDataset() {
  List<IRate> rates = rateProvider.getRates(base, quote);
  TimeSeries series = new TimeSeries("Volume");
  boolean non_zero_found = false;
  if (rates != null) {
    for (IRate rate : rates) {
      Date date = new Date(rate.getTimestamp());
      double vol = rate.getTotalVol();
      series.addOrUpdate(new Hour(date), vol);
      if (vol > 0)
        non_zero_found = true;
    }
  }
  if (non_zero_found == false)
    return null;

  TimeSeriesCollection dataset = new TimeSeriesCollection(series);
  dataset.setDomainIsPointsInTime(true);
  return dataset;
}
项目:astor    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Hour h = new Hour(15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623293200000L, h.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Hour h = new Hour(2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955764000000L, h.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Hour h = new Hour(2, 7, 7, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-614959200001L, h.getLastMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Hour h = new Hour(21, 21, 4, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(987890399999L, h.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:MillisecondTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    final Day day1 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour1 = new Hour(15, day1);
    final Minute minute1 = new Minute(15, hour1);
    final Second second1 = new Second(34, minute1);
    final Millisecond milli1 = new Millisecond(999, second1);
    final Day day2 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour2 = new Hour(15, day2);
    final Minute minute2 = new Minute(15, hour2);
    final Second second2 = new Second(34, minute2);
    final Millisecond milli2 = new Millisecond(999, second2);
    assertTrue(milli1.equals(milli2));
}
项目:parabuild-ci    文件:MinuteTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    final Day day1 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour1 = new Hour(15, day1);
    final Minute minute1 = new Minute(15, hour1);
    final Day day2 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour2 = new Hour(15, day2);
    final Minute minute2 = new Minute(15, hour2);
    assertTrue(minute1.equals(minute2));
}
项目:parabuild-ci    文件:SecondTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    final Day day1 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour1 = new Hour(15, day1);
    final Minute minute1 = new Minute(15, hour1);
    final Second second1 = new Second(34, minute1);
    final Day day2 = new Day(29, SerialDate.MARCH, 2002);
    final Hour hour2 = new Hour(15, day2);
    final Minute minute2 = new Minute(15, hour2);
    final Second second2 = new Second(34, minute2);
    assertTrue(second1.equals(second2));
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * In GMT, the 4pm on 21 Mar 2002 is java.util.Date(1,014,307,200,000L).  Use this to check the
 * hour constructor.
 */
public void testDateConstructor1() {

    final TimeZone zone = TimeZone.getTimeZone("GMT");
    final Hour h1 = new Hour(new Date(1014307199999L), zone);
    final Hour h2 = new Hour(new Date(1014307200000L), zone);

    assertEquals(15, h1.getHour());
    assertEquals(1014307199999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014307200000L, h2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * In Sydney, the 4pm on 21 Mar 2002 is java.util.Date(1,014,267,600,000L).
 * Use this to check the hour constructor.
 */
public void testDateConstructor2() {

    final TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    final Hour h1 = new Hour(new Date(1014267599999L), zone);
    final Hour h2 = new Hour (new Date(1014267600000L), zone);

    assertEquals(15, h1.getHour());
    assertEquals(1014267599999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014267600000L, h2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the previous hour, it should be
 * null.
 */
public void testFirstHourPrevious() {

    final Hour first = new Hour(0, new Day(1, SerialDate.JANUARY, 1900));
    final Hour previous = (Hour) first.previous();
    assertNull(previous);

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the next hour, it should be
 * null.
 */
public void testFirstHourNext() {

    final Hour first = new Hour(0, new Day(1, SerialDate.JANUARY, 1900));
    final Hour next = (Hour) first.next();
    assertEquals(1, next.getHour());
    assertEquals(1900, next.getYear());

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the previous hour, it should be
 * null.
 */
public void testLastHourPrevious() {

    final Hour last = new Hour(23, new Day(31, SerialDate.DECEMBER, 9999));
    final Hour previous = (Hour) last.previous();
    assertEquals(22, previous.getHour());
    assertEquals(9999, previous.getYear());

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the next hour, it should be
 * null.
 */
public void testLastHourNext() {

    final Hour last = new Hour(23, new Day(31, SerialDate.DECEMBER, 9999));
    final Hour next = (Hour) last.next();
    assertNull(next);

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Problem for date parsing.
 */
public void testParseHour() {

    // test 1...
    final Hour h = Hour.parseHour("2002-01-29 13");
    assertEquals(13, h.getHour());

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    final Hour h1 = new Hour(7, 9, 10, 1999);
    final Hour h2 = new Hour(7, 9, 10, 1999);
    assertTrue(h1.equals(h2));
    final int hash1 = h1.hashCode();
    final int hash2 = h2.hashCode();
    assertEquals(hash1, hash2);
}
项目:parabuild-ci    文件:MillisecondTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    Day day1 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour1 = new Hour(15, day1);
    Minute minute1 = new Minute(15, hour1);
    Second second1 = new Second(34, minute1);
    Millisecond milli1 = new Millisecond(999, second1);
    Day day2 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour2 = new Hour(15, day2);
    Minute minute2 = new Minute(15, hour2);
    Second second2 = new Second(34, minute2);
    Millisecond milli2 = new Millisecond(999, second2);
    assertTrue(milli1.equals(milli2));
}
项目:parabuild-ci    文件:MinuteTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    Day day1 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour1 = new Hour(15, day1);
    Minute minute1 = new Minute(15, hour1);
    Day day2 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour2 = new Hour(15, day2);
    Minute minute2 = new Minute(15, hour2);
    assertTrue(minute1.equals(minute2));
}
项目:parabuild-ci    文件:SecondTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    Day day1 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour1 = new Hour(15, day1);
    Minute minute1 = new Minute(15, hour1);
    Second second1 = new Second(34, minute1);
    Day day2 = new Day(29, MonthConstants.MARCH, 2002);
    Hour hour2 = new Hour(15, day2);
    Minute minute2 = new Minute(15, hour2);
    Second second2 = new Second(34, minute2);
    assertTrue(second1.equals(second2));
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * In GMT, the 4pm on 21 Mar 2002 is java.util.Date(1,014,307,200,000L).  
 * Use this to check the hour constructor.
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Hour h1 = new Hour(new Date(1014307199999L), zone);
    Hour h2 = new Hour(new Date(1014307200000L), zone);

    assertEquals(15, h1.getHour());
    assertEquals(1014307199999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014307200000L, h2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * In Sydney, the 4pm on 21 Mar 2002 is java.util.Date(1,014,267,600,000L).
 * Use this to check the hour constructor.
 */
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    Hour h1 = new Hour(new Date(1014267599999L), zone);
    Hour h2 = new Hour (new Date(1014267600000L), zone);

    assertEquals(15, h1.getHour());
    assertEquals(1014267599999L, h1.getLastMillisecond(zone));

    assertEquals(16, h2.getHour());
    assertEquals(1014267600000L, h2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the 
 * previous hour, it should be null.
 */
public void testFirstHourPrevious() {

    Hour first = new Hour(0, new Day(1, MonthConstants.JANUARY, 1900));
    Hour previous = (Hour) first.previous();
    assertNull(previous);

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the next 
 * hour, it should be null.
 */
public void testFirstHourNext() {
    Hour first = new Hour(0, new Day(1, MonthConstants.JANUARY, 1900));
    Hour next = (Hour) first.next();
    assertEquals(1, next.getHour());
    assertEquals(1900, next.getYear());
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the previous
 * hour, it should be null.
 */
public void testLastHourPrevious() {

    Hour last = new Hour(23, new Day(31, MonthConstants.DECEMBER, 9999));
    Hour previous = (Hour) last.previous();
    assertEquals(22, previous.getHour());
    assertEquals(9999, previous.getYear());

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Set up an hour equal to hour zero, 1 January 1900.  Request the next 
 * hour, it should be null.
 */
public void testLastHourNext() {

    Hour last = new Hour(23, new Day(31, MonthConstants.DECEMBER, 9999));
    Hour next = (Hour) last.next();
    assertNull(next);

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Problem for date parsing.
 */
public void testParseHour() {

    // test 1...
    Hour h = Hour.parseHour("2002-01-29 13");
    assertEquals(13, h.getHour());

}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    Hour h1 = new Hour(7, 9, 10, 1999);
    Hour h2 = new Hour(7, 9, 10, 1999);
    assertTrue(h1.equals(h2));
    int hash1 = h1.hashCode();
    int hash2 = h2.hashCode();
    assertEquals(hash1, hash2);
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getFirstMillisecond() method.
 */
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Hour h = new Hour(15, 1, 4, 2006);
    assertEquals(1143900000000L, h.getFirstMillisecond());
    Locale.setDefault(saved);
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getLastMillisecond() method.
 */
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Hour h = new Hour(1, 1, 1, 1970);
    assertEquals(3599999L, h.getLastMillisecond());
    Locale.setDefault(saved);
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getStart() method.
 */
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Hour h = new Hour(3, 16, 1, 2006);
    assertEquals(cal.getTime(), h.getStart());
    Locale.setDefault(saved);        
}
项目:parabuild-ci    文件:HourTests.java   
/**
 * Some checks for the getEnd() method.
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 8, 1, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Hour h = new Hour(1, 8, 1, 2006);
    assertEquals(cal.getTime(), h.getEnd());
    Locale.setDefault(saved);                
}
项目:jasperreports    文件:ConvertChartContext.java   
private XYDataset createTimePeriodDataset()
{
    if (sampleTimePeriodDataset == null)
    {
        TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();

        Day today = new Day();
        TimePeriodValues series1 = new TimePeriodValues("First");
        TimePeriodValues series2 = new TimePeriodValues("Second");

        for (int i = 0; i < 24; i++) 
        {
            Minute m0 = new Minute(0, new Hour(i, today));
            Minute m1 = new Minute(15, new Hour(i, today));
            Minute m2 = new Minute(30, new Hour(i, today));
            Minute m3 = new Minute(45, new Hour(i, today));
            Minute m4 = new Minute(0, new Hour(i + 1, today));
            series1.add(new SimpleTimePeriod(m0.getStart(), m1.getStart()), Math.random());
            series2.add(new SimpleTimePeriod(m1.getStart(), m2.getStart()), Math.random());
            series1.add(new SimpleTimePeriod(m2.getStart(), m3.getStart()), Math.random());
            series2.add(new SimpleTimePeriod(m3.getStart(), m4.getStart()), Math.random());
        }

        dataset.addSeries(series1);
        dataset.addSeries(series2);

        sampleTimePeriodDataset = dataset;
    }

    return sampleTimePeriodDataset;
}