Revision 44757

View differences:

tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
    <modelVersion>4.0.0</modelVersion>
5
    <groupId>org.gvsig</groupId>
6
    <artifactId>org.gvsig.timesupport</artifactId>
7
    <packaging>pom</packaging>
8
    <name>${project.artifactId}</name>
9
    <description>TimeSupport example project</description>
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.desktop.library</artifactId>
13
        <version>2.0.267</version>
14
    </parent>
15
    <build>
16
        <plugins>
17
            <plugin>
18
                <groupId>org.codehaus.mojo</groupId>
19
                <artifactId>animal-sniffer-maven-plugin</artifactId>
20
                <configuration>
21
                    <skip>true</skip>
22
                </configuration>
23
            </plugin>
24

  
25
        </plugins>
26
    </build>
27
    <dependencyManagement>
28
        <dependencies>
29

  
30
            <dependency>
31
                <groupId>org.swinglabs</groupId>
32
                <artifactId>swingx</artifactId>  	
33
                <version>1.6</version>
34
            </dependency>
35
            <dependency>
36
                <groupId>com.toedter</groupId>
37
                <artifactId>jcalendar</artifactId>
38
                <version>1.3.2</version>  				
39
            </dependency>	
40
        </dependencies>
41
    </dependencyManagement>
42

  
43

  
44
    <modules>
45
        <module>org.gvsig.timesupport.lib</module>
46
        <module>org.gvsig.timesupport.swing</module>	
47
    </modules>
48

  
49
</project>
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.timesupport.TimeSupportLibrary
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/animation/TimeAnimation.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport.animation;
23

  
24
import org.gvsig.timesupport.Interval;
25
import org.gvsig.timesupport.RelativeInterval;
26
import org.gvsig.tools.observer.Observable;
27

  
28
public interface TimeAnimation extends Observable {
29

  
30
    public static final int YEAR = 0;
31
    public static final int MONTH = 1;
32
    public static final int WEEK = 2;
33
    public static final int DAY = 3;
34
    public static final int HOUR = 4;
35
    public static final int MINUTE = 5;
36
    public static final int SECOND = 6;
37
    public static final int MILLISECOND = 7;
38

  
39
    public static final int STOPED = 0;
40
    public static final int PLAYING = 1;
41
    public static final int PAUSED = 2;
42

  
43
    public interface TimeAnimationRenderer {
44
        public void begin();
45
        public void render(Interval time);
46
        public void end();
47
    }
48
    /**
49
     * Stops the animation
50
     */
51
    public void stop();
52

  
53
    /**
54
     * Pauses the animation
55
     */
56
    public void pause();
57

  
58
    /**
59
     * Play the animation
60
     */
61
    public void play();
62

  
63
    /**
64
     * Return is the animation is playing.
65
     *
66
     * @return
67
     */
68
    public boolean isPlaying();
69
    
70
    public int getStatus();
71

  
72
    public RelativeInterval getInterval();
73

  
74
    public void setInterval(RelativeInterval interval);
75
    
76
    public void inferStepScale();
77
    
78
    public void setPauseTime(long time);
79
    
80
    public long getPauseTime();
81

  
82
    public void setFramesPerSecond(double fps);
83
    
84
    public double getFramesPerSecond();
85
    
86
    public long getStep();
87

  
88
    public int getStepScale();
89

  
90
    public void setStep(long step);
91

  
92
    public long getStep(int scale);
93

  
94
    public void setStep(long step, int scale);
95

  
96
    public int getStepCount();
97
    
98
    public RelativeInterval getCurrentTime();
99
    
100
    public int getCurrentPosition();
101
    
102
    public void setCurrentPosition(int position);
103
    
104
    public int getIterations();
105
    
106
    public void setIterations(int iterations);
107

  
108
    public int getCurrentIteration();
109
 
110
    public String getStatusLabel(int status);   
111
    
112
    public String getScaleLabel(int scale);
113
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/AbsoluteInstantTypeNotRegisteredException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
/**
25
 * Exception thrown when there is an error getting a TimeSupport message.
26
 * 
27
 * @author gvSIG team
28
 * @version $Id$
29
 */
30
public class AbsoluteInstantTypeNotRegisteredException extends TimeSupportException {
31

  
32
    private static final long serialVersionUID = -4051458353306878010L;
33

  
34
    private static final String MESSAGE =
35
        "An error has been produced " + "getting the AbsoluteInstantTypeNotRegisteredException";
36

  
37
    private static final String KEY = "_AbsoluteInstantTypeNotRegisteredException";
38

  
39
    /**
40
     * Creates a new {@link AbsoluteInstantTypeNotRegisteredException}.
41
     * 
42
     * @param cause
43
     *            the original cause
44
     */
45
    public AbsoluteInstantTypeNotRegisteredException(int dateTimeFieldTypeNotRegisteredException) {
46
        super(MESSAGE, null, KEY, serialVersionUID);
47
    }
48
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/AbsoluteIntervalTypeNotRegisteredException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
/**
25
 * Exception thrown when there is an error getting a TimeSupport message.
26
 * 
27
 * @author gvSIG team
28
 * @version $Id$
29
 */
30
public class AbsoluteIntervalTypeNotRegisteredException extends TimeSupportException {
31

  
32
    private static final long serialVersionUID = -4051458353306878010L;
33

  
34
    private static final String MESSAGE =
35
        "An error has been produced " + "getting the AbsoluteIntervalTypeNotRegisteredException";
36

  
37
    private static final String KEY = "_absoluteIntervalTypeNotRegisteredException";
38

  
39
    /**
40
     * Creates a new {@link AbsoluteIntervalTypeNotRegisteredException}.
41
     * 
42
     * @param cause
43
     *            the original cause
44
     */
45
    public AbsoluteIntervalTypeNotRegisteredException(int durationFieldTypeNotRegisteredException) {
46
        super(MESSAGE, null, KEY, serialVersionUID);
47
    }
48
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/EditableRelativeInstant.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24

  
25
/**
26
 * <p>
27
 * The {@link RelativeInstant} ins inmutable, but sometimes is necessary to
28
 * edit it. This class is an editable copy of a realtive instant that
29
 * cab be edited.
30
 * </p>
31
 * <p>
32
 * A huge part of the documentation of this class has been retrieved
33
 * from the joda-time library.
34
 * </p>
35
 * 
36
 * @see http://joda-time.sourceforge.net
37
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
38
 * 
39
 * @author gvSIG Team
40
 * @version $Id$
41
 *
42
 */
43
public interface EditableRelativeInstant extends RelativeInstant{
44
    
45
    /**
46
     * Set the time from fields. The date part of this object will be unaffected.
47
     *
48
     * @param hour
49
     *          the hour
50
     * @param minuteOfHour
51
     *          the minute of the hour
52
     * @param secondOfMinute
53
     *          the second of the minute
54
     * @param millisOfSecond
55
     *          the millisecond of the second
56
     * @throws IllegalArgumentException if the value is invalid
57
     * 
58
     */
59
    public void setTime(final int hour, final int minuteOfHour, final int secondOfMinute, final int millisOfSecond);
60

  
61
    /**
62
     * Set the date from fields. The time part of this object will be unaffected.
63
     *
64
     * @param year
65
     *          the year
66
     * @param monthOfYear
67
     *          the month of the year
68
     * @param dayOfMonth
69
     *          the day of the month
70
     * @throws IllegalArgumentException if the value is invalid
71
     */
72
    public void setDate(final int year, final int monthOfYear, final int dayOfMonth);
73
    
74
    /**
75
     * Add a number of years to the date.
76
     *
77
     * @param years  the years to add
78
     * @throws IllegalArgumentException if the value is invalid
79
     */
80
    public void addYears(final int years);
81
    
82
    /**
83
     * Add a number of days to the date.
84
     *
85
     * @param days
86
     *          the days to add
87
     * @throws IllegalArgumentException if the value is invalid
88
     */
89
    public void addDays(final int days);
90
           
91
    /**
92
     * Add a number of hours to the date.
93
     *
94
     * @param hours  
95
     *          the hours to add
96
     * @throws IllegalArgumentException if the value is invalid
97
     */
98
    public void addHours(final int hours);
99
    
100
    /**
101
     * Add a number of minutes to the date.
102
     *
103
     * @param minutes
104
     *          the minutes to add
105
     * @throws IllegalArgumentException if the value is invalid
106
     */
107
    public void addMinutes(final int minutes);
108
    
109
    /**
110
     * Add a number of seconds to the date.
111
     *
112
     * @param seconds
113
     *            the seconds to add
114
     * @throws IllegalArgumentException if the value is invalid
115
     */
116
    public void addSeconds(final int seconds);
117
    
118
    /**
119
     * Add a number of millis to the date.
120
     *
121
     * @param millis
122
     *          the millis to add
123
     * @throws IllegalArgumentException if the value is invalid
124
     */
125
    public void addMillis(final int millis);
126
}
127

  
128

  
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/TimeSupportException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.exception.BaseException;
25

  
26
/**
27
 * Generic exception thrown in the TimeSupport API when the exception or error
28
 * may be dealt by the program or the user of the program which is a client of
29
 * the TimeSupport API.
30
 * 
31
 * @see {@link TimeFactoryService}
32
 * @see {@link TimeSupportManager}
33
 * @author gvSIG team.
34
 * @version $Id$
35
 */
36
public class TimeSupportException extends BaseException {
37

  
38
    private static final long serialVersionUID = 6756475060924237176L;
39

  
40
    private static final String MESSAGE =
41
        "An error has been produced in the TimeSupport library";
42

  
43
    private static final String KEY = "_TimeSupportException";
44

  
45
    /**
46
     * Constructor to be used in rare cases, usually you must create a new child
47
     * exception class for each case.
48
     * <strong>Don't use this constructor in child classes.</strong>
49
     */
50
    public TimeSupportException() {
51
        super(MESSAGE, KEY, serialVersionUID);
52
    }
53

  
54
    /**
55
     * Constructor to be used in rare cases, usually you must create a new child
56
     * exception class for each case.
57
     * <p>
58
     * <strong>Don't use this constructor in child classes.</strong>
59
     * </p>
60
     * 
61
     * @param cause
62
     *            the original cause of the exception
63
     */
64
    public TimeSupportException(Exception cause) {
65
        super(MESSAGE, cause, KEY, serialVersionUID);
66
    }
67

  
68
    /**
69
     * @see BaseException#BaseException(String, String, long).
70
     * @param message
71
     *            the default messageFormat to describe the exception
72
     * @param key
73
     *            the key to use to search a localized messageFormnata
74
     * @param code
75
     *            the unique code to identify the exception
76
     */
77
    protected TimeSupportException(String message, String key, long code) {
78
        super(message, key, code);
79
    }
80

  
81
    /**
82
     * @see BaseException#BaseException(String, Throwable, String, long).
83
     * @param message
84
     *            the default messageFormat to describe the exception
85
     * @param cause
86
     *            the original cause of the exception
87
     * @param key
88
     *            the key to use to search a localized messageFormnata
89
     * @param code
90
     *            the unique code to identify the exception
91
     */
92
    protected TimeSupportException(String message, Throwable cause,
93
        String key, long code) {
94
        super(message, cause, key, code);
95
    }
96
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/RelativeInstant.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import java.util.Date;
25

  
26
import org.gvsig.tools.lang.Cloneable;
27

  
28
/**
29
 * <p>
30
 * A relative instant is defined like an instant in the datetime continuum 
31
 * specified as a number of milliseconds from 1970-01-01T00:00Z. This definition 
32
 * of milliseconds is consistent with that of the JDK in Date or Calendar.
33
 * </p>
34
 * <p>It contains also a Chronology which determines how the millisecond 
35
 * instant value is converted into the date time fields. The default Chronology 
36
 * can be set using the {@link TimeSupportManager} class. (e.g: 1st January 2010)
37
 * </p>
38
 * <p>
39
 * A huge part of the documentation of this class has been retrieved
40
 * from the joda-time library.
41
 * </p>
42
 * 
43
 * @see http://joda-time.sourceforge.net
44
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
45
 * 
46
 * @author gvSIG team
47
 * @version $Id$
48
 */
49
public interface RelativeInstant extends Instant, Cloneable{
50
  
51
    /**
52
     * Get the date time as a <code>java.util.Date</code>.
53
     * <p>
54
     * The <code>Date</code> object created has exactly the same millisecond
55
     * instant as this object.
56
     * </p>
57
     *
58
     * @return 
59
     *          a Date initialised with this relative instant
60
     */
61
    public Date toDate();
62
    
63
    /**
64
     * Compares this object with the specified object for ascending
65
     * millisecond instant order. This ordering is inconsistent with
66
     * equals, as it ignores the Chronology.
67
     *
68
     * @param instant
69
     *          a readable instant to check against
70
     * @return 
71
     *          negative value if this is less, 0 if equal, or positive 
72
     *          value if greater
73
     */
74
    public int compareTo(Instant instant);
75
             
76
    /**
77
     * Gets the milliseconds of the datetime instant from the Java epoch
78
     * of 1970-01-01T00:00:00Z.
79
     * 
80
     * @return 
81
     *          the number of milliseconds since 1970-01-01T00:00:00Z
82
     */
83
    public long toMillis();    
84
    
85
    /**
86
     * Get the year field value.
87
     * 
88
     * @return 
89
     *          the year
90
     */
91
    public int getYear();
92

  
93
    /**
94
     * Get the month of year field value.
95
     * 
96
     * @return 
97
     *          the month of year
98
     */
99
    public int getMonthOfYear();
100
 
101
    /**
102
     * Get the day of month field value.
103
     * 
104
     * @return 
105
     *          the day of month
106
     */
107
    public int getDayOfMonth();
108

  
109
    /**
110
     * Get the hour of day field value.
111
     * 
112
     * @return 
113
     *          the hour of month
114
     */
115
    public int getHourOfDay();
116

  
117
    /**
118
     * Get the minute of day field value.
119
     * 
120
     * @return 
121
     *          the minute of day
122
     */
123
    public int getMinuteOfDay();
124

  
125
    /**
126
     * Get the minute of hour field value.
127
     * 
128
     * @return 
129
     *          the minute of hour
130
     */
131
    public int getMinuteOfHour();   
132

  
133
    /**
134
     * Get the second of day field value.
135
     * 
136
     * @return 
137
     *          the second of day
138
     */
139
    public int getSecondOfDay();
140

  
141
    /**
142
     * Get the second of minute field value.
143
     * 
144
     * @return 
145
     *          the second of minute
146
     */
147
    public int getSecondOfMinute();
148

  
149
    /**
150
     * Get the millis of second field value.
151
     * 
152
     * @return 
153
     *          the millis of second
154
     */
155
    public int getMillisOfSecond();
156
    
157
    /**
158
     * Get an editable copy used to edit other instance of
159
     * a relative instant. The new copy is initialized with
160
     * the values of this intant.
161
     *    
162
     * @return
163
     *          a copy to edit the instant 
164
     */
165
    public EditableRelativeInstant getEditableCopy();
166
      
167
}
168

  
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.timesupport package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>TimeSupport library API.</p>
11
	
12
	<p>
13
	It allows to get new TimeSupport and get their text.
14
	</p>
15

  
16
</body>
17
</html>
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/AbsoluteInstant.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.lang.Cloneable;
25

  
26

  
27
/**
28
 * <p>
29
 * It defines a partial time that does not support every datetime field,
30
 * and is thus a local time. It cannot be compared to a {@link RelativeInstant},
31
 * as it does not fully specify an instant in time. 
32
 * </p>
33
 * <p>
34
 * The time it does specify is a local time, and does not include a time zone. 
35
 * An AbsoluteInstant supports a subset of the fields on the chronology.
36
 * </p> 
37
 * <p>
38
 * A huge part of the documentation of this class has been retrieved
39
 * from the joda-time library.
40
 * </p>
41
 * 
42
 * @see http://joda-time.sourceforge.net
43
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
44
 * 
45
 * @author gvSIG team
46
 * @version $Id$
47
 */
48
public interface AbsoluteInstant extends Instant, Cloneable{
49
   
50
    /**
51
     * Gets the number of fields in this absolute instant.     
52
     * @return 
53
     *          the field count
54
     */
55
    public int size();
56
   
57
    /**
58
     * Gets the field type at the specified index.
59
     * @param index 
60
     *          the index to retrieve
61
     * @return 
62
     *          the field at the specified index
63
     */
64
    public AbsoluteInstantType getFieldType(int index);
65
    
66
    /**
67
     * Gets the value of the field at the specifed index.
68
     * @param index 
69
     *          the index
70
     * @return the value
71
     * @throws IndexOutOfBoundsException if the index is invalid
72
     */
73
    public int getValue(int index);
74
    
75
    /**
76
     * Gets the number of years of this absolute instant. 
77
     * @return
78
     *          the number of years
79
     */
80
    public int getYears();
81

  
82
    /**
83
     * Gets the number of months of this absolute instant. 
84
     * @return
85
     *          the number of months
86
     */
87
    public int getMonths();
88

  
89
    /**
90
     * Gets the number of weeks of this absolute instant. 
91
     * @return
92
     *          the number of weeks
93
     */
94
    public int getWeeks();
95
    
96
    /**
97
     * Gets the number of days of this absolute instant. 
98
     * @return
99
     *          the number of days
100
     */
101
    public int getDays();
102

  
103
    /**
104
     * Gets the number of hours of this absolute instant. 
105
     * @return
106
     *          the number of hours
107
     */
108
    public int getHours();
109

  
110
    /**
111
     * Gets the number of minutes of this absolute instant. 
112
     * @return
113
     *          the number of minutes
114
     */
115
    public int getMinutes();
116

  
117
    /**
118
     * Gets the number of seconds of this absolute instant. 
119
     * @return
120
     *          the number of seconds
121
     */
122
    public int getSeconds();
123
    
124
    /**
125
     * Gets the number of millis of this absolute instant. 
126
     * @return
127
     *          the number of millis
128
     */
129
    public int getMillis();
130
        
131
    /**
132
     * Gets the duration of the instant. It returns a duration assuming a 365
133
     * days year, 12 months year, 30 days month, 7 day week, 24 hour day, 60 minute hour,
134
     * 60 second minute and 1000 millis second. 
135
     * @return
136
     *          a duration equivalent to this instant from the time 0
137
     */
138
    public Duration toStandardDuration();
139
    
140
    /**
141
     * Gets a copy of this instance with the specified period take away.
142
     * If the amount is zero or null, then <code>this</code> is returned.     *
143
     * @param period  
144
     *          the period to reduce this instant by
145
     * @return 
146
     *          a copy of this instance with the period taken away
147
     * @throws ArithmeticException if the new instant exceeds the capacity of a long
148
     */
149
    public AbsoluteInstant minus(AbsoluteInterval interval);
150

  
151
    /**
152
     * Gets a copy of this instance with the specified period added.
153
     * If the amount is zero or null, then <code>this</code> is returned.
154
     *
155
     * @param period
156
     *          the duration to add to this one, null means zero
157
     * @return
158
     *          a copy of this instance with the period added
159
     * @throws ArithmeticException if the new instant exceeds the capacity of a long
160
     */
161
    public AbsoluteInstant plus(AbsoluteInterval interval);     
162
}
163

  
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/TimeSupportLocator.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.locator.BaseLocator;
25
import org.gvsig.tools.locator.Locator;
26
import org.gvsig.tools.locator.LocatorException;
27

  
28
/**
29
 * This locator is the entry point for the TimeSupport library, providing
30
 * access to all TimeSupport services through the {@link TimeSupportManager}
31
 * .
32
 * 
33
 * @author gvSIG team
34
 * @version $Id$
35
 */
36
public class TimeSupportLocator extends BaseLocator {
37

  
38
    /**
39
     * TimeSupport manager name.
40
     */
41
    public static final String MANAGER_NAME = "TimeSupport.manager";
42

  
43
    /**
44
     * TimeSupport manager description.
45
     */
46
    public static final String MANAGER_DESCRIPTION = "TimeSupport Manager";
47

  
48
    private static final String LOCATOR_NAME = "TimeSupport.locator";
49

  
50
    /**
51
     * Unique instance.
52
     */
53
    private static final TimeSupportLocator INSTANCE =
54
        new TimeSupportLocator();
55

  
56
    /**
57
     * Return the singleton instance.
58
     * 
59
     * @return the singleton instance
60
     */
61
    public static TimeSupportLocator getInstance() {
62
        return INSTANCE;
63
    }
64

  
65
    /**
66
     * Return the Locator's name.
67
     * 
68
     * @return a String with the Locator's name
69
     */
70
    public final String getLocatorName() {
71
        return LOCATOR_NAME;
72
    }
73

  
74
    /**
75
     * Return a reference to the TimeSupportManager.
76
     * 
77
     * @return a reference to the TimeSupportManager
78
     * @throws LocatorException
79
     *             if there is no access to the class or the class cannot be
80
     *             instantiated
81
     * @see Locator#get(String)
82
     */
83
    public static TimeSupportManager getManager() throws LocatorException {
84
        return (TimeSupportManager) getInstance().get(MANAGER_NAME);
85
    }
86

  
87
    /**
88
     * Registers the Class implementing the TimeSupportManager interface.
89
     * 
90
     * @param clazz
91
     *            implementing the TimeSupportManager interface
92
     */
93
    public static void registerManager(
94
        Class<? extends TimeSupportManager> clazz) {
95
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
96
    }
97

  
98
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/RelativeInterval.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.lang.Cloneable;
25

  
26

  
27
/**
28
 * <p>
29
 * A RelativeInterval is defined like an interval between two {@link RelativeInstant}s.
30
 * </p>
31
 * <p>
32
 * A huge part of the documentation of this class has been retrieved
33
 * from the joda-time library.
34
 * </p>
35
 * 
36
 * @see http://joda-time.sourceforge.net
37
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
38
 * 
39
 * @author gvSIG team
40
 * @version $Id$
41
 */
42
public interface RelativeInterval extends Interval, Cloneable{
43
    
44
    /**
45
     * Does this time interval contain the specified instant.     * 
46
     * @param instant
47
     *          the instant, null means now
48
     * @return 
49
     *          <code>true</code> if this time interval contains the instant
50
     */
51
    public boolean contains(RelativeInstant instant);
52
    
53
    /**
54
     * Does this time interval contain the specified interval.     * 
55
     * @param instant
56
     *          the time interval to compare to, null means a zero 
57
     *          duration interval now
58
     * @return 
59
     *          <code>true</code> if this time interval contains the interval
60
     */
61
    public boolean contains(RelativeInterval interval);
62
    
63
    /**
64
     * Does this time interval overlap the specified time interval.
65
     * @param interval
66
     *          the time interval to compare to, null means a zero 
67
     *          length interval now
68
     * @return
69
     *          <code>true</code> if the time intervals overlap
70
     */
71
    public boolean overlaps(RelativeInterval interval);
72
    
73
    /**
74
     * Is this time interval after the specified instant. Intervals are inclusive
75
     * of the start instant and exclusive of the end.
76
     * @param instant
77
     *          the instant to compare to, null means now
78
     * @return
79
     *          <code>true</code> if this time interval is after the instant
80
     */
81
    public boolean isAfter(RelativeInstant instant);
82

  
83
    /**
84
     * Is this time interval entirely after the specified interval.
85
     * Intervals are inclusive of the start instant and exclusive of the end.
86
     * Only the end time of the specified interval is used in the comparison.
87
     * @param interval
88
     *          the interval to compare to, null means now
89
     * @return 
90
     *          <code>true</code> if this time interval is after the interval specified
91
     */
92
    public boolean isAfter(RelativeInterval interval);
93

  
94
    /**
95
     * Is this time interval before the specified instant. Intervals are inclusive
96
     * of the start instant and exclusive of the end.
97
     * @param instant
98
     *          the instant to compare to, null means now
99
     * @return
100
     *          <code>true</code> if this time interval is before the instant
101
     */
102
    public boolean isBefore(RelativeInstant instant);
103

  
104
    /**
105
     * Is this time interval entirely before the specified interval.
106
     * Intervals are inclusive of the start instant and exclusive of the end.
107
     * Only the end time of the specified interval is used in the comparison.
108
     * @param interval
109
     *          the interval to compare to, null means now
110
     * @return 
111
     *          <code>true</code> if this time interval is before the interval specified
112
     */
113
    public boolean isBefore(RelativeInterval interval);
114
    
115
    /**
116
     * Gets the duration of this time interval.
117
     * @return
118
     *          the duration of the time interval
119
     */
120
    public Duration toDuration();
121
        
122
    /**
123
     * Gets the duration of this time interval in milliseconds. 
124
     * The duration is equal to the end millis minus the start millis.     
125
     * @return
126
     *          the duration of the time interval in milliseconds
127
     */
128
    public long toDurationMillis();
129
      
130
    /**
131
     * Gets the start of this time interval, which is inclusive, as an Instant. 
132
     * @return
133
     *          the start of the time interval
134
     */
135
    public RelativeInstant getStart();
136

  
137
    /**
138
     * Gets the end of this time interval, which is exclusive, as an Instant. 
139
     * @return
140
     *          the end of the time interval
141
     */
142
    public RelativeInstant getEnd();
143
}
144

  
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/Instant.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24

  
25
/**
26
 * <p>
27
 * An Instant represents a position in a time scale. In practice, 
28
 * an instant is an interval whose duration is less than the resolution
29
 * of the time scale.
30
 * </p>
31
 * <p>All the Instant subclasses have to be immutable and have to 
32
 * provide a Chronology as well. All standard Chronology classes are
33
 * also immutable.
34
 * </p>
35
 * <p>
36
 * A huge part of the documentation of this class has been retrieved
37
 * from the joda-time library.
38
 * </p>
39
 * 
40
 * @see http://joda-time.sourceforge.net
41
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
42
 * 
43
 * @author gvSIG Team
44
 * @version $Id$
45
 * 
46
 */
47
public interface Instant extends Time{
48
   
49
    /**
50
     * Is this instant equal to the instant passed in comparing solely by millisecond. 
51
     * @param instant
52
     *          an instant to check against, null means now 
53
     * @return
54
     *          <code>true</code> if the instant is equal to the instant passed in
55
     */
56
    public boolean isEqual(Instant instant);
57
    
58
    /**
59
     * Is this instant after the instant passed in comparing solely by millisecond. 
60
     * @param instant
61
     *          an instant to check against, null means now 
62
     * @return
63
     *          <code>true</code> if the instant is after the instant passed in
64
     */
65
    public boolean isAfter(Instant instant);
66
    
67
    /**
68
     * Is this instant before the instant passed in comparing solely by millisecond. 
69
     * @param instant
70
     *          an instant to check against, null means now 
71
     * @return
72
     *          <code>true</code> if the instant is before the instant passed in
73
     */
74
    public boolean isBefore(Instant instant);
75

  
76
    /**
77
     * Output the instant using the specified format pattern.
78
     *
79
     * @param 
80
     *          pattern  the pattern specification, null means 
81
     *          use <code>toString</code>
82
     */
83
    public String toString(String pattern);   
84
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/TimeSupportLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.ToolsLibrary;
25
import org.gvsig.tools.ToolsLocator;
26
import org.gvsig.tools.dataTypes.DataTypesManager;
27
import org.gvsig.tools.library.AbstractLibrary;
28
import org.gvsig.tools.library.LibraryException;
29
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
30

  
31
/**
32
 * Library for API initialization and configuration.
33
 * 
34
 * @author gvSIG team
35
 * @version $Id$
36
 */
37
public class TimeSupportLibrary extends AbstractLibrary {
38
    
39
    @Override
40
    public void doRegistration() {
41
        registerAsAPI(TimeSupportLibrary.class);
42
        require(ToolsLibrary.class);
43
    }
44
    
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
        DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager();
48
        dataTypesManager.addtype(DataTypes.INSTANT, "Instant", "Instant", RelativeInstant.class, null);
49
        dataTypesManager.addtype(DataTypes.INTERVAL, "Interval","Interval", RelativeInterval.class, null);
50
    }
51

  
52
    @Override
53
    protected void doPostInitialize() throws LibraryException {
54
        // Validate there is any implementation registered.
55
        TimeSupportManager manager = TimeSupportLocator.getManager();
56
        if (manager == null) {
57
            throw new ReferenceNotRegisteredException(
58
                TimeSupportLocator.MANAGER_NAME, TimeSupportLocator
59
                    .getInstance());
60
        }       
61
       
62
    }
63

  
64
}
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/AbsoluteInstantType.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24

  
25
/**
26
 * <p>
27
 * Identifies a field, such as year or minuteOfHour, in a chronology-neutral way.
28
 * </p>
29
 * <p>
30
 * Instances of this class are singletons and they can be compared using the
31
 * {@link AbsoluteInstantType}{@link #getType()} method and the <code>==</code>
32
 * operator.
33
 * </p>
34
 * <p>
35
 * A huge part of the documentation of this class has been retrieved
36
 * from the joda-time library.
37
 * </p>
38
 * 
39
 * @see http://joda-time.sourceforge.net
40
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
41
 * 
42
 * @author gvSIG team
43
 * @version $Id$
44
 */
45
public interface AbsoluteInstantType {
46
	 public static final int ERA = 1;
47
	 public static final int YEAR_OF_ERA = 2;
48
	 public static final int CENTURY_OF_ERA = 3;
49
	 public static final int YEAR_OF_CENTURY = 4;
50
	 public static final int YEAR = 5;
51
	 public static final int DAY_OF_YEAR = 6;
52
	 public static final int MONTH_OF_YEAR = 7;
53
	 public static final int DAY_OF_MONTH = 8;
54
	 public static final int WEEKYEAR_OF_CENTURY = 9;
55
	 public static final int WEEKYEAR = 10;
56
	 public static final int WEEK_OF_WEEKYEAR = 11;
57
	 public static final int DAY_OF_WEEK = 12;
58
	 public static final int HALFDAY_OF_DAY = 13;
59
	 public static final int HOUR_OF_HALFDAY = 14;
60
	 public static final int CLOCKHOUR_OF_HALFDAY = 15;
61
	 public static final int CLOCKHOUR_OF_DAY = 16;
62
	 public static final int HOUR_OF_DAY = 17;
63
	 public static final int MINUTE_OF_DAY = 18;
64
	 public static final int MINUTE_OF_HOUR = 19;
65
	 public static final int SECOND_OF_DAY = 20;
66
	 public static final int SECOND_OF_MINUTE = 21;
67
	 public static final int MILLIS_OF_DAY = 22;
68
	 public static final int MILLIS_OF_SECOND = 23;
69
	
70
	 /**
71
	  * Gets the code of the type, that is one of the constants defined
72
	  * in the {@link AbsoluteInstantType} class.
73
	  * @return
74
	  *            the type code
75
	  */
76
	 public int getType();
77
	 
78
	 /**
79
	  * Gets a description of the {@link AbsoluteInstantType}.
80
	  * @return
81
	  *            the name of the type
82
	  */
83
	 public String getName();
84
}
85

  
tags/org.gvsig.desktop-2.0.267/org.gvsig.desktop.library/org.gvsig.timesupport/org.gvsig.timesupport.lib/org.gvsig.timesupport.lib.api/src/main/java/org/gvsig/timesupport/AbsoluteInterval.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.timesupport;
23

  
24
import org.gvsig.tools.lang.Cloneable;
25

  
26

  
27
/**
28
 * <p>
29
 * Is defined like an interval between two absolute instants. 
30
 * </p>
31
 * <p>
32
 * A huge part of the documentation of this class has been retrieved
33
 * from the joda-time library.
34
 * </p>
35
 * 
36
 * @see http://joda-time.sourceforge.net
37
 * @see https://gvsig.org/web/projects/gvsig-desktop/docs/devel/org-gvsig-sensors/1-0.0/analysis-and-design/detailed-view/time-support/libraries/org-gvsig-timesupport-lib
38
 * 
39
 * @author gvSIG team
40
 * @version $Id$
41
 */
42
public interface AbsoluteInterval extends Interval, Cloneable{
43
    
44
    /**
45
     * Gets the start of this time interval, which is inclusive, as an Instant. 
46
     * @return
47
     *          the start of the time interval
48
     */
49
    public AbsoluteInstant getStart();
50
    
51
    /**
52
     * Gets the end of this time interval, which is exclusive, as an Instant. 
53
     * @return
54
     *          the end of the time interval
55
     */
56
    public AbsoluteInstant getEnd();
57
    
58
    /**
59
     * Gets the number of fields that this absolute interval supports.
60
     * @return 
61
     *          the number of fields supported
62
     */   
63
    public int size();
64

  
65
    /**
66
     * Gets the field type at the specified index.
67
     * @param index 
68
     *          the index to retrieve
69
     * @return 
70
     *          the field at the specified index
71
     */
72
    public AbsoluteIntervalType getFieldType(int index);
73

  
74
    /**
75
     * Gets the value at the specified index.
76
     *
77
     * @param index  
78
     *          the index to retrieve
79
     * @return
80
     *          the value of the field at the specified index
81
     * @throws IndexOutOfBoundsException if the index is invalid
82
     */
83
    public int getValue(int index);
84

  
85
    /**
86
     * Gets the number of years of this absolute instant. 
87
     * @return
88
     *          the number of years
89
     */
90
    public int getYears();
91

  
92
    /**
93
     * Gets the number of months of this absolute instant. 
94
     * @return
95
     *          the number of months
96
     */
97
    public int getMonths();
98

  
99
    /**
100
     * Gets the number of days of this absolute instant. 
101
     * @return
102
     *          the number of days
103
     */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff