Java Code Examples for org.jfree.chart.axis.SegmentedTimeline#NO_DST_TIME_ZONE

The following examples show how to use org.jfree.chart.axis.SegmentedTimeline#NO_DST_TIME_ZONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SegmentedTimelineTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets up the fixture, for example, open a network connection.
 * This method is called before a test is executed.
 *
 * @throws Exception if there is a problem.
 */
protected void setUp() throws Exception {
    // setup our test timelines
    //
    // Legend for comments below:
    // <spaces> = Segments included in the final timeline
    // EE       = Excluded segments via timeline rules
    // xx       = Exception segments inherited from base timeline exclusions

    // 1-ms test timeline using 5 included and 2 excluded segments.
    //
    // timeline start time = 0
    //   |
    //   v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 ..
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+..
    // |  |  |  |  |  |EE|EE|  |  |  |  |  |EE|EE|  |  |  |  |  |  |EE|EE|    <-- msTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+..
    //  \_________  ________/            \_/
    //            \/                      |
    //       segment group         segment size = 1 ms
    //
    this.msTimeline = new SegmentedTimeline(1, 5, 2);
    this.msTimeline.setStartTime(0);

    // 4-ms test base timeline for ms2Timeline using 1 included and 1
    // excluded segments
    //
    // timeline start time = 0
    //   |
    //   v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |  |  |  |  |EE|EE|EE|EE|  |  |  |  |EE|EE|EE|EE|  |  |  |  |    <-- ms2BaseTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //  \__________  _________/            \____  _____/
    //             \/                           \/
    //        segment group              segment size = 4 ms
    //
    this.ms2BaseTimeline = new SegmentedTimeline(4, 1, 1);
    this.ms2BaseTimeline.setStartTime(0);

    // 1-ms test timeline (with a baseTimeline) using 2 included and 2
    // excluded segments centered inside each base segment
    //
    // The ms2Timeline without a base would look like this:
    //
    //    timeline start time = 1
    //      |
    //      v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|    <-- ms2Timeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //    \____  _____/            \_/
    //         \/                   |
    //    segment group      segment size = 1 ms
    //
    // With the base timeline some originally included segments are now
    // removed (see "xx" below):
    //
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |EE|  |  |EE|EE|xx|xx|EE|EE|  |  |EE|EE|xx|xx|EE|EE|  |  |EE|    <-- ms2Timeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |  |  |  |  |EE|EE|EE|EE|  |  |  |  |EE|EE|EE|EE|  |  |  |  |    <-- ms2BaseTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //
    this.ms2Timeline = new SegmentedTimeline(1, 2, 2);
    this.ms2Timeline.setStartTime(1);
    this.ms2Timeline.setBaseTimeline(this.ms2BaseTimeline);

    // test monday though friday timeline
    this.mondayFridayTimeline
            = SegmentedTimeline.newMondayThroughFridayTimeline();

    // test 9am-4pm Monday through Friday timeline
    this.fifteenMinTimeline
            = SegmentedTimeline.newFifteenMinuteTimeline();

    // find first Monday after 2001-01-01
    Calendar cal = new GregorianCalendar(
            SegmentedTimeline.NO_DST_TIME_ZONE);
    cal.set(2001, 0, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
        cal.add(Calendar.DATE, 1);
    }
    this.monday = (Calendar) cal.clone();

    // calculate 9am on the first Monday after 2001-01-01
    cal.add(Calendar.HOUR, 9);
    this.monday9am = (Calendar) cal.clone();
}
 
Example 2
Source File: SegmentedTimelineTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets up the fixture, for example, open a network connection.
 * This method is called before a test is executed.
 * 
 * @throws Exception if there is a problem.
 */
protected void setUp() throws Exception {
    // setup our test timelines
    //
    // Legend for comments below:
    // <spaces> = Segments included in the final timeline
    // EE       = Excluded segments via timeline rules
    // xx       = Exception segments inherited from base timeline exclusions

    // 1-ms test timeline using 5 included and 2 excluded segments.
    //
    // timeline start time = 0
    //   |
    //   v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 ..
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+..
    // |  |  |  |  |  |EE|EE|  |  |  |  |  |EE|EE|  |  |  |  |  |  |EE|EE|    <-- msTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+..
    //  \_________  ________/            \_/
    //            \/                      |
    //       segment group         segment size = 1 ms
    //
    this.msTimeline = new SegmentedTimeline(1, 5, 2);
    this.msTimeline.setStartTime(0);

    // 4-ms test base timeline for ms2Timeline using 1 included and 1
    // excluded segments
    //
    // timeline start time = 0
    //   |
    //   v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |  |  |  |  |EE|EE|EE|EE|  |  |  |  |EE|EE|EE|EE|  |  |  |  |    <-- ms2BaseTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //  \__________  _________/            \____  _____/
    //             \/                           \/
    //        segment group              segment size = 4 ms
    //
    this.ms2BaseTimeline = new SegmentedTimeline(4, 1, 1);
    this.ms2BaseTimeline.setStartTime(0);

    // 1-ms test timeline (with a baseTimeline) using 2 included and 2 
    // excluded segments centered inside each base segment
    //
    // The ms2Timeline without a base would look like this:
    //
    //    timeline start time = 1
    //      |
    //      v
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|EE|  |  |EE|    <-- ms2Timeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //    \____  _____/            \_/
    //         \/                   |
    //    segment group      segment size = 1 ms
    //
    // With the base timeline some originally included segments are now 
    // removed (see "xx" below):
    //
    //   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 ...
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |EE|  |  |EE|EE|xx|xx|EE|EE|  |  |EE|EE|xx|xx|EE|EE|  |  |EE|    <-- ms2Timeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    // |  |  |  |  |EE|EE|EE|EE|  |  |  |  |EE|EE|EE|EE|  |  |  |  |    <-- ms2BaseTimeline
    // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
    //
    this.ms2Timeline = new SegmentedTimeline(1, 2, 2);
    this.ms2Timeline.setStartTime(1);
    this.ms2Timeline.setBaseTimeline(this.ms2BaseTimeline);

    // test monday though friday timeline
    this.mondayFridayTimeline 
            = SegmentedTimeline.newMondayThroughFridayTimeline();

    // test 9am-4pm Monday through Friday timeline
    this.fifteenMinTimeline 
            = SegmentedTimeline.newFifteenMinuteTimeline();

    // find first Monday after 2001-01-01
    Calendar cal = new GregorianCalendar(
            SegmentedTimeline.NO_DST_TIME_ZONE);
    cal.set(2001, 0, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
        cal.add(Calendar.DATE, 1);
    }
    this.monday = (Calendar) cal.clone();

    // calculate 9am on the first Monday after 2001-01-01
    cal.add(Calendar.HOUR, 9);
    this.monday9am = (Calendar) cal.clone();
}