Java Doc for MutablePeriod.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.BasePeriod
   org.joda.time.MutablePeriod

MutablePeriod
public class MutablePeriod extends BasePeriod implements ReadWritablePeriod,Cloneable,Serializable(Code)
Standard mutable time period implementation.

A time period is divided into a number of fields, such as hours and seconds. Which fields are supported is defined by the PeriodType class. The default is the standard period type, which supports years, months, weeks, days, hours, minutes, seconds and millis.

When this time period is added to an instant, the effect is of adding each field in turn. As a result, this takes into account daylight savings time. Adding a time period of 1 day to the day before daylight savings starts will only add 23 hours rather than 24 to ensure that the time remains the same. If this is not the behaviour you want, then see Duration .

The definition of a period also affects the equals method. A period of 1 day is not equal to a period of 24 hours, nor 1 hour equal to 60 minutes. 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 durations using toDuration, an operation that emphasises that the result may differ according to the date you choose.

MutablePeriod is mutable and not thread-safe, unless concurrent threads are not invoking mutator methods.
author:
   Brian S O'Neill
author:
   Stephen Colebourne
since:
   1.0
See Also:   Period




Constructor Summary
public  MutablePeriod()
     Creates a zero-length period using the standard period type.
public  MutablePeriod(PeriodType type)
     Creates a zero-length period using the specified period type.
public  MutablePeriod(int hours, int minutes, int seconds, int millis)
     Create a period from a set of field values using the standard set of fields.
public  MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
     Create a period from a set of field values using the standard set of fields.
public  MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis, PeriodType type)
     Create a period from a set of field values.
public  MutablePeriod(long duration)
     Creates a period from the given millisecond duration using the standard set of fields.
public  MutablePeriod(long duration, PeriodType type)
     Creates a period from the given millisecond duration.
public  MutablePeriod(long duration, Chronology chronology)
     Creates a period from the given millisecond duration using the standard set of fields.
public  MutablePeriod(long duration, PeriodType type, Chronology chronology)
     Creates a period from the given millisecond duration.
public  MutablePeriod(long startInstant, long endInstant)
     Creates a period from the given interval endpoints using the standard set of fields.
public  MutablePeriod(long startInstant, long endInstant, PeriodType type)
     Creates a period from the given interval endpoints.
public  MutablePeriod(long startInstant, long endInstant, Chronology chrono)
     Creates a period from the given interval endpoints using the standard set of fields.
public  MutablePeriod(long startInstant, long endInstant, PeriodType type, Chronology chrono)
     Creates a period from the given interval endpoints.
public  MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant)
     Creates a period from the given interval endpoints using the standard set of fields.
public  MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant, PeriodType type)
     Creates a period from the given interval endpoints.
public  MutablePeriod(ReadableInstant startInstant, ReadableDuration duration)
     Creates a period from the given start point and the duration.
public  MutablePeriod(ReadableInstant startInstant, ReadableDuration duration, PeriodType type)
     Creates a period from the given start point and the duration.
public  MutablePeriod(ReadableDuration duration, ReadableInstant endInstant)
     Creates a period from the given duration and end point.
public  MutablePeriod(ReadableDuration duration, ReadableInstant endInstant, PeriodType type)
     Creates a period from the given duration and end point.
public  MutablePeriod(Object period)
     Creates a period by converting or copying from another object.
public  MutablePeriod(Object period, PeriodType type)
     Creates a period by converting or copying from another object.
public  MutablePeriod(Object period, Chronology chrono)
     Creates a period by converting or copying from another object.
public  MutablePeriod(Object period, PeriodType type, Chronology chrono)
     Creates a period by converting or copying from another object.

Method Summary
public  voidadd(DurationFieldType field, int value)
     Adds to the value of one of the fields.
public  voidadd(ReadablePeriod period)
     Adds a period to this one by adding each field in turn.
public  voidadd(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
     Adds to each field of this period.
public  voidadd(ReadableInterval interval)
     Adds an interval to this one by dividing the interval into fields and calling MutablePeriod.add(ReadablePeriod) .
public  voidadd(ReadableDuration duration)
     Adds a duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .
public  voidadd(long duration)
     Adds a millisecond duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .
public  voidadd(long duration, Chronology chrono)
     Adds a millisecond duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .
public  voidaddDays(int days)
     Adds the specified days to the number of days in the period.
public  voidaddHours(int hours)
     Adds the specified hours to the number of hours in the period.
public  voidaddMillis(int millis)
     Adds the specified millis to the number of millis in the period.
public  voidaddMinutes(int minutes)
     Adds the specified minutes to the number of minutes in the period.
public  voidaddMonths(int months)
     Adds the specified months to the number of months in the period.
public  voidaddSeconds(int seconds)
     Adds the specified seconds to the number of seconds in the period.
public  voidaddWeeks(int weeks)
     Adds the specified weeks to the number of weeks in the period.
public  voidaddYears(int years)
     Adds the specified years to the number of years in the period.
public  voidclear()
     Clears the period, setting all values back to zero.
public  Objectclone()
     Clone this object.
public  MutablePeriodcopy()
     Clone this object without having to cast the returned object.
public  intgetDays()
     Gets the days field part of the period.
public  intgetHours()
     Gets the hours field part of the period.
public  intgetMillis()
     Gets the millis field part of the period.
public  intgetMinutes()
     Gets the minutes field part of the period.
public  intgetMonths()
     Gets the months field part of the period.
public  intgetSeconds()
     Gets the seconds field part of the period.
public  intgetWeeks()
     Gets the weeks field part of the period.
public  intgetYears()
     Gets the years field part of the period.
public  voidmergePeriod(ReadablePeriod period)
     Merges all the fields from the specified period into this one.
public  voidset(DurationFieldType field, int value)
     Sets the value of one of the fields.
public  voidsetDays(int days)
     Sets the number of days of the period.
public  voidsetHours(int hours)
     Sets the number of hours of the period.
public  voidsetMillis(int millis)
     Sets the number of millis of the period.
public  voidsetMinutes(int minutes)
     Sets the number of minutes of the period.
public  voidsetMonths(int months)
     Sets the number of months of the period.
public  voidsetPeriod(ReadablePeriod period)
     Sets all the fields in one go from another ReadablePeriod.
public  voidsetPeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
     Sets all the fields in one go.
public  voidsetPeriod(ReadableInterval interval)
     Sets all the fields in one go from an interval using the ISO chronology and dividing the fields using the period type.
public  voidsetPeriod(ReadableInstant start, ReadableInstant end)
     Sets all the fields in one go from two instants representing an interval.
public  voidsetPeriod(long startInstant, long endInstant)
     Sets all the fields in one go from a millisecond interval using ISOChronology and dividing the fields using the period type.
public  voidsetPeriod(long startInstant, long endInstant, Chronology chrono)
     Sets all the fields in one go from a millisecond interval.
public  voidsetPeriod(ReadableDuration duration)
     Sets all the fields in one go from a duration dividing the fields using the period type.
public  voidsetPeriod(ReadableDuration duration, Chronology chrono)
     Sets all the fields in one go from a duration dividing the fields using the period type.
public  voidsetPeriod(long duration)
     Sets all the fields in one go from a millisecond duration dividing the fields using the period type.
public  voidsetPeriod(long duration, Chronology chrono)
     Sets all the fields in one go from a millisecond duration.
public  voidsetSeconds(int seconds)
     Sets the number of seconds of the period.
public  voidsetValue(int index, int value)
     Sets the value of one of the fields by index.
public  voidsetWeeks(int weeks)
     Sets the number of weeks of the period.
public  voidsetYears(int years)
     Sets the number of years of the period.


Constructor Detail
MutablePeriod
public MutablePeriod()(Code)
Creates a zero-length period using the standard period type.



MutablePeriod
public MutablePeriod(PeriodType type)(Code)
Creates a zero-length period using the specified period type.
Parameters:
  type - which set of fields this period supports



MutablePeriod
public MutablePeriod(int hours, int minutes, int seconds, int millis)(Code)
Create a period from a set of field values using the standard set of fields.
Parameters:
  hours - amount of hours in this period
Parameters:
  minutes - amount of minutes in this period
Parameters:
  seconds - amount of seconds in this period
Parameters:
  millis - amount of milliseconds in this period



MutablePeriod
public MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)(Code)
Create a period from a set of field values using the standard set of fields.
Parameters:
  years - amount of years in this period
Parameters:
  months - amount of months in this period
Parameters:
  weeks - amount of weeks in this period
Parameters:
  days - amount of days in this period
Parameters:
  hours - amount of hours in this period
Parameters:
  minutes - amount of minutes in this period
Parameters:
  seconds - amount of seconds in this period
Parameters:
  millis - amount of milliseconds in this period



MutablePeriod
public MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis, PeriodType type)(Code)
Create a period from a set of field values.
Parameters:
  years - amount of years in this period, which must be zero if unsupported
Parameters:
  months - amount of months in this period, which must be zero if unsupported
Parameters:
  weeks - amount of weeks in this period, which must be zero if unsupported
Parameters:
  days - amount of days in this period, which must be zero if unsupported
Parameters:
  hours - amount of hours in this period, which must be zero if unsupported
Parameters:
  minutes - amount of minutes in this period, which must be zero if unsupported
Parameters:
  seconds - amount of seconds in this period, which must be zero if unsupported
Parameters:
  millis - amount of milliseconds in this period, which must be zero if unsupported
Parameters:
  type - which set of fields this period supports, null means AllType
throws:
  IllegalArgumentException - if an unsupported field's value is non-zero



MutablePeriod
public MutablePeriod(long duration)(Code)
Creates a period from the given millisecond duration using the standard set of fields.

Only precise fields in the period type will be used. For the standard period type this is the time fields only. Thus the year, month, week and day fields will not be populated.

If the duration is small, less than one day, then this method will perform as you might expect and split the fields evenly.

If the duration is larger than one day then all the remaining duration will be stored in the largest available precise field, hours in this case.

For example, a duration equal to (365 + 60 + 5) days will be converted to ((365 + 60 + 5) * 24) hours by this constructor.

For more control over the conversion process, you have two options:

  • convert the duration to an Interval , and from there obtain the period
  • specify a period type that contains precise definitions of the day and larger fields, such as the UTC or precise types.

Parameters:
  duration - the duration, in milliseconds



MutablePeriod
public MutablePeriod(long duration, PeriodType type)(Code)
Creates a period from the given millisecond duration.

Only precise fields in the period type will be used. Imprecise fields will not be populated.

If the duration is small then this method will perform as you might expect and split the fields evenly.

If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
Parameters:
  duration - the duration, in milliseconds
Parameters:
  type - which set of fields this period supports, null means standard




MutablePeriod
public MutablePeriod(long duration, Chronology chronology)(Code)
Creates a period from the given millisecond duration using the standard set of fields.

Only precise fields in the period type will be used. Imprecise fields will not be populated.

If the duration is small then this method will perform as you might expect and split the fields evenly.

If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
Parameters:
  duration - the duration, in milliseconds
Parameters:
  chronology - the chronology to use to split the duration, null means ISO default




MutablePeriod
public MutablePeriod(long duration, PeriodType type, Chronology chronology)(Code)
Creates a period from the given millisecond duration.

Only precise fields in the period type will be used. Imprecise fields will not be populated.

If the duration is small then this method will perform as you might expect and split the fields evenly.

If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
Parameters:
  duration - the duration, in milliseconds
Parameters:
  type - which set of fields this period supports, null means standard
Parameters:
  chronology - the chronology to use to split the duration, null means ISO default




