Java Code Examples for org.jfree.chart.axis.SegmentedTimeline#getTime()
The following examples show how to use
org.jfree.chart.axis.SegmentedTimeline#getTime() .
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 | 5 votes |
/** * Adds an array of exceptions relative to the base timeline. * * @param timeline The timeline where the exceptions will be stored * @param exceptionString The exceptions to load * @param fmt The date formatter to use to parse each exceptions[i] value * @throws ParseException If there is any exception parsing each * exceptions[i] value. */ private void fillInBaseTimelineExceptions(SegmentedTimeline timeline, String[] exceptionString, Format fmt) throws ParseException { SegmentedTimeline baseTimeline = timeline.getBaseTimeline(); for (int i = 0; i < exceptionString.length; i++) { long e; if (fmt instanceof NumberFormat) { e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue(); } else { e = timeline.getTime(((SimpleDateFormat) fmt) .parse(exceptionString[i])); } timeline.addBaseTimelineException(e); // verify all timeline segments included in the // baseTimeline.segment are now exceptions SegmentedTimeline.Segment segment1 = baseTimeline.getSegment(e); for (SegmentedTimeline.Segment segment2 = timeline.getSegment(segment1.getSegmentStart()); segment2.getSegmentStart() <= segment1.getSegmentEnd(); segment2.inc()) { if (!segment2.inExcludeSegments()) { assertTrue(segment2.inExceptionSegments()); } } } }
Example 2
Source File: SegmentedTimelineTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Adds an array of exceptions relative to the base timeline. * * @param timeline The timeline where the exceptions will be stored * @param exceptionString The exceptions to load * @param fmt The date formatter to use to parse each exceptions[i] value * @throws ParseException If there is any exception parsing each * exceptions[i] value. */ private void fillInBaseTimelineExceptions(SegmentedTimeline timeline, String[] exceptionString, Format fmt) throws ParseException { SegmentedTimeline baseTimeline = timeline.getBaseTimeline(); for (int i = 0; i < exceptionString.length; i++) { long e; if (fmt instanceof NumberFormat) { e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue(); } else { e = timeline.getTime(((SimpleDateFormat) fmt) .parse(exceptionString[i])); } timeline.addBaseTimelineException(e); // verify all timeline segments included in the // baseTimeline.segment are now exceptions SegmentedTimeline.Segment segment1 = baseTimeline.getSegment(e); for (SegmentedTimeline.Segment segment2 = timeline.getSegment(segment1.getSegmentStart()); segment2.getSegmentStart() <= segment1.getSegmentEnd(); segment2.inc()) { if (!segment2.inExcludeSegments()) { assertTrue(segment2.inExceptionSegments()); } } } }