Examples of SegmentedTimeline


Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 1);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = this.getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = this.getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
       
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = getTimeline();     

        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date date = cal.getTime();
        Log.info("date = " + date + "[" + date.getTime() + "]");                 
                 
        SegmentedTimeline timeline = getTimeline();     
     
        // Add exception in included segments
        cal.set(Calendar.YEAR, 2004);
        cal.set(Calendar.MONTH, Calendar.MARCH);
        cal.set(Calendar.DAY_OF_MONTH, 29);
        cal.set(Calendar.HOUR_OF_DAY, 9);
        cal.set(Calendar.MINUTE, 15);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        timeline.addException(cal.getTime());
           
        long value = timeline.toTimelineValue(date);  
        Log.info("value = " + value);
     
        long ms = timeline.toMillisecond(value);
        Log.info("ms = " + ms);
     
        Calendar cal2 = Calendar.getInstance(Locale.UK);
        cal2.setTime(new Date(ms));
        Date reverted = cal2.getTime();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        cal.set(Calendar.MINUTE, 30);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        Date close = cal.getTime();
                       
        SegmentedTimeline result = null;     
        // Create a segmented time line (segment size : 15 minutes)
        long quarterHourCount = (close.getTime() - open.getTime())
            / SegmentedTimeline.FIFTEEN_MINUTE_SEGMENT_SIZE;
        long totalQuarterHourCount = SegmentedTimeline.DAY_SEGMENT_SIZE
            / SegmentedTimeline.FIFTEEN_MINUTE_SEGMENT_SIZE;
        result = new SegmentedTimeline(
            SegmentedTimeline.FIFTEEN_MINUTE_SEGMENT_SIZE,
            (int) quarterHourCount, (int) (totalQuarterHourCount - quarterHourCount
        );
        result.setAdjustForDaylightSaving(true);
        // Set start time
        result.setStartTime(start.getTime());
        // Saturday and Sundays are non business hours
        result.setBaseTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
        /* PUT exclusions in test */
        if (start != null && end != null) {
            result.addBaseTimelineExclusions(start.getTime(), end.getTime());
        }
         
        return result;  
    }
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

        // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...
        //  \_________  ________/            \_/
        //            \/                      |
        //       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();
View Full Code Here

Examples of org.jfree.chart.axis.SegmentedTimeline

    /**
     * Tests serialization of an instance.
     * @param a1 The timeline to verify the serialization
     */
    private void verifySerialization(SegmentedTimeline a1) {
        SegmentedTimeline a2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(a1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.