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

📄 matrix.java

📁 数独的一种实现
💻 JAVA
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2/13/2008 10:16:10 PM
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Matrix.java


public class Matrix
{

    public Matrix(int i, int j)
    {
        matrix = new int[i][j];
    }

    public void validateParameters(int i, int j)
    {
        if(i >= getNumRows())
            throw new IndexOutOfBoundsException((new StringBuilder()).append("This matrix has only ").append(getNumRows()).append(" rows ").append(" you requested ").append(i).append("!").toString());
        if(j >= getNumColumns())
            throw new IndexOutOfBoundsException((new StringBuilder()).append("This matrix has only ").append(getNumColumns()).append(" columns you requested ").append(j).append("!").toString());
        else
            return;
    }

    public int get(int i, int j)
    {
        validateParameters(i, j);
        return matrix[i][j];
    }

    public void set(int i, int j, int k)
    {
        validateParameters(i, j);
        matrix[i][j] = k;
    }

    public int getNumRows()
    {
        return matrix.length;
    }

    public int getNumColumns()
    {
        if(getNumRows() == 0)
            return 0;
        else
            return matrix[0].length;
    }

    protected int matrix[][];
}

⌨️ 快捷键说明

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