Java Doc for AbstractInterval.java in  » Development » Joda-Time » org » joda » time » base » 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.base 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.joda.time.base.AbstractInterval

All known Subclasses:   org.joda.time.base.BaseInterval,
AbstractInterval
abstract public class AbstractInterval implements ReadableInterval(Code)
AbstractInterval provides the common behaviour for time intervals.

This class should generally not be used directly by API users. The ReadableInterval interface should be used when different kinds of intervals are to be referenced.

AbstractInterval subclasses may be mutable and not thread-safe.
author:
   Brian S O'Neill
author:
   Stephen Colebourne
since:
   1.0




Constructor Summary
protected  AbstractInterval()
     Constructor.

Method Summary
protected  voidcheckInterval(long start, long end)
     Validates an interval.
public  booleancontains(long millisInstant)
     Does this time interval contain the specified millisecond instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end.

public  booleancontains(ReadableInstant instant)
     Does this time interval contain the specified instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end.

public  booleancontains(ReadableInterval interval)
     Does this time interval contain the specified time interval.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end.

public  booleancontainsNow()
     Does this time interval contain the current instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end.

public  booleanequals(Object readableInterval)
     Compares this object with the specified object for equality based on start and end millis plus the chronology.
public  DateTimegetEnd()
     Gets the end of this time interval, which is exclusive, as a DateTime.
public  DateTimegetStart()
     Gets the start of this time interval, which is inclusive, as a DateTime.
public  inthashCode()
     Hashcode compatible with equals method.
public  booleanisAfter(long millisInstant)
     Is this time interval after the specified millisecond instant.
public  booleanisAfter(ReadableInstant instant)
     Is this time interval after the specified instant.
public  booleanisAfter(ReadableInterval interval)
     Is this time interval entirely after the specified interval.
public  booleanisAfterNow()
     Is this time interval after the current instant.
public  booleanisBefore(long millisInstant)
     Is this time interval before the specified millisecond instant.
public  booleanisBefore(ReadableInstant instant)
     Is this time interval before the specified instant.
public  booleanisBefore(ReadableInterval interval)
     Is this time interval entirely before the specified instant.
public  booleanisBeforeNow()
     Is this time interval before the current instant.
public  booleanoverlaps(ReadableInterval interval)
     Does this time interval overlap the specified time 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  DurationtoDuration()
     Gets the duration of this time interval.
public  longtoDurationMillis()
     Gets the duration of this time interval in milliseconds.
public  IntervaltoInterval()
     Get this interval as an immutable Interval object.
public  MutableIntervaltoMutableInterval()
     Get this time interval as a MutableInterval.
public  PeriodtoPeriod()
     Converts the duration of the interval to a Period using the All period type.
public  PeriodtoPeriod(PeriodType type)
     Converts the duration of the interval to a Period using the specified period type.
public  StringtoString()
     Output a string in ISO8601 interval format.


Constructor Detail
AbstractInterval
protected AbstractInterval()(Code)
Constructor.




Method Detail
checkInterval
protected void checkInterval(long start, long end)(Code)
Validates an interval.
Parameters:
  start - the start instant in milliseconds
Parameters:
  end - the end instant in milliseconds
throws:
  IllegalArgumentException - if the interval is invalid



contains
public boolean contains(long millisInstant)(Code)
Does this time interval contain the specified millisecond instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end. A zero duration interval cannot contain anything.
Parameters:
  millisInstant - the instant to compare to,millisecond instant from 1970-01-01T00:00:00Z true if this time interval contains the millisecond




contains
public boolean contains(ReadableInstant instant)(Code)
Does this time interval contain the specified instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end. A zero duration interval cannot contain anything.

For example:

 [09:00 to 10:00) contains 08:59  = false (before start)
 [09:00 to 10:00) contains 09:00  = true
 [09:00 to 10:00) contains 09:59  = true
 [09:00 to 10:00) contains 10:00  = false (equals end)
 [09:00 to 10:00) contains 10:01  = false (after end)
 [14:00 to 14:00) contains 14:00  = false (zero duration contains nothing)
 
Passing in a null parameter will have the same effect as calling AbstractInterval.containsNow() .
Parameters:
  instant - the instant, null means now true if this time interval contains the instant



contains
public boolean contains(ReadableInterval interval)(Code)
Does this time interval contain the specified time interval.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end. The other interval is contained if this interval wholly contains, starts, finishes or equals it. A zero duration interval cannot contain anything.

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 contains method is not related to these states. In particular, a zero duration interval is contained at the start of a larger interval, but does not overlap (it abuts instead).

For example:

 [09:00 to 10:00) contains [09:00 to 10:00)  = true
 [09:00 to 10:00) contains [09:00 to 09:30)  = true
 [09:00 to 10:00) contains [09:30 to 10:00)  = true
 [09:00 to 10:00) contains [09:15 to 09:45)  = true
 [09:00 to 10:00) contains [09:00 to 09:00)  = true
 [09:00 to 10:00) contains [08:59 to 10:00)  = false (otherStart before thisStart)
 [09:00 to 10:00) contains [09:00 to 10:01)  = false (otherEnd after thisEnd)
 [09:00 to 10:00) contains [10:00 to 10:00)  = false (otherStart equals thisEnd)
 [14:00 to 14:00) contains [14:00 to 14:00)  = false (zero duration contains nothing)
 
Passing in a null parameter will have the same effect as calling AbstractInterval.containsNow() .
Parameters:
  interval - the time interval to compare to, null means a zero duration interval now true if this time interval contains the time interval



containsNow
public boolean containsNow()(Code)
Does this time interval contain the current instant.

