Class WordEntry

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int fNumRefs  
      protected int[] fRefs  
      protected char[] fWord  
    • Constructor Summary

      Constructors 
      Constructor Description
      WordEntry()  
      WordEntry​(char[] word)  
    • Field Detail

      • fWord

        protected char[] fWord
      • fNumRefs

        protected int fNumRefs
      • fRefs

        protected int[] fRefs
    • Constructor Detail

      • WordEntry

        public WordEntry()
      • WordEntry

        public WordEntry​(char[] word)
    • Method Detail

      • addRef

        public int addRef​(int fileNum)
        Adds a reference and records the change in footprint.
      • addRefs

        public void addRefs​(int[] refs)
        Adds a set of references and records the change in footprint.
      • footprint

        public int footprint()
        Returns the size of the wordEntry
      • getNumRefs

        public int getNumRefs()
        Returns the number of references, e.g. the number of files this word appears in.
      • getRef

        public int getRef​(int i)
        returns the file number in the i position in the list of references.
      • getRefs

        public int[] getRefs()
        Returns the references of the wordEntry (the number of the files it appears in).
      • getWord

        public char[] getWord()
        returns the word of the wordEntry.
      • mapRefs

        public void mapRefs​(int[] mappings)
        Changes the references of the wordEntry to match the mapping. For example,
        if the current references are [1 3 4]
        and mapping is [1 2 3 4 5]
        in references 1 becomes mapping[1] = 2, 3->4, and 4->5
        => references = [2 4 5].
      • reset

        public void reset​(char[] word)
        Clears the wordEntry.