simpleglider.java

来自「jboss规则引擎」· Java 代码 · 共 38 行

JAVA
38
字号
package org.drools.examples.conway.patterns;

/**
 * Represents a simple glider
 * 
 * @author <a href="mailto:brown_j@ociweb.com">Jeff Brown</a>
 * @see ConwayPattern
 * @see org.drools.examples.conway.CellGrid
 */
public class SimpleGlider
    implements
    ConwayPattern {

    private final boolean[][] grid = {{false, true, false}, {true, false, false}, {true, true, true}};

    /**
     * This method should return a 2 dimensional array of boolean that represent
     * a conway grid, with <code>true</code> values in the positions where
     * cells are alive
     * 
     * @return array representing a conway grid
     */
    public boolean[][] getPattern() {
        return this.grid;
    }

    /**
     * @return the name of this pattern
     */
    public String getPatternName() {
        return "Simple Glider";
    }

    public String toString() {
        return getPatternName();
    }
}

⌨️ 快捷键说明

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