⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intmatrix.java

📁 用java写的jt-jpeg。jt表示java time package
💻 JAVA
字号:
package jpeg;
import jcp.*;

/**
 *  IntMatrix.java
 *
 *  A utility class for encapsulating integer matrices.
 */

public class IntMatrix extends Signal
{

    private int[][] matrix;

    /**
     *  @arg input  An array of equal length arrays, representing
     *  a matrix of int[row][col]
     */
    public IntMatrix(int[][] input) {
        // Assume that input is a square matrix
        matrix = new int[input.length][input[0].length];

        // Copy the contents of the array
        for (int i=0; i < matrix.length; i++) {
            System.arraycopy(input[i],0,
                             matrix[i],0,
                             input[i].length);
        }
    }

    public IntMatrix() {
        return;
    }

    /**
     *  Returns the entry of the matrix at the specified location.
     *  @arg row A number from 0 to (number of rows - 1)
     *  @arg col A number from 0 to (number of columns - 1)
     */
    public int valueAt(int row, int col) {
        return matrix[row][col];
    }

    /**
     *  Returns the number of rows in the matrix.
     */
    public int rows() { return matrix.length; }

    /**
     *  Returns the number of columns in the matrix.
     */
    public int columns() { return matrix[0].length; }

    public int[] get_row(int row) { return matrix[row]; }

    public int[][] get_matrix() {

        int[][] newMatrix = new int[matrix.length][matrix[0].length];

        // Copy the contents of the matrix
        for (int i=0; i < newMatrix.length; i++) {
            System.arraycopy(matrix[i],0,
                             newMatrix[i],0,
                             matrix[i].length);
        }

        return newMatrix;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -