PalavrasRedundancia.java 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package cache;
  7. /**
  8. *
  9. * @author Juninho Carlos
  10. */
  11. public class PalavrasRedundancia {
  12. private boolean validade;
  13. private int tag; //A tag é o número do conjunto
  14. private boolean erro;
  15. public PalavrasRedundancia(){
  16. this.validade = false;
  17. this.erro = false;
  18. this.tag = 0;
  19. }
  20. public void leituraEspecial(int tag){
  21. if(this.tag == tag){
  22. this.validade = false;
  23. this.tag = -1;
  24. }
  25. }
  26. public void inserirErro(){
  27. this.erro = true;
  28. }
  29. public boolean hasError(){
  30. return this.erro;
  31. }
  32. public int getTag(){
  33. return this.tag;
  34. }
  35. public boolean isValid(){
  36. return this.validade;
  37. }
  38. public void writeAWord(int tag){
  39. this.validade = true;
  40. this.tag = tag;
  41. }
  42. }