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 NodeType nodeRole;
28 private Integer time = 0;
30 private Float cost = 0.0f;
33 private BayesianNetwork bayesianNetwork;
35 @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy = "node")
36 private List<Question> questions;
42 public void setId(Long id) {
46 public String getName() {
50 public void setName(String name) {
54 public NodeType getNodeType() {
58 public void setNodeType(NodeType nodeType) {
59 this.nodeType = nodeType;
62 public NodeType getNodeRole() {
66 public void setNodeRole(NodeType nodeRole) {
67 this.nodeRole = nodeRole;
70 public Integer getTime() {
74 public void setTime(Integer time) {
78 public float getCost() {
82 public void setCost(float cost) {
86 public BayesianNetwork getBayesianNetwork() {
87 return bayesianNetwork;
90 public void setBayesianNetwork(BayesianNetwork bayesianNetwork) {
91 this.bayesianNetwork = bayesianNetwork;
94 public List<Question> getQuestions() {
98 public void setQuestions(List<Question> questions) {
99 this.questions = questions;
103 public int hashCode() {
105 hash += (getId() != null ? getId().hashCode() : 0);
110 public boolean equals(Object object) {
111 // TODO: Warning - this method won't work in the case the id fields are not set
112 if (!(object instanceof Node)) {
115 Node other = (Node) object;
116 if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
123 public String toString() {
124 return "org.ufcspa.simdecs.entity.Node[ id=" + getId() + " ]";