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:
Ida Massow 2011-04-30 14:47:42 +02:00
parent 214b5a0bd6
commit 1a42f934ac
13 changed files with 99 additions and 3 deletions

View file

@ -10,8 +10,14 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View file

@ -1,11 +1,13 @@
package jrummikub.model; package jrummikub.model;
/** Class managing the overall and momentary GameState */
public class GameState { public class GameState {
private Table table; private Table table;
private Player[] players; private Player[] players;
private int activePlayer; private int activePlayer;
private StoneHeap gameHeap; private StoneHeap gameHeap;
/** Changes the activePlayer to the next {@link Player} in the list */
public void nextPlayer() { public void nextPlayer() {
} }

View file

@ -1,13 +1,28 @@
package jrummikub.model; package jrummikub.model;
/** Class managing a {@link Player}'s {@link Stone}s */
public class Hand { public class Hand {
private Stone[] stones; private Stone[] stones;
private Position[] position; 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) { 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) { public void drop(Stone stone, Position position) {
} }

View file

@ -2,9 +2,10 @@ package jrummikub.model;
import java.awt.Color; import java.awt.Color;
/** Class managing player data. No methods in release 1 */
public class Player { public class Player {
private Hand hand; private Hand hand;
// Könnten wir einfach die Steinfarben vergeben?
private Color color; private Color color;
// private String name; // private String name;

View file

@ -1,5 +1,10 @@
package jrummikub.model; package jrummikub.model;
/**
* {@link Stone} Position class to determine positions on {@link Table} or
* {@link Hand}
*/
public class Position { public class Position {
private float x; private float x;
private float y; private float y;

View file

@ -1,11 +1,11 @@
package jrummikub.model; package jrummikub.model;
/** */
/** Basic Rummikub Stone */
public class Stone { public class Stone {
private int value; private int value;
private StoneColor color; private StoneColor color;
private final boolean joker; private final boolean joker;
public Stone(int value, StoneColor color, boolean joker) { public Stone(int value, StoneColor color, boolean joker) {
this.value = value; this.value = value;

View file

@ -1,5 +1,6 @@
package jrummikub.model; package jrummikub.model;
/** Class specifing possible StoneColors */
public enum StoneColor { public enum StoneColor {
BLACK, ORANGE, BLUE, RED BLACK, ORANGE, BLUE, RED
} }

View file

@ -1,16 +1,31 @@
package jrummikub.model; package jrummikub.model;
/** Class managing {@link Stone}s joined together to form sets */
public class StoneSet { public class StoneSet {
private Stone[] stones; private Stone[] stones;
/** Test for rule conflict within the StoneSet */
public boolean isValid() { 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) { 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) { public StoneSet join(StoneSet other) {
} }

View file

@ -1,5 +1,7 @@
package jrummikub.model; package jrummikub.model;
/** Class administering the {@link Stone}s on the game-Table */
public class Table { public class Table {
private StoneSet[] sets; private StoneSet[] sets;
private Position[] positions; private Position[] positions;
@ -7,22 +9,51 @@ public class Table {
// Constructor // Constructor
public Table gameTable = new Table(); 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) { 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) { 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) { 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) { public void drop(Position position, StoneSet stones) {
} }
/** Tests the Table for rule conflicts by checking all the {@link StoneSets} */
public boolean isValid() { public boolean isValid() {
} }

View file

@ -0,0 +1,5 @@
package jrummikub.model;
public class GameStateTest {
}

View file

@ -0,0 +1,5 @@
package jrummikub.model;
public class HandTest {
}

View file

@ -0,0 +1,5 @@
package jrummikub.model;
public class PlayerTest {
}

View file

@ -0,0 +1,5 @@
package jrummikub.model;
public class TableTest {
}