Java Doc for ReadablePeriod.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.ReadablePeriod

All known Subclasses:   org.joda.time.base.BaseSingleFieldPeriod,  org.joda.time.Period,  org.joda.time.base.BasePeriod,  org.joda.time.base.AbstractPeriod,
ReadablePeriod
public interface ReadablePeriod (Code)
Defines a time period specified in terms of individual duration fields such as years and days.

The implementation of this interface may be mutable or immutable. This interface only gives access to retrieve data, never to change it.

Periods are split up into multiple fields, for example days and seconds. Implementations are not required to evenly distribute the values across the fields. The value for each field may be positive or negative.

When a time period is added to an instant, the effect is to add each field in turn. For example, a time period could be defined as 3 months, 2 days and -1 hours. In most circumstances this would be the same as 3 months, 1 day, and 23 hours. However, when adding across a daylight savings boundary, a day may be 23 or 25 hours long. Thus, the time period is always added field by field to the datetime.

Periods are independent of chronology, and can only be treated as durations when paired with a time via an interval.
See Also:   ReadableDuration
See Also:   ReadableInterval
author:
   Brian S O'Neill
author:
   Stephen Colebourne
since:
   1.0





Method Summary
 booleanequals(Object readablePeriod)
     Compares this object with the specified object for equality based on the value and type of each supported field. All ReadablePeriod instances are accepted.

Note that a period of 1 day is not equal to a period of 24 hours, nor is 1 hour equal to 60 minutes.

 intget(DurationFieldType field)
     Gets the value of one of the fields.
 DurationFieldTypegetFieldType(int index)
     Gets the field type at the specified index.
 PeriodTypegetPeriodType()
     Gets the period type that defines which fields are included in the period.
 intgetValue(int index)
     Gets the value at the specified index.
 inthashCode()
     Gets a hash code for the period that is compatible with the equals method.
 booleanisSupported(DurationFieldType field)
     Checks whether the field type specified is supported by this period.
 intsize()
     Gets the number of fields that this period supports.
 MutablePeriodtoMutablePeriod()
     Get this object as a MutablePeriod.
 PeriodtoPeriod()
     Get this period as an immutable Period object.
 StringtoString()
     Gets the value as a String in the style of the ISO8601 duration format.



Method Detail
equals
boolean equals(Object readablePeriod)(Code)
Compares this object with the specified object for equality based on the value and type of each supported field. All ReadablePeriod instances are accepted.

Note that a period of 1 day is not equal to a period of 24 hours, nor is 1 hour equal to 60 minutes. Only periods with the same amount in each field are equal.

This is because periods represent an abstracted definition of a time period (eg. a day may not actually be 24 hours, it might be 23 or 25 at daylight savings boundary).

To compare the actual duration of two periods, convert both to Duration s, an operation that emphasises that the result may differ according to the date you choose.
Parameters:
  readablePeriod - a readable period to check against true if all the field values and types are equal, false ifnot or the period is null or of an incorrect type




get
int get(DurationFieldType field)(Code)
Gets the value of one of the fields.

If the field type specified is not supported by the period then zero is returned.
Parameters:
  field - the field type to query, null returns zero the value of that field, zero if field not supported




getFieldType
DurationFieldType getFieldType(int index)(Code)
Gets the field type at the specified index.
Parameters:
  index - the index to retrieve the field at the specified index
throws:
  IndexOutOfBoundsException - if the index is invalid



getPeriodType
PeriodType getPeriodType()(Code)
Gets the period type that defines which fields are included in the period. the period type



getValue
int getValue(int index)(Code)
Gets the value at the specified index.
Parameters:
  index - the index to retrieve the value of the field at the specified index
throws:
  IndexOutOfBoundsException - if the index is invalid



hashCode
int hashCode()(Code)
Gets a hash code for the period that is compatible with the equals method. The hashcode is calculated as follows:
 int total = 17;
 for (int i = 0; i < fields.length; i++) {
 total = 27 * total + getValue(i);
 total = 27 * total + getFieldType(i).hashCode();
 }
 return total;
 
a hash code



isSupported
boolean isSupported(DurationFieldType field)(Code)
Checks whether the field type specified is supported by this period.
Parameters:
  field - the field to check, may be null which returns false true if the field is supported



size
int size()(Code)
Gets the number of fields that this period supports. the number of fields supported



toMutablePeriod
MutablePeriod toMutablePeriod()(Code)
Get this object as a MutablePeriod.

This will always return a new MutablePeriod with the same fields. a MutablePeriod using the same field set and values




toPeriod
Period toPeriod()(Code)
Get this period as an immutable Period object.

This will either typecast this instance, or create a new Period. a Duration using the same field set and values




toString
String toString()(Code)
Gets the value as a String in the style of the ISO8601 duration format. Technically, the output can breach the ISO specification as weeks may be included.

For example, "PT6H3M5S" represents 6 hours, 3 minutes, 5 seconds. the value as an ISO8601 style string




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