public class Stav implements Cloneable{
private int[] pole;
public Stav(int[] pole){
this.pole = pole;
}
public Stav(Stav a){
this.pole = a.pole;
}
public void move(boolean left){
int empty = findEmpty();
if(left){
this.pole[empty] = this.pole[empty - 1];
this.pole[empty - 1] = 0;
}
else{
this.pole[empty] = this.pole[empty + 1];
this.pole[empty + 1] = 0;
}
}
and
Jednotka pom = fronta.remove();
Stav nStav = new Stav(pom.getStav().getPole());
Stav pomStav = new Stav(nStav);
and when i call
pomStav.move(false);
the value of nStav will change same as pomStav... somebody can help me with this? I have some more metods in code but its so long so I didnt copy here like findEmpty etc.