Refactorings for RedeBayesiana and ArquivoRedeBayesiana.
[simdecs_seam.git] / SimDeCS / src / main / org / ufcspa / simdecs / entities / Nodo.java
CommitLineData
59e4c94a
MS
1package org.ufcspa.simdecs.entities;
2
3import java.io.Serializable;
4
d1c23fc5 5import javax.persistence.CascadeType;
59e4c94a
MS
6import javax.persistence.Column;
7import javax.persistence.Entity;
8import javax.persistence.GeneratedValue;
9import javax.persistence.GenerationType;
10import javax.persistence.Id;
11import javax.persistence.JoinColumn;
12import javax.persistence.ManyToOne;
13import javax.persistence.SequenceGenerator;
14import javax.persistence.Table;
15
16import org.hibernate.annotations.Index;
17
18
19@Entity
20@Table(name="Nodo")
21@SequenceGenerator(name = "sequenceNodo", sequenceName = "sqNodo", initialValue = 1, allocationSize=1)
22public class Nodo implements Serializable {
23
24 private static final long serialVersionUID = 6879782331178330999L;
25
26 @Id
27 @GeneratedValue(generator="sequenceNodo", strategy=GenerationType.AUTO)
28 private Long id;
29
30 @Column(length=100, nullable=false)
31 private String nome;
32
33 @Column(length=10, nullable=true)
34 private Float custo;
35
36 @Column(length=10, nullable=true)
37 private Long tempo;
38
d1c23fc5
MS
39 @ManyToOne(cascade=CascadeType.ALL)
40 @JoinColumn(name = "redeBayesiana_id", referencedColumnName = "id", nullable = true)
41 @Index(name="nodo_redeBayesiana_fk_i")
42 private RedeBayesiana redeBayesiana;
59e4c94a
MS
43
44 public Long getId() {
45 return id;
46 }
47 public void setId(Long id) {
48 this.id = id;
49 }
50 public String getNome() {
51 return nome;
52 }
53 public void setNome(String nome) {
54 this.nome = nome;
55 }
56 public Float getCusto() {
57 return custo;
58 }
59 public void setCusto(Float custo) {
60 this.custo = custo;
61 }
62 public Long getTempo() {
63 return tempo;
64 }
65 public void setTempo(Long tempo) {
66 this.tempo = tempo;
67 }
68
d1c23fc5
MS
69 public RedeBayesiana getRedeBayesiana() {
70 return redeBayesiana;
59e4c94a
MS
71 }
72
d1c23fc5
MS
73 public void setRedeBayesiana(RedeBayesiana rede) {
74 this.redeBayesiana = rede;
59e4c94a
MS
75 }
76
77 public String toString() {
78 return id + " - " + nome;
79 }
80
81 @Override
82 public int hashCode() {
83 final int prime = 31;
84 int result = 1;
85 result = prime * result + ((id == null) ? 0 : id.hashCode());
86 return result;
87 }
88
89 @Override
90 public boolean equals(Object obj) {
91 if (this == obj)
92 return true;
93 if (obj == null)
94 return false;
95 if (getClass() != obj.getClass())
96 return false;
97 Nodo other = (Nodo) obj;
98 if (id == null) {
99 if (other.id != null)
100 return false;
101 } else if (!id.equals(other.id))
102 return false;
103 return true;
104 }
105
106 public Nodo() {
107
108 }
109}