Android Open Source - DroidSweeper Field






From Project

Back to project page DroidSweeper.

License

The source code is released under:

MIT License

If you think the Android project DroidSweeper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.nisble.droidsweeper.game;
//  ww  w. j  a  v a2  s  .co  m
import java.io.Serializable;

import de.nisble.droidsweeper.game.jni.FieldStatus;

/** Serializable container that abstracts the preferences of a field.<br>
 * <ul>
 * <li>Immutable: Members are public final and capitalized.</li>
 * <li>Serializable: Do not change this class!</li>
 * </ul>
 * @author Moritz Nisbl moritz.nisble@gmx.de */
public final class Field implements Serializable {
  private static final long serialVersionUID = 1L;

  /** The position. */
  public final Position POSITION;
  /** The current status. */
  public final FieldStatus STATUS;
  /** The count of adjacent bombs. */
  public final int ADJACENT_BOMBS;

  /** Instantiate a new Field.
   * @param position The position.
   * @param status The status (mapped from libmsm).
   * @param adjacentBombs The count of adjacent bombs. */
  public Field(Position position, FieldStatus status, int adjacentBombs) {
    POSITION = position;
    STATUS = status;
    ADJACENT_BOMBS = adjacentBombs;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ADJACENT_BOMBS;
    result = prime * result + ((POSITION == null) ? 0 : POSITION.hashCode());
    result = prime * result + ((STATUS == null) ? 0 : STATUS.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (!(obj instanceof Field))
      return false;
    Field other = (Field) obj;
    if (ADJACENT_BOMBS != other.ADJACENT_BOMBS)
      return false;
    if (POSITION == null) {
      if (other.POSITION != null)
        return false;
    } else if (!POSITION.equals(other.POSITION))
      return false;
    if (STATUS != other.STATUS)
      return false;
    return true;
  }

  @Override
  public String toString() {
    return "Field [POSITION=" + POSITION.toString() + ", STATUS=" + STATUS.toString() + ", ADJACENT_BOMBS="
        + ADJACENT_BOMBS + "]";
  }
}




Java Source Code List

de.nisble.droidsweeper.config.ApplicationConfig.java
de.nisble.droidsweeper.config.Constants.java
de.nisble.droidsweeper.config.GameConfig.java
de.nisble.droidsweeper.config.Level.java
de.nisble.droidsweeper.game.Field.java
de.nisble.droidsweeper.game.GameObserver.java
de.nisble.droidsweeper.game.Game.java
de.nisble.droidsweeper.game.Position.java
de.nisble.droidsweeper.game.database.DSDBAdapter.java
de.nisble.droidsweeper.game.database.DSDBContract.java
de.nisble.droidsweeper.game.database.DSDBGameEntry.java
de.nisble.droidsweeper.game.database.DSDBHelper.java
de.nisble.droidsweeper.game.jni.FieldListener.java
de.nisble.droidsweeper.game.jni.FieldStatus.java
de.nisble.droidsweeper.game.jni.GameStatus.java
de.nisble.droidsweeper.game.jni.MatrixObserver.java
de.nisble.droidsweeper.game.jni.MineSweeperMatrix.java
de.nisble.droidsweeper.game.replay.PlayerObserver.java
de.nisble.droidsweeper.game.replay.Player.java
de.nisble.droidsweeper.game.replay.Recorder.java
de.nisble.droidsweeper.game.replay.Replay.java
de.nisble.droidsweeper.game.replay.TimeStep.java
de.nisble.droidsweeper.gui.DroidSweeperActivity.java
de.nisble.droidsweeper.gui.HighScoreActivity.java
de.nisble.droidsweeper.gui.HighScoreListAdapter.java
de.nisble.droidsweeper.gui.SettingsActivity.java
de.nisble.droidsweeper.gui.grid.FieldDrawables.java
de.nisble.droidsweeper.gui.grid.FieldView.java
de.nisble.droidsweeper.gui.grid.GameGridView.java
de.nisble.droidsweeper.utilities.LogDog.java
de.nisble.droidsweeper.utilities.Timer.java