Der Datentyp Matrize

package fft;

class Matrix {
        
        Object[][] data;
        
        Matrix(int rows, int cols) {
                data = new Object[rows][cols];
        }
        
        void setValue(int row, int column, Object o) {
                data[row][column] = o;
        }
        
        Object getValue(int row, int column) {
                return data[row][column];
        }
        
        public String toString() {
                String result = "";
                for(int i = 0; i < 4; i++) {
                        result += "|";
                        for(int j = 0; j < 4; j++) {
                                result += " (" + data[i][j] + ")";
                        }
                        result += "|" + System.getProperty("line.separator");
                }
                return result;
        }
}

-- Christo - 12 Dec 2003

This topic: Java > WebHome > JavaProgramming > FourierBeipspiel > MatrixKlasse
Topic revision: 2003-12-12, ChristopherHuhn
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)