1 /*
2 * Copyright (c) 1998-2002 The Jgroup Team.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 *
17 */
18
19 package jgroup.test.hello;
20
21 /**
22 * Answer object returned by sayHello
23 *
24 * @author Alberto Montresor
25 * @author Hein Meling
26 * @since Jgroup 1.0
27 */
28 public class Answer
29 implements java.io.Serializable
30 {
31
32 private static final long serialVersionUID = 473841093424774824L;
33
34 /** Hello message */
35 private String message;
36
37 /** Time at which the last view has been installed by members */
38 private Object[] time;
39
40
41 /**
42 * Creates a new <code>Answer</code> object instance with the
43 * specified message.
44 *
45 * @param message
46 * The message to return as an answer to the sayHello() method.
47 */
48 public Answer(String message)
49 {
50 this.message = message;
51 }
52
53
54 public void setTime(Object[] timeValues)
55 {
56 time = timeValues;
57 }
58
59
60 public String toString()
61 {
62 StringBuilder buf = new StringBuilder();
63 buf.append(message);
64 buf.append(": ");
65 if (time != null) {
66 for (int i = 0; i < time.length; i++) {
67 buf.append(time[i]);
68 buf.append(" ");
69 }
70 }
71 return buf.toString();
72 }
73
74 } // END of Answer