KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joda > time > ReadWritableInterval


1 /*
2  * Copyright 2001-2005 Stephen Colebourne
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.joda.time;
17
18 /**
19  * Writable interface for an interval.
20  *
21  * @author Stephen Colebourne
22  * @author Brian S O'Neill
23  * @since 1.0
24  */

25 public interface ReadWritableInterval extends ReadableInterval {
26
27     /**
28      * Sets this interval from two millisecond instants.
29      *
30      * @param startInstant the start of the time interval
31      * @param endInstant the start of the time interval
32      * @throws IllegalArgumentException if the end is before the start
33      */

34     void setInterval(long startInstant, long endInstant);
35
36     /**
37      * Sets this interval to be the same as another.
38      *
39      * @param interval the interval to copy
40      * @throws IllegalArgumentException if the end is before the start
41      */

42     void setInterval(ReadableInterval interval);
43
44     /**
45      * Sets this interval from two instants.
46      *
47      * @param startInstant the start of the time interval
48      * @param endInstant the start of the time interval
49      * @throws IllegalArgumentException if the end is before the start
50      */

51     void setInterval(ReadableInstant startInstant, ReadableInstant endInstant);
52
53     //-----------------------------------------------------------------------
54
/**
55      * Sets the chronology of this time interval.
56      *
57      * @param chrono the chronology to use, null means ISO default
58      */

59     void setChronology(Chronology chrono);
60
61     //-----------------------------------------------------------------------
62
/**
63      * Sets the start of this time interval.
64      *
65      * @param millisInstant the start of the time interval,
66      * millisecond instant from 1970-01-01T00:00:00Z
67      * @throws IllegalArgumentException if the end is before the start
68      */

69     void setStartMillis(long millisInstant);
70
71     /**
72      * Sets the start of this time interval as an Instant.
73      *
74      * @param instant the start of the time interval
75      * @throws IllegalArgumentException if the end is before the start
76      */

77     void setStart(ReadableInstant instant);
78
79     //-----------------------------------------------------------------------
80
/**
81      * Sets the end of this time interval.
82      *
83      * @param millisInstant the end of the time interval,
84      * millisecond instant from 1970-01-01T00:00:00Z
85      * @throws IllegalArgumentException if the end is before the start
86      */

87     void setEndMillis(long millisInstant);
88
89     /**
90      * Sets the end of this time interval as an Instant.
91      *
92      * @param instant the end of the time interval
93      * @throws IllegalArgumentException if the end is before the start
94      */

95     void setEnd(ReadableInstant instant);
96
97     //-----------------------------------------------------------------------
98
/**
99      * Sets the duration of this time interval, preserving the start instant.
100      *
101      * @param duration new duration for interval
102      * @throws IllegalArgumentException if the end is before the start
103      * @throws ArithmeticException if the end instant exceeds the capacity of a long
104      */

105     void setDurationAfterStart(ReadableDuration duration);
106
107     /**
108      * Sets the duration of this time interval, preserving the end instant.
109      *
110      * @param duration new duration for interval
111      * @throws IllegalArgumentException if the end is before the start
112      * @throws ArithmeticException if the start instant exceeds the capacity of a long
113      */

114     void setDurationBeforeEnd(ReadableDuration duration);
115
116     //-----------------------------------------------------------------------
117
/**
118      * Sets the period of this time interval, preserving the start instant.
119      *
120      * @param period new period for interval, null means zero length
121      * @throws IllegalArgumentException if the end is before the start
122      * @throws ArithmeticException if the end instant exceeds the capacity of a long
123      */

124     void setPeriodAfterStart(ReadablePeriod period);
125
126     /**
127      * Sets the period of this time interval, preserving the end instant.
128      *
129      * @param period new period for interval, null means zero length
130      * @throws IllegalArgumentException if the end is before the start
131      * @throws ArithmeticException if the start instant exceeds the capacity of a long
132      */

133     void setPeriodBeforeEnd(ReadablePeriod period);
134
135 }
136
Popular Tags