GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

TimePeriod.java

Go to the documentation of this file.
00001 package org.gridlab.gat.util;
00002 
00003 /**
00004  * An instance of this class represents a time period. 
00005  * A time period is an period of time.
00006  */
00007 public class TimePeriod implements java.io.Serializable {
00008    /**
00009     * This member variable represents the start time of this TimePeriod
00010     */
00011     private long startTime;
00012     
00013    /**
00014     * This member variable represents the stop time of this TimePeriod
00015     */
00016     private long stopTime;
00017     
00018    /**
00019     * This method constructs a TimePeriod instance corresponding to the
00020     * passed StartTime and StopTime. 
00021     *
00022     * @param startTime The number of milliseconds after January 1, 1970, 
00023     * 00:00:00 GMT when the time period starts, a long
00024     * @param stopTime The number of milliseconds after January 1, 1970, 
00025     * 00:00:00 GMT when the time period stops, a long
00026     */
00027     public TimePeriod(long startTime, long stopTime) {
00028         this.stopTime = stopTime;
00029         this.startTime = startTime;
00030     }
00031     
00032    /**
00033     * Tests this TimePeriod for equality with the passed Object.
00034     * <p>
00035     * If the given object is not a TimePeriod, then this method immediately
00036     * returns false.
00037     * <p>
00038     * If the passed object is a TimePeriod, then it is deemed equal if it has a 
00039     * numerically equivalent start time and a numerically equivalent stop time 
00040     * to the passed TimePeriod instance.  
00041     *
00042     * @param object The Object to test for equality
00043     * @return A boolean indicating equality
00044     */
00045     public boolean equals(Object object) {
00046         TimePeriod timePeriod = null;
00047         
00048         if( false == (object instanceof TimePeriod))
00049           return false;
00050           
00051         timePeriod = (TimePeriod) object;
00052         
00053         if( startTime != timePeriod.startTime )
00054           return false;
00055         if( stopTime != timePeriod.stopTime )
00056           return false;
00057         
00058         return true;
00059     }
00060     
00061    /**
00062     * This method returns the number of milliseconds after January 1, 1970, 
00063     * 00:00:00 GMT when the time period starts, a long 
00064     *
00065     * @return The number of milliseconds after January 1, 1970, 00:00:00 
00066     * GMT when the time period starts, a long 
00067     */
00068     public long getStartTime() {
00069         return startTime;
00070     }
00071     
00072    /**
00073     * This method returns the number of milliseconds after January 1, 1970, 
00074     * 00:00:00 GMT when the time period stops, a long 
00075     *
00076     * @return The number of milliseconds after January 1, 1970, 00:00:00 
00077     * GMT when the time period stops, a long 
00078     */
00079     public long getStopTime() {
00080         return stopTime;
00081     }
00082 }