-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
130 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
package de.stefanhoth.android.got2048.logic.model; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
/** | ||
* Represents one cell on the playing field | ||
* | ||
* @author Stefan Hoth <[email protected]> | ||
* date: 20.03.14 20:25 | ||
* @since 0.1 | ||
*/ | ||
public class Cell { | ||
public class Cell implements Parcelable { | ||
|
||
private int row; | ||
private int column; | ||
|
@@ -25,10 +28,11 @@ public int getColumn() { | |
return column; | ||
} | ||
|
||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
if (o == null || ((Object) this).getClass() != o.getClass()) return false; | ||
|
||
Cell cell = (Cell) o; | ||
|
||
|
@@ -45,4 +49,30 @@ public int hashCode() { | |
result = 31 * result + column; | ||
return result; | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeInt(this.row); | ||
dest.writeInt(this.column); | ||
} | ||
|
||
private Cell(Parcel in) { | ||
this.row = in.readInt(); | ||
this.column = in.readInt(); | ||
} | ||
|
||
public static Parcelable.Creator<Cell> CREATOR = new Parcelable.Creator<Cell>() { | ||
public Cell createFromParcel(Parcel source) { | ||
return new Cell(source); | ||
} | ||
|
||
public Cell[] newArray(int size) { | ||
return new Cell[size]; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters