01: /*
02: * Bossa Workflow System
03: *
04: * $Id: DeterministicTimeSource.java,v 1.2 2004/02/24 19:25:58 gdvieira Exp $
05: *
06: * Copyright (C) 2003,2004 OpenBR Sistemas S/C Ltda.
07: *
08: * This file is part of Bossa.
09: *
10: * Bossa is free software; you can redistribute it and/or modify it
11: * under the terms of version 2 of the GNU General Public License as
12: * published by the Free Software Foundation.
13: *
14: * This program is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * General Public License for more details.
18: *
19: * You should have received a copy of the GNU General Public
20: * License along with this program; if not, write to the
21: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22: * Boston, MA 02111-1307, USA.
23: */
24:
25: package com.bigbross.bossa;
26:
27: import java.util.Date;
28:
29: /**
30: * This class implements a deterministic time source. Once the time of
31: * this time source is set, it will remain constant until it is set
32: * again. <p>
33: *
34: * @author <a href="http://www.bigbross.com">BigBross Team</a>
35: */
36: public class DeterministicTimeSource implements TimeSource {
37:
38: private Date time;
39:
40: /**
41: * Creates a new deterministic time source. <p>
42: */
43: public DeterministicTimeSource() {
44: time = null;
45: }
46:
47: /**
48: * Sets the time of this time source. <p>
49: *
50: * @param time the new time.
51: */
52: public void setTime(Date time) {
53: this .time = (Date) time.clone();
54: }
55:
56: /**
57: * @see com.bigbross.bossa.TimeSource#getTime()
58: */
59: public Date getTime() {
60: return this .time != null ? (Date) this.time.clone() : null;
61: }
62: }
|