Skip to content
Snippets Groups Projects
Commit f877f557 authored by Urs Graf's avatar Urs Graf
Browse files

Initial import

parent 29a3a9e4
Branches
No related tags found
No related merge requests found
package ch.ntb.inf.sea14.test;
import java.util.ArrayList;
import java.util.List;
import ch.ntb.inf.sea14.test.Comm.Connection;
import ch.ntb.inf.sea14.test.ui.Board;
import ch.ntb.inf.sea14.test.ui.View;
public class BoardTester implements Runnable {
private List<View> views = new ArrayList<View>();
public boolean isConnected;
private Connection connection;
private Board board;
public boolean running;
public String error;
public BoardTester(Board b) {
board = b;
isConnected = false;
running = true;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection c) {
connection = c;
}
public Board getBoard() {
return board;
}
public void addView(View view) {
if (!views.contains(view)) views.add(view);
}
@Override
public void run() {
while (running) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (isConnected) notifyViews();
}
}
protected void notifyViews() {
for (View v : views) v.update();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment