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 instant in time that can be queried and modified using datetime fields.
020: * <p>
021: * The implementation of this interface will be mutable.
022: * It may provide more advanced methods than those in the interface.
023: * <p>
024: * Methods in your application should be defined using <code>ReadWritableDateTime</code>
025: * as a parameter if the method wants to manipulate and change a date in simple ways.
026: *
027: * @author Stephen Colebourne
028: * @author Brian S O'Neill
029: * @since 1.0
030: */
031: public interface ReadWritableDateTime extends ReadableDateTime,
032: ReadWritableInstant {
033:
034: //-----------------------------------------------------------------------
035: /**
036: * Set the year to the specified value.
037: *
038: * @param year the year
039: * @throws IllegalArgumentException if the value is invalid
040: */
041: void setYear(int year);
042:
043: /**
044: * Add a number of years to the date.
045: *
046: * @param years the years to add
047: * @throws IllegalArgumentException if the value is invalid
048: */
049: void addYears(int years);
050:
051: //-----------------------------------------------------------------------
052: /**
053: * Set the weekyear to the specified value.
054: *
055: * @param weekyear the weekyear
056: * @throws IllegalArgumentException if the value is invalid
057: */
058: void setWeekyear(int weekyear);
059:
060: /**
061: * Add a number of weekyears to the date.
062: *
063: * @param weekyears the weekyears to add
064: * @throws IllegalArgumentException if the value is invalid
065: */
066: void addWeekyears(int weekyears);
067:
068: //-----------------------------------------------------------------------
069: /**
070: * Set the month of the year to the specified value.
071: *
072: * @param monthOfYear the month of the year
073: * @throws IllegalArgumentException if the value is invalid
074: */
075: void setMonthOfYear(int monthOfYear);
076:
077: /**
078: * Add a number of months to the date.
079: *
080: * @param months the months to add
081: * @throws IllegalArgumentException if the value is invalid
082: */
083: void addMonths(int months);
084:
085: //-----------------------------------------------------------------------
086: /**
087: * Set the week of weekyear to the specified value.
088: *
089: * @param weekOfWeekyear the week of the weekyear
090: * @throws IllegalArgumentException if the value is invalid
091: */
092: void setWeekOfWeekyear(int weekOfWeekyear);
093:
094: /**
095: * Add a number of weeks to the date.
096: *
097: * @param weeks the weeks to add
098: * @throws IllegalArgumentException if the value is invalid
099: */
100: void addWeeks(int weeks);
101:
102: //-----------------------------------------------------------------------
103: /**
104: * Set the day of year to the specified value.
105: *
106: * @param dayOfYear the day of the year
107: * @throws IllegalArgumentException if the value is invalid
108: */
109: void setDayOfYear(int dayOfYear);
110:
111: /**
112: * Set the day of the month to the specified value.
113: *
114: * @param dayOfMonth the day of the month
115: * @throws IllegalArgumentException if the value is invalid
116: */
117: void setDayOfMonth(int dayOfMonth);
118:
119: /**
120: * Set the day of week to the specified value.
121: *
122: * @param dayOfWeek the day of the week
123: * @throws IllegalArgumentException if the value is invalid
124: */
125: void setDayOfWeek(int dayOfWeek);
126:
127: /**
128: * Add a number of days to the date.
129: *
130: * @param days the days to add
131: * @throws IllegalArgumentException if the value is invalid
132: */
133: void addDays(int days);
134:
135: //-----------------------------------------------------------------------
136: /**
137: * Set the hour of the day to the specified value.
138: *
139: * @param hourOfDay the hour of day
140: * @throws IllegalArgumentException if the value is invalid
141: */
142: void setHourOfDay(int hourOfDay);
143:
144: /**
145: * Add a number of hours to the date.
146: *
147: * @param hours the hours to add
148: * @throws IllegalArgumentException if the value is invalid
149: */
150: void addHours(int hours);
151:
152: //-----------------------------------------------------------------------
153: /**
154: * Set the minute of the day to the specified value.
155: *
156: * @param minuteOfDay the minute of day
157: * @throws IllegalArgumentException if the value is invalid
158: */
159: void setMinuteOfDay(int minuteOfDay);
160:
161: /**
162: * Set the minute of the hour to the specified value.
163: *
164: * @param minuteOfHour the minute of hour
165: * @throws IllegalArgumentException if the value is invalid
166: */
167: void setMinuteOfHour(int minuteOfHour);
168:
169: /**
170: * Add a number of minutes to the date.
171: *
172: * @param minutes the minutes to add
173: * @throws IllegalArgumentException if the value is invalid
174: */
175: void addMinutes(int minutes);
176:
177: //-----------------------------------------------------------------------
178: /**
179: * Set the second of the day to the specified value.
180: *
181: * @param secondOfDay the second of day
182: * @throws IllegalArgumentException if the value is invalid
183: */
184: void setSecondOfDay(int secondOfDay);
185:
186: /**
187: * Set the second of the minute to the specified value.
188: *
189: * @param secondOfMinute the second of minute
190: * @throws IllegalArgumentException if the value is invalid
191: */
192: void setSecondOfMinute(int secondOfMinute);
193:
194: /**
195: * Add a number of seconds to the date.
196: *
197: * @param seconds the seconds to add
198: * @throws IllegalArgumentException if the value is invalid
199: */
200: void addSeconds(int seconds);
201:
202: //-----------------------------------------------------------------------
203: /**
204: * Set the millis of the day to the specified value.
205: *
206: * @param millisOfDay the millis of day
207: * @throws IllegalArgumentException if the value is invalid
208: */
209: void setMillisOfDay(int millisOfDay);
210:
211: /**
212: * Set the millis of the second to the specified value.
213: *
214: * @param millisOfSecond the millis of second
215: * @throws IllegalArgumentException if the value is invalid
216: */
217: void setMillisOfSecond(int millisOfSecond);
218:
219: /**
220: * Add a number of milliseconds to the date. The implementation of this
221: * method differs from the {@link #add(long)} method in that a
222: * DateTimeField performs the addition.
223: *
224: * @param millis the milliseconds to add
225: * @throws IllegalArgumentException if the value is invalid
226: */
227: void addMillis(int millis);
228:
229: /**
230: * Set the date from fields.
231: * The time part of this object will be unaffected.
232: *
233: * @param year the year
234: * @param monthOfYear the month of the year
235: * @param dayOfMonth the day of the month
236: * @throws IllegalArgumentException if any value is invalid
237: */
238: void setDate(int year, int monthOfYear, int dayOfMonth);
239:
240: /**
241: * Set the time from fields.
242: * The date part of this object will be unaffected.
243: *
244: * @param hour the hour
245: * @param minuteOfHour the minute of the hour
246: * @param secondOfMinute the second of the minute
247: * @param millisOfSecond the millisecond of the second
248: * @throws IllegalArgumentException if any value is invalid
249: */
250: void setTime(int hour, int minuteOfHour, int secondOfMinute,
251: int millisOfSecond);
252:
253: /**
254: * Set the date and time from fields.
255: *
256: * @param year the year
257: * @param monthOfYear the month of the year
258: * @param dayOfMonth the day of the month
259: * @param hourOfDay the hour of the day
260: * @param minuteOfHour the minute of the hour
261: * @param secondOfMinute the second of the minute
262: * @param millisOfSecond the millisecond of the second
263: * @throws IllegalArgumentException if any value is invalid
264: */
265: void setDateTime(int year, int monthOfYear, int dayOfMonth,
266: int hourOfDay, int minuteOfHour, int secondOfMinute,
267: int millisOfSecond);
268:
269: }
|