View Javadoc

1   package cz.cuni.amis.pogamut.sposh.elements;
2   /**
3    * It is more or less time and units of time. Used for timeouts of POSH plan.
4    * 
5    * @author Honza
6    */
7   @Deprecated
8   public class SolTime {
9   
10      @Deprecated
11  	public enum TimeUnits {
12  		HOURS("hours", 0),
13  		MINUTES("minutes", 1),
14  		SECONDS("seconds", 2),
15  		NONE("none", 3);
16  
17  		private final String name;
18  		private final int id;
19  
20  		private TimeUnits(String name, int id) {
21  			this.name = name;
22  			this.id = id;
23  		}
24  
25  		@Override
26  		public String toString() {
27  			return name;
28  		}
29  
30  		public int getId() {
31  			return id;
32  		}
33  	}
34  	
35  	private TimeUnits _units;
36  	private double _count;
37  	
38  	SolTime(TimeUnits units, String count) {
39  		this._count = new Double(count).doubleValue();
40  		this._units = units;
41  	}
42  
43  	/**
44  	 * Create a default time "0 none"
45  	 */
46  	public SolTime() {
47  		this(TimeUnits.NONE, "0");
48  	}
49  	
50  	@Override
51  	public String toString() {
52  		if (!TimeUnits.NONE.equals(_units))
53  			return "("+getUnits()+" "+getCount()+")";
54  		return "";
55  	}
56  
57  	/**
58  	 * @return the _units
59  	 */
60  	public TimeUnits getUnits() {
61  		return _units;
62  	}
63  
64  	/**
65  	 * @param units the _units to set
66  	 */
67  	public void setUnits(TimeUnits units) {
68  		this._units = units;
69  	}
70  
71  	/**
72  	 * @return the _count
73  	 */
74  	public double getCount() {
75  		return _count;
76  	}
77  
78  	/**
79  	 * @param count the _count to set
80  	 */
81  	public void setCount(double count) {
82  		this._count = count;
83  	}
84  
85  }