01: package com.xoetrope.survey;
02:
03: /**
04: *
05: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
06: * the GNU Public License (GPL), please see license.txt for more details. If
07: * you make commercial use of this software you must purchase a commercial
08: * license from Xoetrope.</p>
09: * <p> $Revision: 1.5 $</p>
10: */
11: public class Option {
12: /**
13: * The option ID
14: */
15: protected int id;
16: /**
17: * The option text
18: */
19: protected String text;
20:
21: /**
22: * Create a new option
23: * @param vid the option id/value
24: * @param caption the option text
25: */
26: public Option(int vid, String caption) {
27: id = vid;
28: text = caption;
29: }
30:
31: /**
32: * Gets the id of this option
33: * @return this option's id
34: */
35: public int getId() {
36: return id;
37: }
38:
39: /**
40: * Gets the text of this option
41: * @return the text
42: */
43: public String getText() {
44: return text;
45: }
46:
47: /**
48: * Sets the new id of this option
49: * @param newId the id to be set
50: */
51: public void setId(int newId) {
52: id = newId;
53: }
54:
55: /**
56: * Sets the new text of this option
57: * @param newText the text to be set
58: */
59: public void setText(String newText) {
60: text = newText;
61: }
62:
63: public String toString() {
64: return text;
65: }
66:
67: public boolean equals(Object o) {
68: if (!(o instanceof Option))
69: return false;
70:
71: Option option = (Option) o;
72: return (id == option.getId());
73: }
74:
75: }
|