Java Doc for Interval.java in  » Development » Joda-Time » org » joda » time » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Joda Time » org.joda.time 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.joda.time.base.BaseInterval
   org.joda.time.Interval

Interval
final public class Interval extends BaseInterval implements ReadableInterval,Serializable(Code)
Interval is the standard implementation of an immutable time interval.

A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant.

Intervals have a fixed millisecond duration. This is the difference between the start and end instants. The duration is represented separately by ReadableDuration . As a result, intervals are not comparable. To compare the length of two intervals, you should compare their durations.

An interval can also be converted to a ReadablePeriod . This represents the difference between the start and end points in terms of fields such as years and days.

Interval is thread-safe and immutable.
author:
   Brian S O'Neill
author:
   Sean Geoghegan
author:
   Stephen Colebourne
author:
   Julen Parra
since:
   1.0




Constructor Summary
public  Interval(long startInstant, long endInstant)
     Constructs an interval from a start and end instant with the ISO default chronology in the default time zone.
public  Interval(long startInstant, long endInstant, DateTimeZone zone)
     Constructs an interval from a start and end instant with the ISO default chronology in the specified time zone.
public  Interval(long startInstant, long endInstant, Chronology chronology)
     Constructs an interval from a start and end instant with the specified chronology.
public  Interval(ReadableInstant start, ReadableInstant end)
     Constructs an interval from a start and end instant.
public  Interval(ReadableInstant start, ReadableDuration duration)
     Constructs an interval from a start instant and a duration.
public  Interval(ReadableDuration duration, ReadableInstant end)
     Constructs an interval from a millisecond duration and an end instant.
public  Interval(ReadableInstant start, ReadablePeriod period)
     Constructs an interval from a start instant and a time period.
public  Interval(ReadablePeriod period, ReadableInstant end)
     Constructs an interval from a time period and an end instant.
public  Interval(Object interval)
     Constructs a time interval by converting or copying from another object.
public  Interval(Object interval, Chronology chronology)
     Constructs a time interval by converting or copying from another object, overriding the chronology.

Method Summary
public  booleanabuts(ReadableInterval interval)
     Does this interval abut with the interval specified.
public  Intervalgap(ReadableInterval interval)
     Gets the gap between this interval and another interval. The other interval can be either before or after this interval.

Intervals are inclusive of the start instant and exclusive of the end. An interval has a gap to another interval if there is a non-zero duration between them.

public  Intervaloverlap(ReadableInterval interval)
     Gets the overlap between this interval and another interval.

Intervals are inclusive of the start instant and exclusive of the end. An interval overlaps another if it shares some common part of the datetime continuum.

public  IntervaltoInterval()
     Get this interval as an immutable Interval object by returning this.
public  IntervalwithChronology(Chronology chronology)
     Creates a new interval with the same start and end, but a different chronology.
public  IntervalwithDurationAfterStart(ReadableDuration duration)
     Creates a new interval with the specified duration after the start instant.
public  IntervalwithDurationBeforeEnd(ReadableDuration duration)
     Creates a new interval with the specified duration before the end instant.
public  IntervalwithEnd(ReadableInstant end)
     Creates a new interval with the specified end instant.
public  IntervalwithEndMillis(long endInstant)
     Creates a new interval with the specified start millisecond instant.
public  IntervalwithPeriodAfterStart(ReadablePeriod period)
     Creates a new interval with the specified period after the start instant.
public  IntervalwithPeriodBeforeEnd(ReadablePeriod period)
     Creates a new interval with the specified period before the end instant.
public  IntervalwithStart(ReadableInstant start)
     Creates a new interval with the specified start instant.
public  IntervalwithStartMillis(long startInstant)
     Creates a new interval with the specified start millisecond instant.


Constructor Detail
Interval
public Interval(long startInstant, long endInstant)(Code)
Constructs an interval from a start and end instant with the ISO default chronology in the default time zone.
Parameters:
  startInstant - start of this interval, as milliseconds from 1970-01-01T00:00:00Z.
Parameters:
  endInstant - end of this interval, as milliseconds from 1970-01-01T00:00:00Z.
throws:
  IllegalArgumentException - if the end is before the start



Interval
public Interval(long startInstant, long endInstant, DateTimeZone zone)(Code)
Constructs an interval from a start and end instant with the ISO default chronology in the specified time zone.
Parameters:
  startInstant - start of this interval, as milliseconds from 1970-01-01T00:00:00Z.
Parameters:
  endInstant - end of this interval, as milliseconds from 1970-01-01T00:00:00Z.
Parameters:
  zone - the time zone to use, null means default zone
throws:
  IllegalArgumentException - if the end is before the start
since:
   1.5



