package de.htw_berlin.HoboOthello.Core;


/**
 * Created by laura on 17.11.16.
 */
public class Field {

    private Stone stone;

    /**
     * Default constructor for empty field
     */
    public Field() { }

    public boolean isEmpty() {
        return stone == null;
    }

    public boolean isOccupiedByStone(){
        if (this.stone != null) {
            return true;
        } else {
            throw new IllegalArgumentException("Illegal state of field!");
        }
    }

    public void setStone(Stone stoneToSet){
        this.stone = stoneToSet;
    }

    public void setEmpty() {
        this.stone = null;
    }

    //TODO: getter

    /**
     * Override toString Method to show the current field state as a string
     *
     * @return the current field state "field is empty" or "field is occupied by stone"
     * @throws IllegalArgumentException if the the current field state could not be identified as
     * empty or occupied by a stone
     */
    @Override
    public String toString() {
        if (isEmpty()){
            return "field is empty";
        }
        if (isOccupiedByStone()) {
            return "field is occupied by stone";
        } else {
            throw new IllegalArgumentException("Illegal state of field!");
        }
    }




}

@@ -98,16 +98,74 @@
 ield %7B%0A%0A
+    /**%0A     * A field can be occupied by a stone%0A     */%0A
     priv
@@ -261,16 +261,20 @@
 ield() %7B
+%0A   
  %7D%0A%0A    
@@ -284,103 +284,110 @@
 lic 
-boolean isEmpty() %7B%0A        return stone == null;%0A    %7D%0A%0A    public boolean isOccupiedBy
+void setStone(Stone stoneToSet) %7B%0A        this.stone = stoneToSet;%0A    %7D%0A%0A    public Stone get
 Stone()
+ 
 %7B%0A  
@@ -392,20 +392,23 @@
         
-if (
+return 
 this.sto
@@ -413,262 +413,184 @@
 tone
- != null) %7B
+;
 %0A    
+%7D%0A%0A
     
-    return true;%0A        %7D else %7B%0A            throw new IllegalArgumentException(%22Illegal state of field!%22);%0A        %7D%0A    %7D%0A%0A    public void setStone(Stone stoneToSet)%7B%0A        this.stone = stoneToSet;%0A    %7D%0A%0A    public void setEmpty
+public void setEmpty() %7B%0A        this.stone = null;%0A    %7D%0A%0A    public boolean isEmpty() %7B%0A        return stone == null;%0A    %7D%0A%0A    public boolean isOccupiedByStone
 () %7B
@@ -590,32 +590,36 @@
 one() %7B%0A        
+if (
 this.stone = nul
@@ -617,236 +617,152 @@
 one 
+!
 = null
-;
+) %7B
 %0A    
-%7D%0A%0A
     
-//TODO: getter%0A%0A    /**%0A     * Override toString Method to show the current field state as a string
+    return true;%0A        %7D%0A        if (this.stone == null) %7B
 %0A     
-*%0A
      
-* @
+  
 return 
-the current field state %22field is empty%22 or %22field is occupied by stone%22%0A     * @
+false;%0A        %7D else %7B%0A            
 throw
-s
+ new
  Ill
@@ -786,110 +786,53 @@
 tion
- if the the current field state could not be identified as%0A     * empty or occupied by a stone
+(%22Illegal state of field!%22);%0A        %7D
 %0A    
- */
+%7D%0A
 %0A   
@@ -877,36 +877,8 @@
 ) %7B%0A
-        if (isEmpty())%7B%0A    
     
@@ -893,24 +893,17 @@
 rn %22
-f
+F
 ield
- is empty%22;
+%7B%22 +
 %0A   
@@ -903,34 +903,32 @@
 %22 +%0A        
-%7D%0A
         
 if (isOccupi
@@ -919,185 +919,47 @@
     
-if (isOccupiedByStone()) %7B%0A            return %22field is occupied by stone%22;%0A        %7D else %7B%0A            throw new IllegalArgumentException(%22Illegal state of field!%22);%0A        %7D
+%22stone=%22 + stone +%0A                '%7D';
 %0A   
@@ -963,12 +963,10 @@
     %7D%0A%0A%0A
-%0A%0A
 %7D%0A

update Field class