2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package org.ufcspa.simdecs.bn.entity;
7 import java.io.Serializable;
9 import javax.persistence.*;
16 public class Node implements Serializable {
17 private static final long serialVersionUID = 1L;
19 @GeneratedValue(strategy = GenerationType.AUTO)
24 private NodeType nodeType;
26 private Integer time = 0;
28 private Float cost = 0.0f;
31 private BayesianNetwork bayesianNetwork;
33 @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy = "node")
34 private List<Question> questions;
40 public void setId(Long id) {
44 public String getName() {
48 public void setName(String name) {
52 public NodeType getNodeType() {
56 public void setNodeType(NodeType nodeType) {
57 this.nodeType = nodeType;
60 public Integer getTime() {
64 public void setTime(Integer time) {
68 public float getCost() {
72 public void setCost(float cost) {
76 public BayesianNetwork getBayesianNetwork() {
77 return bayesianNetwork;
80 public void setBayesianNetwork(BayesianNetwork bayesianNetwork) {
81 this.bayesianNetwork = bayesianNetwork;
84 public List<Question> getQuestions() {
88 public void setQuestions(List<Question> questions) {
89 this.questions = questions;
93 public int hashCode() {
95 hash += (getId() != null ? getId().hashCode() : 0);
100 public boolean equals(Object object) {
101 // TODO: Warning - this method won't work in the case the id fields are not set
102 if (!(object instanceof Node)) {
105 Node other = (Node) object;
106 if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
113 public String toString() {
114 return "org.ufcspa.simdecs.entity.Node[ id=" + getId() + " ]";