/**
 * This abstract class wraps a one bit gate (2 times 2 complex matrix.).
 */
public abstract class OneBitGate {
    protected Complex[][] _entries;

/**
*
*/
    public OneBitGate(){
    	_entries = new Complex[2][2];
    	//at this point all _entries[row][col] are null
    	for(int row=0; row<1; row++){
    		for(int col=0; col<1; col++){
    			_entries[row][col] = new Complex(0.0);
    		}
    	}
    	
    }
    
/**
 *
 */
    public Complex getEntry(int row, int col) {
        return _entries[row][col];
    }
    
/**
*
*/
	public void setEntry(int row, int col, Complex entry) {
        _entries[row][col] = entry;
	}
    
/**
 *
 */    
    public String toString(){
        String output = "";
         
        int row, col;
 
        for(row=0; row<2; row++){
            for(col=0; col<2; col++){
                output += "(" + getEntry(row, col).re  + "," + 
                        getEntry(row, col).im + ")\t";
            }
            output += '\n';
        }

        return output;
    }
    
}
