angelegte Model Klassen, alle kommentiert
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@21 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
214b5a0bd6
commit
1a42f934ac
13 changed files with 99 additions and 3 deletions
6
.project
6
.project
|
@ -10,8 +10,14 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sourceforge.metrics.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>net.sourceforge.metrics.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/** Class managing the overall and momentary GameState */
|
||||
public class GameState {
|
||||
private Table table;
|
||||
private Player[] players;
|
||||
private int activePlayer;
|
||||
private StoneHeap gameHeap;
|
||||
|
||||
/** Changes the activePlayer to the next {@link Player} in the list */
|
||||
public void nextPlayer() {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,28 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/** Class managing a {@link Player}'s {@link Stone}s */
|
||||
public class Hand {
|
||||
private Stone[] stones;
|
||||
private Position[] position;
|
||||
|
||||
/**
|
||||
* Removes {@link Stone} from Hand and returns it
|
||||
*
|
||||
* @param position
|
||||
* position of {@link Stone} that will be removed
|
||||
*/
|
||||
public Stone pickUp(Position position) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds {@link Stone} to the Hand
|
||||
*
|
||||
* @param stone
|
||||
* {@link Stone} to add to Hand
|
||||
* @param position
|
||||
* {@link Position} to put the {@link Stone}
|
||||
*/
|
||||
public void drop(Stone stone, Position position) {
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@ package jrummikub.model;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
/** Class managing player data. No methods in release 1 */
|
||||
public class Player {
|
||||
private Hand hand;
|
||||
// Könnten wir einfach die Steinfarben vergeben?
|
||||
|
||||
private Color color;
|
||||
|
||||
// private String name;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/**
|
||||
* {@link Stone} Position class to determine positions on {@link Table} or
|
||||
* {@link Hand}
|
||||
*/
|
||||
|
||||
public class Position {
|
||||
private float x;
|
||||
private float y;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package jrummikub.model;
|
||||
/** */
|
||||
|
||||
/** Basic Rummikub Stone */
|
||||
|
||||
public class Stone {
|
||||
private int value;
|
||||
private StoneColor color;
|
||||
private final boolean joker;
|
||||
|
||||
|
||||
public Stone(int value, StoneColor color, boolean joker) {
|
||||
this.value = value;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/** Class specifing possible StoneColors */
|
||||
public enum StoneColor {
|
||||
BLACK, ORANGE, BLUE, RED
|
||||
}
|
||||
|
|
|
@ -1,16 +1,31 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/** Class managing {@link Stone}s joined together to form sets */
|
||||
public class StoneSet {
|
||||
private Stone[] stones;
|
||||
|
||||
/** Test for rule conflict within the StoneSet */
|
||||
public boolean isValid() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the StoneSet at a specified {@link Position} and returns two new
|
||||
* Stone Sets
|
||||
*
|
||||
* @param position
|
||||
* Splitting {@link Position}
|
||||
*/
|
||||
public StoneSet[] splitAt(int position) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins StoneSet to another StoneSet and returns the resulting new StoneSet
|
||||
*
|
||||
* @param other
|
||||
* StoneSet to be joined to active StoneSet
|
||||
*/
|
||||
public StoneSet join(StoneSet other) {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package jrummikub.model;
|
||||
|
||||
/** Class administering the {@link Stone}s on the game-Table */
|
||||
|
||||
public class Table {
|
||||
private StoneSet[] sets;
|
||||
private Position[] positions;
|
||||
|
@ -7,22 +9,51 @@ public class Table {
|
|||
// Constructor
|
||||
public Table gameTable = new Table();
|
||||
|
||||
/**
|
||||
* Removes {@link Stone} from the Table and returns it
|
||||
*
|
||||
* @param position
|
||||
* {@link Position} of the selected {@link Stone}
|
||||
*/
|
||||
public Stone pickUp(Position position) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a {@link StoneSet} from the Table and returns it
|
||||
*
|
||||
* @param position
|
||||
* {@link Position} of the selected {@link StoneSet}
|
||||
*/
|
||||
public StoneSet pickUpSet(Position position) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a part of a {@link StoneSet} from the Table and returns it
|
||||
*
|
||||
* @param from
|
||||
* Start {@link Position} of the range
|
||||
* @param to
|
||||
* End {@link Position} of the range
|
||||
*/
|
||||
public StoneSet pickUpRange(Position from, Position to) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds {@link StoneSet} to Table
|
||||
*
|
||||
* @param position
|
||||
* Specifies {@link Position} to put the {@link StoneSet}
|
||||
* @param stones
|
||||
* The {@link StoneSet} to add to the Table
|
||||
*/
|
||||
public void drop(Position position, StoneSet stones) {
|
||||
|
||||
}
|
||||
|
||||
/** Tests the Table for rule conflicts by checking all the {@link StoneSets} */
|
||||
public boolean isValid() {
|
||||
|
||||
}
|
||||
|
|
5
test/jrummikub/model/GameStateTest.java
Normal file
5
test/jrummikub/model/GameStateTest.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package jrummikub.model;
|
||||
|
||||
public class GameStateTest {
|
||||
|
||||
}
|
5
test/jrummikub/model/HandTest.java
Normal file
5
test/jrummikub/model/HandTest.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package jrummikub.model;
|
||||
|
||||
public class HandTest {
|
||||
|
||||
}
|
5
test/jrummikub/model/PlayerTest.java
Normal file
5
test/jrummikub/model/PlayerTest.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package jrummikub.model;
|
||||
|
||||
public class PlayerTest {
|
||||
|
||||
}
|
5
test/jrummikub/model/TableTest.java
Normal file
5
test/jrummikub/model/TableTest.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package jrummikub.model;
|
||||
|
||||
public class TableTest {
|
||||
|
||||
}
|
Reference in a new issue