Interval
public Interval(long startInstant, long endInstant, Chronology chronology)(Code)
Constructs an interval from a start and end instant with the specified chronology.
Parameters:
  chronology - the chronology to use, null is ISO default
Parameters:
  startInstant - start of this interval, as milliseconds from 1970-01-01T00:00:00Z.
Parameters:
  endInstant - end of this interval, as milliseconds from 1970-01-01T00:00:00Z.
throws:
  IllegalArgumentException - if the end is before the start



Interval
public Interval(ReadableInstant start, ReadableInstant end)(Code)
Constructs an interval from a start and end instant.

The chronology used is that of the start instant.
Parameters:
  start - start of this interval, null means now
Parameters:
  end - end of this interval, null means now
throws:
  IllegalArgumentException - if the end is before the start




Interval
public Interval(ReadableInstant start, ReadableDuration duration)(Code)
Constructs an interval from a start instant and a duration.
Parameters:
  start - start of this interval, null means now
Parameters:
  duration - the duration of this interval, null means zero length
throws:
  IllegalArgumentException - if the end is before the start
throws:
  ArithmeticException - if the end instant exceeds the capacity of a long



Interval
public Interval(ReadableDuration duration, ReadableInstant end)(Code)
Constructs an interval from a millisecond duration and an end instant.
Parameters:
  duration - the duration of this interval, null means zero length
Parameters:
  end - end of this interval, null means now
throws:
  IllegalArgumentException - if the end is before the start
throws:
  ArithmeticException - if the start instant exceeds the capacity of a long



Interval
public Interval(ReadableInstant start, ReadablePeriod period)(Code)
Constructs an interval from a start instant and a time period.

When forming the interval, the chronology from the instant is used if present, otherwise the chronology of the period is used.
Parameters:
  start - start of this interval, null means now
Parameters:
  period - the period of this interval, null means zero length
throws:
  IllegalArgumentException - if the end is before the start
throws:
  ArithmeticException - if the end instant exceeds the capacity of a long




Interval
public Interval(ReadablePeriod period, ReadableInstant end)(Code)
Constructs an interval from a time period and an end instant.

When forming the interval, the chronology from the instant is used if present, otherwise the chronology of the period is used.
Parameters:
  period - the period of this interval, null means zero length
Parameters:
  end - end of this interval, null means now
throws:
  IllegalArgumentException - if the end is before the start
throws:
  ArithmeticException - if the start instant exceeds the capacity of a long




Interval
public Interval(Object interval)(Code)
Constructs a time interval by converting or copying from another object.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadableInterval and String. The String formats are described by ISODateTimeFormat.dateTimeParser and ISOPeriodFormat.standard , and may be 'datetime/datetime', 'datetime/period' or 'period/datetime'.
Parameters:
  interval - the time interval to copy
throws:
  IllegalArgumentException - if the interval is invalid




Interval
public Interval(Object interval, Chronology chronology)(Code)
Constructs a time interval by converting or copying from another object, overriding the chronology.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadableInterval and String. The String formats are described by ISODateTimeFormat.dateTimeParser and ISOPeriodFormat.standard , and may be 'datetime/datetime', 'datetime/period' or 'period/datetime'.
Parameters:
  interval - the time interval to copy
Parameters:
  chronology - the chronology to use, null means ISO default
throws:
  IllegalArgumentException - if the interval is invalid





Method Detail
abuts
public boolean abuts(ReadableInterval interval)(Code)
Does this interval abut with the interval specified.

Intervals are inclusive of the start instant and exclusive of the end. An interval abuts if it starts immediately after, or ends immediately before this interval without overlap. A zero duration interval abuts with itself.

When two intervals are compared the result is one of three states: (a) they abut, (b) there is a gap between them, (c) they overlap. The abuts state takes precedence over the other two, thus a zero duration interval at the start of a larger interval abuts and does not overlap.

For example:

 [09:00 to 10:00) abuts [08:00 to 08:30)  = false (completely before)
 [09:00 to 10:00) abuts [08:00 to 09:00)  = true
 [09:00 to 10:00) abuts [08:00 to 09:01)  = false (overlaps)
 [09:00 to 10:00) abuts [09:00 to 09:00)  = true
 [09:00 to 10:00) abuts [09:00 to 09:01)  = false (overlaps)
 [09:00 to 10:00) abuts [10:00 to 10:00)  = true
 [09:00 to 10:00) abuts [10:00 to 10:30)  = true
 [09:00 to 10:00) abuts [10:30 to 11:00)  = false (completely after)
 [14:00 to 14:00) abuts [14:00 to 14:00)  = true
 [14:00 to 14:00) abuts [14:00 to 15:00)  = true
 [14:00 to 14:00) abuts [13:00 to 14:00)  = true
 

Parameters:
  interval - the interval to examine, null means now true if the interval abuts
