Comentario.java 2.18 KB
  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
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
package circusRefine.gui;

import net.sourceforge.czt.base.ast.Term;
import circusRefine.core.relations.RelationRowLaw;
import circusRefine.core.relations.RelationsUtils;
import circusRefine.util.CommentsType;

/**
* Classe que guarda um comentario realizado pelo Usuario
*
* @author Alessandro
*/
public class Comentario {
/**
* Identifica se é o comentario C1, C2, etc...
*/
private int identificador;
/**
* O texto propriamente dito do comentario
*/
private String texto;
/**
* Tipo de comentario, podendo ser tanto um comentario de Lei, quanto de Termo
*/
private CommentsType tipo;
/* Term que foi alvo de comentario*/
private Term termoComentado;
/* Aplicacao de Lei que foi alvo de Comentario*/
private RelationRowLaw aplicLeiComentada;
public Comentario (int idt, String text, Term term, RelationRowLaw lei) {
identificador = idt;
texto = text;
if (term == null) {
tipo = CommentsType.COMENTARIO_DE_LEI;
aplicLeiComentada = lei;
}
else {
tipo = CommentsType.COMENTARIO_DE_TERMO;
termoComentado = term;
}
}
public Comentario () {
identificador = 0;
texto = "";
}
public int getLinha(){
if (tipo.equals(CommentsType.COMENTARIO_DE_TERMO)){
return RelationsUtils.retornarTopo(termoComentado).getLinhaInicial();
}
return aplicLeiComentada.getLinha();
}
public int getLinhaFinal(){
if (tipo.equals(CommentsType.COMENTARIO_DE_TERMO)){
return RelationsUtils.retornarTopo(termoComentado).getLinhaFinal();
}
return aplicLeiComentada.getLinha();
}
public int getIdentificador () {
return identificador;
}
public String getTexto(){
return texto;
}
public void setTexto(String text) {
this.texto = text;
}
public void setIdentficador (int idt) {
this.identificador = idt;
}
public CommentsType getCommentType () {
return tipo;
}
public Term getTermoComentado () {
return termoComentado;
}
public boolean hasAnotherRelation(Term term){
boolean result = false;
//if (RelationsUtils.retornaPilha(term))
return result;
}
public RelationRowLaw getAplicLeiComentada(){
return aplicLeiComentada;
}
}