Commit 32d02a81 authored by dkonam's avatar dkonam

maj pattern memento

parent 1dafbb63
......@@ -50,12 +50,12 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain{
}
@Override
public boolean addConnectedUser() {
public boolean addConnectedUser(LightPublicUser user) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean removeConnectedUser() {
public boolean removeConnectedUser(LightPublicUser user) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
......
......@@ -19,8 +19,8 @@ public interface IDataCom {
public void forwardCoordinates(Mine mine);
public void opponentHasLeftGame();
public void connectionLostWithOpponent();
public boolean addConnectedUser();
public boolean removeConnectedUser();
public boolean addConnectedUser(LightPublicUser user);
public boolean removeConnectedUser(LightPublicUser user);
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.module;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public class Caretaker {
private ArrayList<Memento> mementoList;
private int current;
public Caretaker(ArrayList<Memento> mementoList) {
this.mementoList = mementoList;
this.current = 0;
}
public void add(Memento mem)
{
this.mementoList.add(mem);
}
public Memento getMemento()
{
if(this.mementoList.size() > this.current)
{
return this.mementoList.get(current);
}
else
{
//TODO
return null;
}
}
public void next()
{
this.current++;
}
}
......@@ -9,7 +9,5 @@ import java.util.ArrayList;
* @author tboulair
*/
public class GameMediator {
private ArrayList<Game> gamesList;
private ArrayList<Game> gamesList;
}
/*
* 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.module;
import com.utclo23.data.structure.Event;
import java.util.ArrayList;
/**
*
* @author Davy
*/
public class Memento {
private ArrayList<Event> state;
public Memento(ArrayList<Event> state) {
this.state = state;
}
public ArrayList<Event> getState() {
return state;
}
public void setState(ArrayList<Event> state) {
this.state = state;
}
}
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