36c428faf7a6ae02332e086d22ada9166d1b8e2b
[simdecs.git] / src / java / org / ufcspa / simdecs / bn / entity / Answer.java
1 /*
2  * To change this template, choose Tools | Templates
3  * and open the template in the editor.
4  */
5 package org.ufcspa.simdecs.bn.entity;
6
7 import java.io.Serializable;
8 import javax.persistence.*;
9
10 /**
11  *
12  * @author mchelem
13  */
14 @Entity
15 public class Answer implements Serializable {
16     private static final long serialVersionUID = 1L;
17     @Id
18     @GeneratedValue(strategy = GenerationType.AUTO)
19     private Long id;
20     
21     private String text;
22     
23     private float likelihood;
24     
25     @ManyToOne
26     private Question question;
27
28     public Long getId() {
29         return id;
30     }
31
32     public void setId(Long id) {
33         this.id = id;
34     }
35
36     public String getText() {
37         return text;
38     }
39
40     public void setText(String text) {
41         this.text = text;
42     }
43
44     public float getLikelihood() {
45         return likelihood;
46     }
47
48     public void setLikelihood(float likelihood) {
49         this.likelihood = likelihood;
50     }
51
52     public Question getQuestion() {
53         return question;
54     }
55
56     public void setQuestion(Question question) {
57         this.question = question;
58     }
59
60     @Override
61     public int hashCode() {
62         int hash = 0;
63         hash += (id != null ? id.hashCode() : 0);
64         return hash;
65     }
66
67     @Override
68     public boolean equals(Object object) {
69         // TODO: Warning - this method won't work in the case the id fields are not set
70         if (!(object instanceof Answer)) {
71             return false;
72         }
73         Answer other = (Answer) object;
74         if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
75             return false;
76         }
77         return true;
78     }
79
80     @Override
81     public String toString() {
82         return "org.ufcspa.simdecs.entity.Answer[ id=" + id + " ]";
83     }
84     
85 }