View Javadoc

1   /*
2    * ProgressionData.java Created @ Jul 6, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   * 
13   */
14  
15  package org.gscg.common.interactionlayer.dataobjects;
16  
17  import java.io.Serializable;
18  
19  /***
20   * The ProgressionData encapsulates all the data necessary to update the time
21   * and progression panel in a user interface.
22   * <p>
23   * 
24   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
25   * Delft, the Netherlands. All rights reserved.
26   * 
27   * See for project information <a href="http://www.simulation.tudelft.nl/">
28   * www.simulation.tudelft.nl </a>.
29   * 
30   * The source code and binary code of this software is proprietary information
31   * of Delft University of Technology.
32   * 
33   * @author <a
34   *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
35   *         van Houten </a>
36   * 
37   * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:58 $
38   * @since 1.0.0
39   */
40  public class ProgressionData implements DataInterface, Serializable
41  {
42  	/*** the serial version uid */
43  	private static final long serialVersionUID = 11L;
44  
45  	/*** the local date key */
46  	public static final String KEY_LOCAL_DATE = "local.date";
47  
48  	/*** the local time key */
49  	public static final String KEY_LOCAL_TIME = "local.time";
50  
51  	/*** the local stop time key */
52  	public static final String KEY_LOCAL_STOP_TIME = "local.stop.time";
53  
54  	/*** the local progress key */
55  	public static final String KEY_LOCAL_PROGRESS = "local.progress";
56  
57  	/*** the local progress time key */
58  	public static final String KEY_LOCAL_PROGRESS_TIME = "local.progress.time";
59  
60  	/*** the date */
61  	private String date = "";
62  
63  	/*** the time */
64  	private String time = "";
65  
66  	/*** the stop time */
67  	private String stopTime = "";
68  
69  	/*** the progress */
70  	private double progress = Double.NaN;
71  
72  	/*** the progress time */
73  	private String progressTime = "";
74  
75  	/***
76  	 * constructs a new ProgressionData object.
77  	 * 
78  	 * @param date the date to show
79  	 * @param time the time to show
80  	 * @param stopTime the stop time
81  	 * @param progress the progress
82  	 * @param progressTime the progress time
83  	 */
84  	public ProgressionData(final String date, final String time,
85  			final String stopTime, final double progress,
86  			final String progressTime)
87  	{
88  		super();
89  		this.date = "  " + date;
90  		this.time = "  " + time;
91  		this.stopTime = stopTime;
92  		this.progress = progress;
93  		this.progressTime = progressTime;
94  	}
95  
96  	/***
97  	 * @see org.gscg.common.interactionlayer.dataobjects.DataInterface#getData(java.lang.String)
98  	 */
99  	public String getData(final String key)
100 	{
101 		if (key.equals(ProgressionData.KEY_LOCAL_DATE))
102 		{
103 			return this.date;
104 		}
105 		if (key.equals(ProgressionData.KEY_LOCAL_PROGRESS))
106 		{
107 			return "" + this.progress;
108 		}
109 		if (key.equals(ProgressionData.KEY_LOCAL_PROGRESS_TIME))
110 		{
111 			return this.progressTime;
112 		}
113 		if (key.equals(ProgressionData.KEY_LOCAL_STOP_TIME))
114 		{
115 			return this.stopTime;
116 		}
117 		if (key.equals(ProgressionData.KEY_LOCAL_TIME))
118 		{
119 			return this.time;
120 		}
121 		return null;
122 	}
123 }