MutablePeriod
public MutablePeriod(long startInstant, long endInstant)(Code)
Creates a period from the given interval endpoints using the standard set of fields.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds



MutablePeriod
public MutablePeriod(long startInstant, long endInstant, PeriodType type)(Code)
Creates a period from the given interval endpoints.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds
Parameters:
  type - which set of fields this period supports, null means standard



MutablePeriod
public MutablePeriod(long startInstant, long endInstant, Chronology chrono)(Code)
Creates a period from the given interval endpoints using the standard set of fields.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds
Parameters:
  chrono - the chronology to use, null means ISO in default zone



MutablePeriod
public MutablePeriod(long startInstant, long endInstant, PeriodType type, Chronology chrono)(Code)
Creates a period from the given interval endpoints.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds
Parameters:
  type - which set of fields this period supports, null means standard
Parameters:
  chrono - the chronology to use, null means ISO in default zone



MutablePeriod
public MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant)(Code)
Creates a period from the given interval endpoints using the standard set of fields.

The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
Parameters:
  startInstant - interval start, null means now
Parameters:
  endInstant - interval end, null means now




MutablePeriod
public MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant, PeriodType type)(Code)
Creates a period from the given interval endpoints.

The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
Parameters:
  startInstant - interval start, null means now
Parameters:
  endInstant - interval end, null means now
Parameters:
  type - which set of fields this period supports, null means AllType




MutablePeriod
public MutablePeriod(ReadableInstant startInstant, ReadableDuration duration)(Code)
Creates a period from the given start point and the duration.
Parameters:
  startInstant - the interval start, null means now
Parameters:
  duration - the duration of the interval, null means zero-length



MutablePeriod
public MutablePeriod(ReadableInstant startInstant, ReadableDuration duration, PeriodType type)(Code)
Creates a period from the given start point and the duration.
Parameters:
  startInstant - the interval start, null means now
Parameters:
  duration - the duration of the interval, null means zero-length
Parameters:
  type - which set of fields this period supports, null means standard



MutablePeriod
public MutablePeriod(ReadableDuration duration, ReadableInstant endInstant)(Code)
Creates a period from the given duration and end point.
Parameters:
  duration - the duration of the interval, null means zero-length
Parameters:
  endInstant - the interval end, null means now



MutablePeriod
public MutablePeriod(ReadableDuration duration, ReadableInstant endInstant, PeriodType type)(Code)
Creates a period from the given duration and end point.
Parameters:
  duration - the duration of the interval, null means zero-length
Parameters:
  endInstant - the interval end, null means now
Parameters:
  type - which set of fields this period supports, null means standard



MutablePeriod
public MutablePeriod(Object period)(Code)
Creates a period by converting or copying from another object.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePeriod, ReadableInterval and String. The String formats are described by ISOPeriodFormat.standard .
Parameters:
  period - period to convert
throws:
  IllegalArgumentException - if period is invalid
throws:
  UnsupportedOperationException - if an unsupported field's value is non-zero




MutablePeriod
public MutablePeriod(Object period, PeriodType type)(Code)
Creates a period by converting or copying from another object.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePeriod, ReadableInterval and String. The String formats are described by ISOPeriodFormat.standard .
Parameters:
  period - period to convert
Parameters:
  type - which set of fields this period supports, null means use converter
throws:
  IllegalArgumentException - if period is invalid
throws:
  UnsupportedOperationException - if an unsupported field's value is non-zero




MutablePeriod
public MutablePeriod(Object period, Chronology chrono)(Code)
Creates a period by converting or copying from another object.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePeriod, ReadableInterval and String. The String formats are described by ISOPeriodFormat.standard .
Parameters:
  period - period to convert
Parameters:
  chrono - the chronology to use, null means ISO in default zone
throws:
  IllegalArgumentException - if period is invalid
throws:
  UnsupportedOperationException - if an unsupported field's value is non-zero




MutablePeriod
public MutablePeriod(Object period, PeriodType type, Chronology chrono)(Code)
Creates a period by converting or copying from another object.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePeriod, ReadableInterval and String. The String formats are described by ISOPeriodFormat.standard .
Parameters:
  period - period to convert
Parameters:
  type - which set of fields this period supports, null means use converter
Parameters:
  chrono - the chronology to use, null means ISO in default zone
throws:
  IllegalArgumentException - if period is invalid
throws:
  UnsupportedOperationException - if an unsupported field's value is non-zero





Method Detail
add
public void add(DurationFieldType field, int value)(Code)
Adds to the value of one of the fields.

The field type specified must be one of those that is supported by the period.
Parameters:
  field - a DurationFieldType instance that is supported by this period, not null
Parameters:
  value - the value to add to the field
throws:
  IllegalArgumentException - if the field is null or not supported




add
public void add(ReadablePeriod period)(Code)
Adds a period to this one by adding each field in turn.
Parameters:
  period - the period to add, null means add nothing
throws:
  IllegalArgumentException - if the period being added contains a fieldnot supported by this period
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



add
public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)(Code)
Adds to each field of this period.
Parameters:
  years - amount of years to add to this period, which must be zero if unsupported
Parameters:
  months - amount of months to add to this period, which must be zero if unsupported
Parameters:
  weeks - amount of weeks to add to this period, which must be zero if unsupported
Parameters:
  days - amount of days to add to this period, which must be zero if unsupported
Parameters:
  hours - amount of hours to add to this period, which must be zero if unsupported
Parameters:
  minutes - amount of minutes to add to this period, which must be zero if unsupported
Parameters:
  seconds - amount of seconds to add to this period, which must be zero if unsupported
Parameters:
  millis - amount of milliseconds to add to this period, which must be zero if unsupported
throws:
  IllegalArgumentException - if the period being added contains a fieldnot supported by this period
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



add
public void add(ReadableInterval interval)(Code)
Adds an interval to this one by dividing the interval into fields and calling MutablePeriod.add(ReadablePeriod) .
Parameters:
  interval - the interval to add, null means add nothing
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



add
public void add(ReadableDuration duration)(Code)
Adds a duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .
Parameters:
  duration - the duration to add, null means add nothing
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



add
public void add(long duration)(Code)
Adds a millisecond duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration, in milliseconds
throws:
  ArithmeticException - if the addition exceeds the capacity of the period




add
public void add(long duration, Chronology chrono)(Code)
Adds a millisecond duration to this one by dividing the duration into fields and calling MutablePeriod.add(ReadablePeriod) .

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration, in milliseconds
Parameters:
  chrono - the chronology to use, null means ISO default
throws:
  ArithmeticException - if the addition exceeds the capacity of the period




addDays
public void addDays(int days)(Code)
Adds the specified days to the number of days in the period.
Parameters:
  days - the number of days
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addHours
public void addHours(int hours)(Code)
Adds the specified hours to the number of hours in the period.
Parameters:
  hours - the number of hours
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addMillis
public void addMillis(int millis)(Code)
Adds the specified millis to the number of millis in the period.
Parameters:
  millis - the number of millis
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addMinutes
public void addMinutes(int minutes)(Code)
Adds the specified minutes to the number of minutes in the period.
Parameters:
  minutes - the number of minutes
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addMonths
public void addMonths(int months)(Code)
Adds the specified months to the number of months in the period.
Parameters:
  months - the number of months
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addSeconds
public void addSeconds(int seconds)(Code)
Adds the specified seconds to the number of seconds in the period.
Parameters:
  seconds - the number of seconds
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addWeeks
public void addWeeks(int weeks)(Code)
Adds the specified weeks to the number of weeks in the period.
Parameters:
  weeks - the number of weeks
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



addYears
public void addYears(int years)(Code)
Adds the specified years to the number of years in the period.
Parameters:
  years - the number of years
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero
throws:
  ArithmeticException - if the addition exceeds the capacity of the period



