[Cruce-commit] SF.net SVN: cruce:[92] Java/trunk/src/prc/bubulina/cruce/remote
Status: Beta
Brought to you by:
caiusb
|
From: <ali...@us...> - 2010-04-01 20:20:32
|
Revision: 92
http://cruce.svn.sourceforge.net/cruce/?rev=92&view=rev
Author: alinposho
Date: 2010-04-01 20:20:26 +0000 (Thu, 01 Apr 2010)
Log Message:
-----------
Am scris codul pentru interfetele la distanta. In plus am adaugat si clasele necesare atat in server cat si in client.
Added Paths:
-----------
Java/trunk/src/prc/bubulina/cruce/remote/Card.java
Java/trunk/src/prc/bubulina/cruce/remote/ClientInterface.java
Java/trunk/src/prc/bubulina/cruce/remote/Color.java
Java/trunk/src/prc/bubulina/cruce/remote/Player.java
Java/trunk/src/prc/bubulina/cruce/remote/Score.java
Java/trunk/src/prc/bubulina/cruce/remote/ServerInterface.java
Added: Java/trunk/src/prc/bubulina/cruce/remote/Card.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/Card.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/Card.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,6 @@
+package prc.bubulina.cruce.remote;
+
+public class Card
+{
+
+}
Added: Java/trunk/src/prc/bubulina/cruce/remote/ClientInterface.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/ClientInterface.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/ClientInterface.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,67 @@
+package prc.bubulina.cruce.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+
+public interface ClientInterface extends Remote
+{
+ /**
+ * A method to receive informations from the server
+ * @param information
+ * @throws RemoteException
+ */
+ public void inform(String information) throws RemoteException;
+
+ /**
+ * Through this method the client will receive the cards at the beginning of
+ * the round
+ * @param cards The list of card sent by the server
+ * @return True in case the client accepts the cars. False in case the cient rejects the
+ * cards
+ * @throws RemoteException
+ */
+ public boolean receiveCards(ArrayList<Card> cards) throws RemoteException;
+
+ /**
+ * This method forces a client to receive a list of cards
+ * @param cards
+ * @throws RemoteException
+ */
+ public void forceReceive(ArrayList<Card> cards) throws RemoteException;
+
+ /**
+ * Tells the client to bid
+ * @return The amount the client has bidded
+ * @throws RemoteException
+ */
+ public int bid() throws RemoteException;
+
+ /**
+ * Tells the client that he can start sending cards to the server
+ * @throws RemoteException
+ */
+ public void hit() throws RemoteException;
+
+ /**
+ * Informs the player about the tromf
+ * @param tromf
+ * @throws RemoteException
+ */
+ public void setTromf(Color tromf) throws RemoteException;
+
+ /**
+ * Informs the player about the score at the end of the round
+ * @param score
+ * @throws RemoteException
+ */
+ public void receiveRoundScore(Score score) throws RemoteException;
+
+ /**
+ * Informs the player that the game has ended and also sends the overall score
+ * @param score
+ * @throws RemoteException
+ */
+ public void endaGame(Score score) throws RemoteException;
+
+}
Added: Java/trunk/src/prc/bubulina/cruce/remote/Color.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/Color.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/Color.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,9 @@
+package prc.bubulina.cruce.remote;
+
+public enum Color
+{
+ ROSU,
+ DUBA,
+ VERDE,
+ GHINDA
+}
Added: Java/trunk/src/prc/bubulina/cruce/remote/Player.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/Player.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/Player.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,25 @@
+package prc.bubulina.cruce.remote;
+
+public class Player
+{
+ private String name;
+ private int id;
+
+ public Player(String name, int ID)
+ {
+ this.name = name;
+ this.id = ID;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getID()
+ {
+ return id;
+ }
+
+
+}
Added: Java/trunk/src/prc/bubulina/cruce/remote/Score.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/Score.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/Score.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,28 @@
+package prc.bubulina.cruce.remote;
+
+import java.util.Map;
+
+/**
+ * This class will be a container for a name value pair "player-score"
+ * @author alinposho
+ *
+ */
+public class Score
+{
+ private Map<Player, Integer> score;
+
+ public Score(Map<Player, Integer> score)
+ {
+ this.score = score;
+ }
+
+ /**
+ *
+ * @param player
+ * @return The score of the player identified by the argument
+ */
+ public int getYourScore(Player player)
+ {
+ return score.get(player);
+ }
+}
Added: Java/trunk/src/prc/bubulina/cruce/remote/ServerInterface.java
===================================================================
--- Java/trunk/src/prc/bubulina/cruce/remote/ServerInterface.java (rev 0)
+++ Java/trunk/src/prc/bubulina/cruce/remote/ServerInterface.java 2010-04-01 20:20:26 UTC (rev 92)
@@ -0,0 +1,49 @@
+package prc.bubulina.cruce.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface ServerInterface extends Remote
+{
+
+ public Player joinGame(String name) throws RemoteException;
+
+ public void startGame(Player sender) throws RemoteException;
+
+ /**
+ * Though this method the server receives a card sent by the client
+ * @param sender The player who sent the card
+ * @param card The card sent by the player
+ * @return true in case the card sent is according to the rules of the game, false otherwise
+ * @throws RemoteException
+ */
+ public boolean acceptCard(Player sender, Card card) throws RemoteException;
+
+ /**
+ * This method is used to sent a card and an anunt to the server for validation and
+ * storage
+ * @param sender The client who sent the card
+ * @param card
+ * @param anunt The value of the anunt
+ * @return True in case the card and the anunt are sent according to the rules of the
+ * game
+ * @throws RemoteException
+ */
+ public boolean acceptCard(Player sender, Card card, int anunt) throws RemoteException;
+
+ /**
+ *
+ * @return The overall score of the game
+ * @throws RemoteException
+ */
+ public Score getOverallScore() throws RemoteException;
+
+ /**
+ * Method used by the client to register itself to the server in order to be able
+ * to receive notifications
+ * @param callback
+ * @throws RemoteException
+ */
+ public void registerForNotifications(ClientInterface callback) throws RemoteException;
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|