Word.java
contents ::
  AppWord.java
  out
  reading
  Sort.java
  test1
  Word.java

/*
  James Little
  Sat 17 March, Exercise 4, COSC 241
  Program reads a stream of texts and counts the 
  frequency of the words contained.
  
  Updated to read frequency of characters for exercise 7 
  3/4/01
*/

package jlittle_ex7;

/** Class stores char, but before that String.. and now byte.. or is it int?? wasup here??
 no it is int... confusing!.. now its a byte again? -- sorry using char now */

public class Word {
    
    // CHANGED James Little 3/4/01 - word now a char
    private int word;
    private String c;
    private int count=1;

    public Word(int word){
         this.word=word;
    }// end Word constructor

    // CHANGED James Little 3/4/01 - getWord returns a char
    public int getWord(){
         return word;
    }// end getWord

    public String getString(){
         if(word==13)c=(char)92 + "u000D";
         else if(word==32)c=(char)92 + "u0020";
         else if(word==10)c=(char)92 + "u000A";
         else if(word==9)c=(char)92 + "u0009";
         else if(word==11)c=(char)92 + "u000B";
         else c= "something went booboo";
         return c;
    }// end getc

    public char getChar(){
         return (char)word;
    }
    public void addOne(){
         count++;
    }// end addOne

    // ADDED James Little 3/4/01 - so that calculations can be done in main method.
    public int getCount(){
         return count;
    }
    
    public boolean equals(int x){
         return (this.word==x);
    }

}// end Word class

James Little