clear
public void clear()(Code)
Clears the period, setting all values back to zero.



clone
public Object clone()(Code)
Clone this object. a clone of this object.



copy
public MutablePeriod copy()(Code)
Clone this object without having to cast the returned object. a clone of the this object.



getDays
public int getDays()(Code)
Gets the days field part of the period. the number of days in the period, zero if unsupported



getHours
public int getHours()(Code)
Gets the hours field part of the period. the number of hours in the period, zero if unsupported



getMillis
public int getMillis()(Code)
Gets the millis field part of the period. the number of millis in the period, zero if unsupported



getMinutes
public int getMinutes()(Code)
Gets the minutes field part of the period. the number of minutes in the period, zero if unsupported



getMonths
public int getMonths()(Code)
Gets the months field part of the period. the number of months in the period, zero if unsupported



getSeconds
public int getSeconds()(Code)
Gets the seconds field part of the period. the number of seconds in the period, zero if unsupported



getWeeks
public int getWeeks()(Code)
Gets the weeks field part of the period. the number of weeks in the period, zero if unsupported



getYears
public int getYears()(Code)
Gets the years field part of the period. the number of years in the period, zero if unsupported



mergePeriod
public void mergePeriod(ReadablePeriod period)(Code)
Merges all the fields from the specified period into this one.

Fields that are not present in the specified period are left unaltered.
Parameters:
  period - the period to set, null ignored
throws:
  IllegalArgumentException - if an unsupported field's value is non-zero




set
public void set(DurationFieldType field, int value)(Code)
Sets the value of one of the fields.

The field type specified must be one of those that is supported by the period.
Parameters:
  field - a DurationFieldType instance that is supported by this period, not null
Parameters:
  value - the new value for the field
throws:
  IllegalArgumentException - if the field is null or not supported




setDays
public void setDays(int days)(Code)
Sets the number of days of the period.
Parameters:
  days - the number of days
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setHours
public void setHours(int hours)(Code)
Sets the number of hours of the period.
Parameters:
  hours - the number of hours
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setMillis
public void setMillis(int millis)(Code)
Sets the number of millis of the period.
Parameters:
  millis - the number of millis
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setMinutes
public void setMinutes(int minutes)(Code)
Sets the number of minutes of the period.
Parameters:
  minutes - the number of minutes
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setMonths
public void setMonths(int months)(Code)
Sets the number of months of the period.
Parameters:
  months - the number of months
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setPeriod
public void setPeriod(ReadablePeriod period)(Code)
Sets all the fields in one go from another ReadablePeriod.
Parameters:
  period - the period to set, null means zero length period
throws:
  IllegalArgumentException - if an unsupported field's value is non-zero



setPeriod
public void setPeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)(Code)
Sets all the fields in one go.
Parameters:
  years - amount of years in this period, which must be zero if unsupported
Parameters:
  months - amount of months in this period, which must be zero if unsupported
Parameters:
  weeks - amount of weeks in this period, which must be zero if unsupported
Parameters:
  days - amount of days in this period, which must be zero if unsupported
Parameters:
  hours - amount of hours in this period, which must be zero if unsupported
Parameters:
  minutes - amount of minutes in this period, which must be zero if unsupported
Parameters:
  seconds - amount of seconds in this period, which must be zero if unsupported
Parameters:
  millis - amount of milliseconds in this period, which must be zero if unsupported
throws:
  IllegalArgumentException - if an unsupported field's value is non-zero



setPeriod
public void setPeriod(ReadableInterval interval)(Code)
Sets all the fields in one go from an interval using the ISO chronology and dividing the fields using the period type.
Parameters:
  interval - the interval to set, null means zero length
throws:
  ArithmeticException - if the set exceeds the capacity of the period



setPeriod
public void setPeriod(ReadableInstant start, ReadableInstant end)(Code)
Sets all the fields in one go from two instants representing an interval.

The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
Parameters:
  start - the start instant, null means now
Parameters:
  end - the end instant, null means now
