Commit a82482e0 authored by dkonam's avatar dkonam

Ajout de la facade + debut des structures

parent 964c265f
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.facade;
import com.utclo23.data.structure.Event;
import com.utclo23.data.structure.Game;
import com.utclo23.data.structure.LightPublicUser;
import com.utclo23.data.structure.Message;
import com.utclo23.data.structure.Mine;
import com.utclo23.data.structure.PublicUser;
import com.utclo23.data.structure.Ship;
import com.utclo23.data.structure.StatGame;
import java.rmi.server.UID;
import java.util.ArrayList;
import java.util.Date;
/**
*
* @author Davy
*/
public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain{
@Override
public void addNewGame(StatGame game) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setEnnemyShips(ArrayList<Ship> ships) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void forwardCoordinates(Mine mine) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void opponentHasLeftGame() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void connectionLostWithOpponent() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean addConnectedUser() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean removeConnectedUser() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void forwardMessage(Message msg) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PublicUser getMyPublicUserProfile() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void updateGameList(LightPublicUser user, UID id, String role) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<Ship> getShips() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setShip(Ship ship) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean attack(Integer[] coords) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void leaveGame() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<Ship> getInitialBoardFromGameId(UID gameid) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<Event> getPreviousBoard() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<Event> getNextBoard() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void sendMessage(String text) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Game getGame() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void createUser(String playerName, String password, String firstName, String lastName, Date birthDate) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PublicUser getPublicUserProfile(UID id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<StatGame> getGameList() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void createGame(String name, boolean spectator, boolean spectatorChat, String type) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void signin(String username, String password) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void signOut() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ArrayList<LightPublicUser> getConnectedUsers() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.facade;
import com.utclo23.data.structure.*;
import java.rmi.server.UID;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public interface IDataCom {
public void addNewGame(StatGame game);
public void setEnnemyShips(ArrayList<Ship> ships);
public void forwardCoordinates(Mine mine);
public void opponentHasLeftGame();
public void connectionLostWithOpponent();
public boolean addConnectedUser();
public boolean removeConnectedUser();
public void forwardMessage(Message msg);
public PublicUser getMyPublicUserProfile();
public void updateGameList(LightPublicUser user, UID id, String role);
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.facade;
import com.utclo23.data.structure.*;
import java.rmi.server.UID;
import java.util.ArrayList;
import java.util.Date;
/**
*
* @author Davy
*/
public interface IDataIHMMain {
public void createUser(String playerName, String password, String firstName, String lastName, Date birthDate);
public PublicUser getPublicUserProfile(UID id);
public ArrayList<StatGame> getGameList();
public void createGame(String name, boolean spectator, boolean spectatorChat, String type);
public void signin(String username, String password);
public void signOut();
public ArrayList<LightPublicUser> getConnectedUsers();
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.facade;
import com.utclo23.data.structure.*;
import java.rmi.server.UID;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public interface IDataIHMTable {
public ArrayList<Ship> getShips();
public void setShip(Ship ship);
public boolean attack(Integer[] coords);
public void leaveGame();
public ArrayList<Ship> getInitialBoardFromGameId(UID gameid);
public ArrayList<Event> getPreviousBoard();
public ArrayList<Event> getNextBoard();
public void sendMessage(String text);
public Game getGame();
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.util.Date;
/**
*
* @author Davy
*/
public abstract class Event {
private Date timestamp;
public Event() {
this.timestamp = new Date();
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
/**
*
* @author Davy
*/
public class Game {
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.rmi.server.UID;
/**
*
* @author Davy
*/
public class LightPublicUser {
private UID id;
private String playerName;
//TODO avatarThumbnal
public LightPublicUser(UID id, String playerName) {
this.id = id;
this.playerName = playerName;
}
public UID getId() {
return id;
}
public void setId(UID id) {
this.id = id;
}
public String getPlayerName() {
return playerName;
}
public void setPlayerName(String playerName) {
this.playerName = playerName;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public class Message extends Event{
private LightPublicUser sender;
private String content;
private ArrayList<LightPublicUser> recipients;
public Message(LightPublicUser sender, String content, ArrayList<LightPublicUser> recipients) {
this.sender = sender;
this.content = content;
this.recipients = recipients;
}
public LightPublicUser getSender() {
return sender;
}
public void setSender(LightPublicUser sender) {
this.sender = sender;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public ArrayList<LightPublicUser> getRecipients() {
return recipients;
}
public void setRecipients(ArrayList<LightPublicUser> recipients) {
this.recipients = recipients;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
/**
*
* @author Davy
*/
public class Mine extends Event {
private Player owner;
private Integer[] coord;
public Mine(Player owner, int x, int y)
{
this.owner = owner;
this.coord = new Integer[2];
this.coord[0] = x;
this.coord[1] = y;
}
public Player getOwner() {
return owner;
}
public void setOwner(Player owner) {
this.owner = owner;
}
public Integer[] getCoord() {
return coord;
}
public void setCoord(Integer[] coord) {
this.coord = coord;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public class Owner {
private PublicUser userIdentity;
private String password;
private ArrayList<String> discoveryNodes;
private ArrayList<StatGame> savedGamesList;
private ArrayList<StatGame> playedGamesList;
private ArrayList<LightPublicUser> contactList;
public PublicUser getUserIdentity() {
return userIdentity;
}
public void setUserIdentity(PublicUser userIdentity) {
this.userIdentity = userIdentity;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ArrayList<String> getDiscoveryNodes() {
return discoveryNodes;
}
public void setDiscoveryNodes(ArrayList<String> discoveryNodes) {
this.discoveryNodes = discoveryNodes;
}
public ArrayList<StatGame> getSavedGamesList() {
return savedGamesList;
}
public void setSavedGamesList(ArrayList<StatGame> savedGamesList) {
this.savedGamesList = savedGamesList;
}
public ArrayList<StatGame> getPlayedGamesList() {
return playedGamesList;
}
public void setPlayedGamesList(ArrayList<StatGame> playedGamesList) {
this.playedGamesList = playedGamesList;
}
public ArrayList<LightPublicUser> getContactList() {
return contactList;
}
public void setContactList(ArrayList<LightPublicUser> contactList) {
this.contactList = contactList;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.rmi.server.UID;
import java.util.ArrayList;
/**
*
* @author Davy
*/
class Player extends LightPublicUser{
private ArrayList<Ship> ships;
private ArrayList<Mine> mines;
public Player(UID id, String playerName) {
super(id, playerName);
}
public ArrayList<Ship> getShips() {
return ships;
}
public void setShips(ArrayList<Ship> ships) {
this.ships = ships;
}
public ArrayList<Mine> getMines() {
return mines;
}
public void setMines(ArrayList<Mine> mines) {
this.mines = mines;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.util.Date;
/**
*
* @author Davy
*/
public class PublicUser {
private LightPublicUser lightPublicUser;
private String lastName;
private String firstName;
private Date birthDate;
//TODO avatar : picture
public LightPublicUser getLightPublicUser() {
return lightPublicUser;
}
public void setLightPublicUser(LightPublicUser lightPublicUser) {
this.lightPublicUser = lightPublicUser;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public class Ship {
private ShipType type;
private Player owner;
private ArrayList<Integer[]> listCoord;
public Ship(ShipType type, Player owner, ArrayList<Integer[]> listCoord) {
this.type = type;
this.owner = owner;
this.listCoord = listCoord;
}
public ShipType getType() {
return type;
}
public void setType(ShipType type) {
this.type = type;
}
public Player getOwner() {
return owner;
}
public void setOwner(Player owner) {
this.owner = owner;
}
public ArrayList<Integer[]> getListCoord() {
return listCoord;
}
public void setListCoord(ArrayList<Integer[]> listCoord) {
this.listCoord = listCoord;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
/**
*
* @author Davy
*/
public enum ShipType {
PORTE_AVION, CROISEUR, CONTRE_TORPILLEUR, SOUS_MARIN, TORPILLEUR, CUIRASSE
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utclo23.data.structure;
/**
*
* @author Davy
*/
public class StatGame {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment