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

All known Subclasses:   org.joda.time.Days,  org.joda.time.Seconds,  org.joda.time.Minutes,  org.joda.time.Years,  org.joda.time.Months,  org.joda.time.Weeks,  org.joda.time.Hours,
BaseSingleFieldPeriod
abstract public class BaseSingleFieldPeriod implements ReadablePeriod,Comparable,Serializable(Code)
BaseSingleFieldPeriod is an abstract implementation of ReadablePeriod that manages a single duration field, such as days or minutes.

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

BaseSingleFieldPeriod subclasses may be mutable and not thread-safe.
author:
   Stephen Colebourne
since:
   1.4




Constructor Summary
protected  BaseSingleFieldPeriod(int period)
     Creates a new instance representing the specified period.

Method Summary
protected static  intbetween(ReadableInstant start, ReadableInstant end, DurationFieldType field)
     Calculates the number of whole units between the two specified datetimes.
protected static  intbetween(ReadablePartial start, ReadablePartial end, ReadablePeriod zeroInstance)
     Calculates the number of whole units between the two specified partial datetimes.
public  intcompareTo(Object other)
     Compares this period to another object of the same class.
public  booleanequals(Object period)
     Compares this object with the specified object for equality based on the value of each field.
public  intget(DurationFieldType type)
     Gets the value of a duration field represented by this period.
abstract public  DurationFieldTypegetFieldType()
     Gets the single duration field type.
public  DurationFieldTypegetFieldType(int index)
     Gets the field type at the specified index.
abstract public  PeriodTypegetPeriodType()
     Gets the period type which matches the duration field type.
protected  intgetValue()
     Gets the amount of this period.
public  intgetValue(int index)
     Gets the value at the specified index.
public  inthashCode()
     Gets a hash code for the period as defined by ReadablePeriod.
public  booleanisSupported(DurationFieldType type)
     Checks whether the duration field specified is supported by this period.
protected  voidsetValue(int value)
     Sets the amount of this period.
public  intsize()
     Gets the number of fields that this period supports, which is one.
protected static  intstandardPeriodIn(ReadablePeriod period, long millisPerUnit)
     Creates a new instance representing the number of complete standard length units in the specified period.

This factory method converts all fields from the period to hours using standardised durations for each field.

public  MutablePeriodtoMutablePeriod()
     Get this object as a MutablePeriod.
public  PeriodtoPeriod()
     Get this period as an immutable Period object.


Constructor Detail
BaseSingleFieldPeriod
protected BaseSingleFieldPeriod(int period)(Code)
Creates a new instance representing the specified period.
Parameters:
  period - the period to represent




Method Detail
between
protected static int between(ReadableInstant start, ReadableInstant end, DurationFieldType field)(Code)
Calculates the number of whole units between the two specified datetimes.
Parameters:
  start - the start instant, validated to not be null
Parameters:
  end - the end instant, validated to not be null
Parameters:
  field - the field type to use, must not be null the period
throws:
  IllegalArgumentException - if the instants are null or invalid



between
protected static int between(ReadablePartial start, ReadablePartial end, ReadablePeriod zeroInstance)(Code)
Calculates the number of whole units between the two specified partial datetimes.

The two partials must contain the same fields, for example you can specify two LocalDate objects.
Parameters:
  start - the start partial date, validated to not be null
Parameters:
  end - the end partial date, validated to not be null
Parameters:
  zeroInstance - the zero instance constant, must not be null the period
throws:
  IllegalArgumentException - if the partials are null or invalid




compareTo
public int compareTo(Object other)(Code)
Compares this period to another object of the same class.
Parameters:
  other - the other period, must not be null zero if equal, positive if greater, negative if less
throws:
  NullPointerException - if the other period is null
throws:
  ClassCastException - if the other period is of a different type



equals
public boolean equals(Object period)(Code)
Compares this object with the specified object for equality based on the value of each field. All ReadablePeriod instances are accepted, but only those with a matching PeriodType can return true.
Parameters:
  period - a readable period to check against true if all the field values are equal, false ifnot or the period is null or of an incorrect type



get
public int get(DurationFieldType type)(Code)
Gets the value of a duration field represented by this period.

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




getFieldType
abstract public DurationFieldType getFieldType()(Code)
Gets the single duration field type. the duration field type, not null



getFieldType
public DurationFieldType getFieldType(int index)(Code)
Gets the field type at the specified index.

The only index supported by this period is zero which returns the field type of this class.
Parameters:
  index - the index to retrieve, which must be zero the field at the specified index
throws:
  IndexOutOfBoundsException - if the index is invalid




getPeriodType
abstract public PeriodType getPeriodType()(Code)
Gets the period type which matches the duration field type. the period type, not null



getValue
protected int getValue()(Code)
Gets the amount of this period. the period value



getValue
public int getValue(int index)(Code)
Gets the value at the specified index.

The only index supported by this period is zero.
Parameters:
  index - the index to retrieve, which must be zero the value of the field at the specified index
throws:
  IndexOutOfBoundsException - if the index is invalid




hashCode
public int hashCode()(Code)
Gets a hash code for the period as defined by ReadablePeriod. a hash code



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



setValue
protected void setValue(int value)(Code)
Sets the amount of this period. To make a subclass immutable you must declare it final, or block this method.
Parameters:
  value - the period value



size
public int size()(Code)
Gets the number of fields that this period supports, which is one. the number of fields supported, which is one



standardPeriodIn
protected static int standardPeriodIn(ReadablePeriod period, long millisPerUnit)(Code)
Creates a new instance representing the number of complete standard length units in the specified period.

This factory method converts all fields from the period to hours using standardised durations for each field. Only those fields which have a precise duration in the ISO UTC chronology can be converted.

  • One week consists of 7 days.
  • One day consists of 24 hours.
  • One hour consists of 60 minutes.
  • One minute consists of 60 seconds.
  • One second consists of 1000 milliseconds.
Months and Years are imprecise and periods containing these values cannot be converted.
Parameters:
  period - the period to get the number of hours from, must not be null
Parameters:
  millisPerUnit - the number of milliseconds in one standard unit of this period
throws:
  IllegalArgumentException - if the period contains imprecise duration values



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

This will always return a new MutablePeriod with the same fields. The period will use PeriodType.standard(). a MutablePeriod using the same field set and values




toPeriod
public Period toPeriod()(Code)
Get this period as an immutable Period object. The period will use PeriodType.standard(). a Period representing the same number of days



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.