Non-zero duration intervals are inclusive of the start instant and exclusive of the end. A zero duration interval cannot contain anything. true if this time interval contains the current instant




equals
public boolean equals(Object readableInterval)(Code)
Compares this object with the specified object for equality based on start and end millis plus the chronology. All ReadableInterval instances are accepted.

To compare the duration of two time intervals, use AbstractInterval.toDuration() to get the durations and compare those.
Parameters:
  readableInterval - a readable interval to check against true if the start and end millis are equal




getEnd
public DateTime getEnd()(Code)
Gets the end of this time interval, which is exclusive, as a DateTime. the end of the time interval



getStart
public DateTime getStart()(Code)
Gets the start of this time interval, which is inclusive, as a DateTime. the start of the time interval



hashCode
public int hashCode()(Code)
Hashcode compatible with equals method. suitable hashcode



isAfter
public boolean isAfter(long millisInstant)(Code)
Is this time interval after the specified millisecond instant.

Intervals are inclusive of the start instant and exclusive of the end.
Parameters:
  millisInstant - the instant to compare to,millisecond instant from 1970-01-01T00:00:00Z true if this time interval is after the instant




isAfter
public boolean isAfter(ReadableInstant instant)(Code)
Is this time interval after the specified instant.

Intervals are inclusive of the start instant and exclusive of the end.
Parameters:
  instant - the instant to compare to, null means now true if this time interval is after the instant




isAfter
public boolean isAfter(ReadableInterval interval)(Code)
Is this time interval entirely after the specified interval.

Intervals are inclusive of the start instant and exclusive of the end. Only the end time of the specified interval is used in the comparison.
Parameters:
  interval - the interval to compare to, null means now true if this time interval is after the interval specified




isAfterNow
public boolean isAfterNow()(Code)
Is this time interval after the current instant.

Intervals are inclusive of the start instant and exclusive of the end. true if this time interval is after the current instant




isBefore
public boolean isBefore(long millisInstant)(Code)
Is this time interval before the specified millisecond instant.

Intervals are inclusive of the start instant and exclusive of the end.
Parameters:
  millisInstant - the instant to compare to,millisecond instant from 1970-01-01T00:00:00Z true if this time interval is before the instant




isBefore
public boolean isBefore(ReadableInstant instant)(Code)
Is this time interval before the specified instant.

Intervals are inclusive of the start instant and exclusive of the end.
Parameters:
  instant - the instant to compare to, null means now true if this time interval is before the instant




isBefore
public boolean isBefore(ReadableInterval interval)(Code)
Is this time interval entirely before the specified instant.

Intervals are inclusive of the start instant and exclusive of the end.
Parameters:
  interval - the interval to compare to, null means now true if this time interval is before the interval specified




isBeforeNow
public boolean isBeforeNow()(Code)
Is this time interval before the current instant.

Intervals are inclusive of the start instant and exclusive of the end. true if this time interval is before the current instant




overlaps
public boolean overlaps(ReadableInterval interval)(Code)
Does this time interval overlap the specified time 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.

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) overlaps [08:00 to 08:30)  = false (completely before)
 [09:00 to 10:00) overlaps [08:00 to 09:00)  = false (abuts before)
 [09:00 to 10:00) overlaps [08:00 to 09:30)  = true
 [09:00 to 10:00) overlaps [08:00 to 10:00)  = true
 [09:00 to 10:00) overlaps [08:00 to 11:00)  = true
 [09:00 to 10:00) overlaps [09:00 to 09:00)  = false (abuts before)
 [09:00 to 10:00) overlaps [09:00 to 09:30)  = true
 [09:00 to 10:00) overlaps [09:00 to 10:00)  = true
 [09:00 to 10:00) overlaps [09:00 to 11:00)  = true
 [09:00 to 10:00) overlaps [09:30 to 09:30)  = true
 [09:00 to 10:00) overlaps [09:30 to 10:00)  = true
 [09:00 to 10:00) overlaps [09:30 to 11:00)  = true
 [09:00 to 10:00) overlaps [10:00 to 10:00)  = false (abuts after)
 [09:00 to 10:00) overlaps [10:00 to 11:00)  = false (abuts after)
 [09:00 to 10:00) overlaps [10:30 to 11:00)  = false (completely after)
 [14:00 to 14:00) overlaps [14:00 to 14:00)  = false (abuts before and after)
 [14:00 to 14:00) overlaps [13:00 to 15:00)  = true
 

Parameters:
  interval - the time interval to compare to, null means a zero length interval now true if the time intervals overlap



toDuration
public Duration toDuration()(Code)
Gets the duration of this time interval.

The duration is equal to the end millis minus the start millis. the duration of the time interval
throws:
  ArithmeticException - if the duration exceeds the capacity of a long




toDurationMillis
public long toDurationMillis()(Code)
Gets the duration of this time interval in milliseconds.

The duration is equal to the end millis minus the start millis. the duration of the time interval in milliseconds
throws:
  ArithmeticException - if the duration exceeds the capacity of a long




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



toMutableInterval
public MutableInterval toMutableInterval()(Code)
Get this time interval as a MutableInterval.

This will always return a new MutableInterval with the same interval. the time interval as a MutableInterval object




toPeriod
public Period toPeriod()(Code)
Converts the duration of the interval to a Period using the All period type.

This method should be used to exract the field values describing the difference between the start and end instants. a time period derived from the interval




toPeriod
public Period toPeriod(PeriodType type)(Code)
Converts the duration of the interval to a Period using the specified period type.

This method should be used to exract the field values describing the difference between the start and end instants.
Parameters:
  type - the requested type of the duration, null means AllType a time period derived from the interval




toString
public String toString()(Code)
Output a string in ISO8601 interval format. re-parsable string



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.