//this class represents a word
//it holds an array containing 4 myByte objects
class myWord {

//again this array is public so it's contents can be 
//accessed without accessor methods.
public myByte[] theWord;

//a constructor that takes in 4 myByte objects
//the first myByte is the MSByte
public void myWord(myByte a, myByte b, myByte c, myByte d){
	theWord = new myByte[4];
	theWord[3] = a;
	theWord[2] = b;
	theWord[1] = c;
	theWord[0] = d;
}
//returns the bits of each byte
//starting with the MSByte
public String toString(){
	String temp = "";
	for(int i = 3; i >= 0; i--){
		if (theWord[i] != null){
			temp = temp + "  " + theWord[i].toString();
		}
	}
	return temp;
}
//returns the decimal value of each byte
//starting with the Most Significant byte
public String toStringInt(){
	String temp = "";
	for(int i = 3; i>=0;i--){
		if(theWord[i] != null) {
			temp = temp + "  " + theWord[i].getVal();
		}
	}
	return temp;
}  
//an simple constructor that merely initializes the array
public myWord(){
	theWord = new myByte[4];
}
//a constructor that takes 4 myByte objects
//the first one is the most significant
public myWord(myByte a, myByte b, myByte c, myByte d){
 	theWord = new myByte[4];
	theWord[3] = a;
	theWord[2] = b;
	theWord[1] = c;
	theWord[0] = d;
}

//a method which adds 4 myByte elements into the word array
//the first byte is the most significant
public void addWord(myByte a, myByte b, myByte c, myByte d){
	theWord[3] = a;
	theWord[2] = b;
	theWord[1] = c;
	theWord[0] = d;
}

//a method which adds 4 myByte objects to the word. It takes in the
//myByte objects as an array of myByte objects
public void addWord(myByte[] m){
	for(int i = 0;i<4;i++){
		theWord[i] = m[i];
	}
}

//a construtor that takes in an array of myBytes
public void myWord(myByte[] b){
	theWord = b;
}


//a method which returns the result of
//XORing a word taken in with the current word
//it returns the result as a new word without affecting the
//current word.
public myWord XOR(myWord b){
	myWord temp = new myWord();
	temp.addWord(theWord[3].XOR(b.theWord[3]), theWord[2].XOR(b.theWord[2]), theWord[1].XOR(b.theWord[1]), theWord[0].XOR(b.theWord[0]) );
	return temp;
}

}