since:
   1.1



gap
public Interval gap(ReadableInterval interval)(Code)
Gets the gap between this interval and another interval. The other interval can be either before or after this interval.

Intervals are inclusive of the start instant and exclusive of the end. An interval has a gap to another interval if there is a non-zero duration between them. This method returns the amount of the gap only if the intervals do actually have a gap between them. If the intervals overlap or abut, then null is returned.

When two intervals are compared the result is one of three states: (a) they abut, (b) there is a gap between them, (c) they overlap. The abuts state takes precedence over the other two, thus a zero duration interval at the start of a larger interval abuts and does not overlap.

The chronology of the returned interval is the same as that of this interval (the chronology of the interval parameter is not used). Note that the use of the chronology was only correctly implemented in version 1.3.
Parameters:
  interval - the interval to examine, null means now the gap interval, null if no gap
since:
   1.1




overlap
public Interval overlap(ReadableInterval interval)(Code)
Gets the overlap between this interval and another interval.

Intervals are inclusive of the start instant and exclusive of the end. An interval overlaps another if it shares some common part of the datetime continuum. This method returns the amount of the overlap, only if the intervals actually do overlap. If the intervals do not overlap, then null is returned.

When two intervals are compared the result is one of three states: (a) they abut, (b) there is a gap between them, (c) they overlap. The abuts state takes precedence over the other two, thus a zero duration interval at the start of a larger interval abuts and does not overlap.

The chronology of the returned interval is the same as that of this interval (the chronology of the interval parameter is not used). Note that the use of the chronology was only correctly implemented in version 1.3.
Parameters:
  interval - the interval to examine, null means now the overlap interval, null if no overlap
since:
   1.1




toInterval
public Interval toInterval()(Code)
Get this interval as an immutable Interval object by returning this. this



withChronology
public Interval withChronology(Chronology chronology)(Code)
Creates a new interval with the same start and end, but a different chronology.
Parameters:
  chronology - the chronology to use, null means ISO default an interval with a different chronology



withDurationAfterStart
public Interval withDurationAfterStart(ReadableDuration duration)(Code)
Creates a new interval with the specified duration after the start instant.
Parameters:
  duration - the duration to add to the start to get the new end instant, null means zero an interval with the start from this interval and a calculated end
throws:
  IllegalArgumentException - if the duration is negative



withDurationBeforeEnd
public Interval withDurationBeforeEnd(ReadableDuration duration)(Code)
Creates a new interval with the specified duration before the end instant.
Parameters:
  duration - the duration to add to the start to get the new end instant, null means zero an interval with the start from this interval and a calculated end
throws:
  IllegalArgumentException - if the duration is negative



withEnd
public Interval withEnd(ReadableInstant end)(Code)
Creates a new interval with the specified end instant.
Parameters:
  end - the end instant for the new interval, null means now an interval with the start from this interval and the specified end
throws:
  IllegalArgumentException - if the resulting interval has end before start



withEndMillis
public Interval withEndMillis(long endInstant)(Code)
Creates a new interval with the specified start millisecond instant.
Parameters:
  endInstant - the end instant for the new interval an interval with the start from this interval and the specified end
throws:
  IllegalArgumentException - if the resulting interval has end before start



withPeriodAfterStart
public Interval withPeriodAfterStart(ReadablePeriod period)(Code)
Creates a new interval with the specified period after the start instant.
Parameters:
  period - the period to add to the start to get the new end instant, null means zero an interval with the start from this interval and a calculated end
throws:
  IllegalArgumentException - if the period is negative



withPeriodBeforeEnd
public Interval withPeriodBeforeEnd(ReadablePeriod period)(Code)
Creates a new interval with the specified period before the end instant.
Parameters:
  period - the period to add to the start to get the new end instant, null means zero an interval with the start from this interval and a calculated end
throws:
  IllegalArgumentException - if the period is negative



withStart
public Interval withStart(ReadableInstant start)(Code)
Creates a new interval with the specified start instant.
Parameters:
  start - the start instant for the new interval, null means now an interval with the end from this interval and the specified start
throws:
  IllegalArgumentException - if the resulting interval has end before start



withStartMillis
public Interval withStartMillis(long startInstant)(Code)
Creates a new interval with the specified start millisecond instant.
Parameters:
  startInstant - the start instant for the new interval an interval with the end from this interval and the specified start
throws:
  IllegalArgumentException - if the resulting interval has end before start



Methods inherited from org.joda.time.base.BaseInterval
public Chronology getChronology()(Code)(Java Doc)
public long getEndMillis()(Code)(Java Doc)
public long getStartMillis()(Code)(Java Doc)
protected void setInterval(long startInstant, long endInstant, Chronology chrono)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.