Compare commits
2 Commits
fa85372c13
...
440eed0e9d
Author | SHA1 | Date | |
---|---|---|---|
440eed0e9d | |||
49262c4954 |
BIN
bin/uebung05/logistics/demo.class
Normal file
BIN
bin/uebung05/logistics/demo.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/uebung09/iterator/Array2dIterator.class
Normal file
BIN
bin/uebung09/iterator/Array2dIterator.class
Normal file
Binary file not shown.
@ -1,12 +1,17 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import uebung09.iterator.Array2dIterator;
|
||||||
|
|
||||||
public class Board {
|
public class Board extends Array2dIterator<Piece>{
|
||||||
private final Piece[][] field = new Piece[8][8];
|
private final Piece[][] field = new Piece[8][8];
|
||||||
private final List<Piece> pieces = new ArrayList<>();
|
private final List<Piece> pieces = new ArrayList<>();
|
||||||
|
|
||||||
|
Board(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void add(Piece piece) {
|
void add(Piece piece) {
|
||||||
if (piece.getBoard() != this)
|
if (piece.getBoard() != this)
|
||||||
throw new IllegalArgumentException("wrong board");
|
throw new IllegalArgumentException("wrong board");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@ -12,6 +12,7 @@ public class ChessApp {
|
|||||||
private static final String BLACK_QUEEN = "Q";
|
private static final String BLACK_QUEEN = "Q";
|
||||||
private static final String WHITE_KNIGHT = "n";
|
private static final String WHITE_KNIGHT = "n";
|
||||||
private static final String BLACK_KNIGHT = "N";
|
private static final String BLACK_KNIGHT = "N";
|
||||||
|
private static final String ITERATOR = "i";
|
||||||
|
|
||||||
private final Scanner scanner;
|
private final Scanner scanner;
|
||||||
private final Board board;
|
private final Board board;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
public enum Color {
|
public enum Color {
|
||||||
black, white
|
black, white
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
public abstract class Piece {
|
public abstract class Piece {
|
||||||
private Color color;
|
private Color color;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package chess;
|
package uebung09.chess;
|
||||||
|
|
||||||
import static java.lang.Integer.signum;
|
import static java.lang.Integer.signum;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package collection;
|
package uebung09.collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of elements that does not contain any element twice.
|
* A set of elements that does not contain any element twice.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package collection;
|
package uebung09.collection;
|
||||||
|
|
||||||
public class SetFactory {
|
public class SetFactory {
|
||||||
|
|
||||||
|
25
src/uebung09/iterator/Array2dIterator.java
Normal file
25
src/uebung09/iterator/Array2dIterator.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package uebung09.iterator;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
public class Array2dIterator<T> implements Iterator<T>{
|
||||||
|
|
||||||
|
|
||||||
|
public <T> Array2dIterator(T[][] aaray) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T next() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user