throws:
  ArithmeticException - if the set exceeds the capacity of the period




setPeriod
public void setPeriod(long startInstant, long endInstant)(Code)
Sets all the fields in one go from a millisecond interval using ISOChronology and dividing the fields using the period type.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds
throws:
  ArithmeticException - if the set exceeds the capacity of the period



setPeriod
public void setPeriod(long startInstant, long endInstant, Chronology chrono)(Code)
Sets all the fields in one go from a millisecond interval.
Parameters:
  startInstant - interval start, in milliseconds
Parameters:
  endInstant - interval end, in milliseconds
Parameters:
  chrono - the chronology to use, not null
throws:
  ArithmeticException - if the set exceeds the capacity of the period



setPeriod
public void setPeriod(ReadableDuration duration)(Code)
Sets all the fields in one go from a duration dividing the fields using the period type.

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration to set, null means zero length
throws:
  ArithmeticException - if the set exceeds the capacity of the period




setPeriod
public void setPeriod(ReadableDuration duration, Chronology chrono)(Code)
Sets all the fields in one go from a duration dividing the fields using the period type.

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration to set, null means zero length
Parameters:
  chrono - the chronology to use, null means ISO default
throws:
  ArithmeticException - if the set exceeds the capacity of the period




setPeriod
public void setPeriod(long duration)(Code)
Sets all the fields in one go from a millisecond duration dividing the fields using the period type.

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration, in milliseconds
throws:
  ArithmeticException - if the set exceeds the capacity of the period




setPeriod
public void setPeriod(long duration, Chronology chrono)(Code)
Sets all the fields in one go from a millisecond duration.

When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
Parameters:
  duration - the duration, in milliseconds
Parameters:
  chrono - the chronology to use, not null
throws:
  ArithmeticException - if the set exceeds the capacity of the period




setSeconds
public void setSeconds(int seconds)(Code)
Sets the number of seconds of the period.
Parameters:
  seconds - the number of seconds
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setValue
public void setValue(int index, int value)(Code)
Sets the value of one of the fields by index.
Parameters:
  index - the field index
Parameters:
  value - the new value for the field
throws:
  IndexOutOfBoundsException - if the index is invalid



setWeeks
public void setWeeks(int weeks)(Code)
Sets the number of weeks of the period.
Parameters:
  weeks - the number of weeks
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



setYears
public void setYears(int years)(Code)
Sets the number of years of the period.
Parameters:
  years - the number of years
throws:
  IllegalArgumentException - if field is not supported and the value is non-zero



Methods inherited from org.joda.time.base.BasePeriod
protected void addField(DurationFieldType field, int value)(Code)(Java Doc)
protected void addFieldInto(int[] values, DurationFieldType field, int value)(Code)(Java Doc)
protected void addPeriod(ReadablePeriod period)(Code)(Java Doc)
protected int[] addPeriodInto(int[] values, ReadablePeriod period)(Code)(Java Doc)
protected PeriodType checkPeriodType(PeriodType type)(Code)(Java Doc)
public DurationFieldType getFieldType(int index)(Code)(Java Doc)
public PeriodType getPeriodType()(Code)(Java Doc)
public int getValue(int index)(Code)(Java Doc)
protected void mergePeriod(ReadablePeriod period)(Code)(Java Doc)
protected int[] mergePeriodInto(int[] values, ReadablePeriod period)(Code)(Java Doc)
protected void setField(DurationFieldType field, int value)(Code)(Java Doc)
protected void setFieldInto(int[] values, DurationFieldType field, int value)(Code)(Java Doc)
protected void setPeriod(ReadablePeriod period)(Code)(Java Doc)
protected void setPeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)(Code)(Java Doc)
protected void setValue(int index, int value)(Code)(Java Doc)
protected void setValues(int[] values)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public Duration toDurationFrom(ReadableInstant startInstant)(Code)(Java Doc)
public Duration toDurationTo(ReadableInstant endInstant)(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.