ConjuntoRedundancia.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 ConjuntoRedundancia {
  12. private BlocoRedundancia[] blocosRed;
  13. public ConjuntoRedundancia(){
  14. this.blocosRed = new BlocoRedundancia[4];
  15. for(int i = 0; i < 4; i++){
  16. this.blocosRed[i] = new BlocoRedundancia();
  17. }
  18. }
  19. public BlocoRedundancia[] getBlocos(){
  20. return this.blocosRed;
  21. }
  22. public boolean hasErroInPalavra(int bloco, int palavra){
  23. return this.blocosRed[bloco].getPalavra(palavra).hasError();
  24. }
  25. public boolean isPalavraValida(int bloco, int palavra){
  26. return this.blocosRed[bloco].getPalavras()[palavra].isValid();
  27. }
  28. public Integer getTagFromPalavra(int bloco, int palavra){
  29. return this.blocosRed[bloco].getTagFromAWord(palavra);
  30. }
  31. public void writeAWord(int tag, int bloco, int palavra){
  32. this.blocosRed[bloco].writeAWord(palavra, tag);
  33. }
  34. }