-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMensagem.java
More file actions
executable file
·49 lines (41 loc) · 993 Bytes
/
Mensagem.java
File metadata and controls
executable file
·49 lines (41 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public abstract class Mensagem {
protected final int ABERTA = 0;
protected final int ENVIADA = 1;
protected final int ERRO = 2;
protected int estado;
protected String conteudo;
protected String dataHora;
protected String destinatario;
public Mensagem(String newDestinatario, String newConteudo, String newDataHora){
this.estado = this.ABERTA;
this.conteudo = newConteudo;
this.dataHora = newDataHora;
this.destinatario = newDestinatario;
}
public abstract boolean verifica();
public int getEstado(){
return this.estado;
}
public String getConteudo(){
return this.conteudo;
}
public String getDataHora(){
return this.dataHora;
}
public String getDestinatario(){
return this.destinatario;
}
public boolean enviaMensagem(){
if (
this.verifica() &&
this.estado == this.ABERTA &&
!this.destinatario.equals("")
){
this.estado = this.ENVIADA;
return true;
} else {
this.estado = this.ERRO;
return false;
}
}
}