Source Code Cross Referenced for ReadableDuration.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright 2001-2005 Stephen Colebourne
003:         *
004:         *  Licensed under the Apache License, Version 2.0 (the "License");
005:         *  you may not use this file except in compliance with the License.
006:         *  You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         *  Unless required by applicable law or agreed to in writing, software
011:         *  distributed under the License is distributed on an "AS IS" BASIS,
012:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         *  See the License for the specific language governing permissions and
014:         *  limitations under the License.
015:         */
016:        package org.joda.time;
017:
018:        /**
019:         * Defines an exact duration of time in milliseconds.
020:         * <p>
021:         * The implementation of this interface may be mutable or immutable. This
022:         * interface only gives access to retrieve data, never to change it.
023:         * <p>
024:         * Methods that are passed a duration as a parameter will treat <code>null</code>
025:         * as a zero length duration.
026:         *
027:         * @see ReadableInterval
028:         * @see ReadablePeriod
029:         * @author Brian S O'Neill
030:         * @author Stephen Colebourne
031:         * @since 1.0
032:         */
033:        public interface ReadableDuration extends Comparable {
034:
035:            /**
036:             * Gets the total length of this duration in milliseconds.
037:             *
038:             * @return the total length of the time duration in milliseconds.
039:             */
040:            long getMillis();
041:
042:            //-----------------------------------------------------------------------
043:            /**
044:             * Get this duration as an immutable <code>Duration</code> object.
045:             * <p>
046:             * This will either typecast this instance, or create a new <code>Duration</code>.
047:             * 
048:             * @return a Duration created using the millisecond duration from this instance
049:             */
050:            Duration toDuration();
051:
052:            //-----------------------------------------------------------------------
053:            /**
054:             * Converts this duration to a Period instance using the standard period type
055:             * and the ISO chronology.
056:             * <p>
057:             * Only precise fields in the period type will be used. Thus, only the hour,
058:             * minute, second and millisecond fields on the period will be used.
059:             * The year, month, week and day fields will not be populated.
060:             * <p>
061:             * If the duration is small, less than one day, then this method will perform
062:             * as you might expect and split the fields evenly.
063:             * If the duration is larger than one day then all the remaining duration will
064:             * be stored in the largest available field, hours in this case.
065:             * <p>
066:             * For example, a duration effectively equal to (365 + 60 + 5) days will be
067:             * converted to ((365 + 60 + 5) * 24) hours by this constructor.
068:             * <p>
069:             * For more control over the conversion process, you must pair the duration with
070:             * an instant, see {@link Period#Period(ReadableInstant,ReadableDuration)}.
071:             * 
072:             * @return a Period created using the millisecond duration from this instance
073:             */
074:            Period toPeriod();
075:
076:            //-----------------------------------------------------------------------
077:            /**
078:             * Compares this duration with the specified duration based on length.
079:             *
080:             * @param obj  a duration to check against
081:             * @return negative value if this is less, 0 if equal, or positive value if greater
082:             * @throws NullPointerException if the object is null
083:             * @throws ClassCastException if the given object is not supported
084:             */
085:            int compareTo(Object obj);
086:
087:            /**
088:             * Is the length of this duration equal to the duration passed in.
089:             *
090:             * @param duration  another duration to compare to, null means zero milliseconds
091:             * @return true if this duration is equal to than the duration passed in
092:             */
093:            boolean isEqual(ReadableDuration duration);
094:
095:            /**
096:             * Is the length of this duration longer than the duration passed in.
097:             *
098:             * @param duration  another duration to compare to, null means zero milliseconds
099:             * @return true if this duration is equal to than the duration passed in
100:             */
101:            boolean isLongerThan(ReadableDuration duration);
102:
103:            /**
104:             * Is the length of this duration shorter than the duration passed in.
105:             *
106:             * @param duration  another duration to compare to, null means zero milliseconds
107:             * @return true if this duration is equal to than the duration passed in
108:             */
109:            boolean isShorterThan(ReadableDuration duration);
110:
111:            //-----------------------------------------------------------------------
112:            /**
113:             * Compares this object with the specified object for equality based
114:             * on the millisecond length. All ReadableDuration instances are accepted.
115:             *
116:             * @param readableDuration  a readable duration to check against
117:             * @return true if the length of the duration is equal
118:             */
119:            boolean equals(Object readableDuration);
120:
121:            /**
122:             * Gets a hash code for the duration that is compatable with the 
123:             * equals method.
124:             * The following formula must be used:
125:             * <pre>
126:             *  long len = getMillis();
127:             *  return (int) (len ^ (len >>> 32));
128:             * </pre>
129:             *
130:             * @return a hash code
131:             */
132:            int hashCode();
133:
134:            //-----------------------------------------------------------------------
135:            /**
136:             * Gets the value as a String in the ISO8601 duration format using hours,
137:             * minutes and seconds (including fractional milliseconds).
138:             * <p>
139:             * For example, "PT6H3M7S" represents 6 hours, 3 minutes, 7 seconds.
140:             *
141:             * @return the value as an ISO8601 string
142:             */
143:            String toString();
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.