keeps finding a "Object" not the real type.. I am really lost.. :D
The calls to other objects work fine, I have testing all of them.. but! when I compile I get a error about finding a "object" type and not a String type at
for(String blackStone : blackUnits.keySet())
{
if( getSetLib(blackStone) == 0 ){ removeSet.add(blackStone);}
}
}
this is the whole class
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
publicclass Stat
{
private Token[][] board;
privateint bSize;
private HashMap<String, HashSet> unitsWhite;
private HashMap<String, HashSet> unitsBlack;
double last;
public Stat(Token[][] goBoard,int size)
{
board = goBoard;
bSize = size;
unitsWhite =new HashMap< String , HashSet>();
unitsBlack =new HashMap< String , HashSet>();
last = bSize -1;
}
/**
* Delimiter is /
*/
public HashSet getLib(int x ,int y)
{
HashSet liberties =new HashSet<String>();
//error catch
if(board[x][y] ==null){return liberties;}
int tempX = x;
int tempY = y;
//error catch for out of rage if size ect..
for(int i = 0 , liby = y ,libx = x ; i <= 3; i++)
{
if(i == 0){libx = -1; liby = 0;}
if(i == 1){libx = 0; liby = -1;}
if(i == 2){libx = 1; liby = 0;}
if(i == 3){libx = 0; liby = 1;}
tempX = x+libx;
tempY = y+liby;
if(tempX >= 0 || tempY >= 0)
{
if( tempX <= last || tempY <= last )
{
if( (tempX < 0 || tempY < 0) || ( tempX >= last || tempY >= last ) )
{
tempX = 0;
tempY = 0;
}
else
{
if( board[tempX][tempY] ==null){ liberties.add(tempX+"/"+tempY);}
}
}
}
}
return liberties;
}
publicvoid getTer()
{
}
publicvoid checkForCaptured()
{
Token black =null;
Token white =null;
HashMap blackUnits;
HashMap whiteUnits;
HashSet removeSet ;
removeSet =new HashSet<String>();
//look for a Token on the board and if you find one look for any dead Tokens
//looks for a Token
for(int x=0; x < bSize;x++)
{for(int y=0 ; y < bSize;y++)
{if(board[x][y] !=null)
{
if (black ==null)if( board[x][y].getColor().equals("black") ) black = board[y][x];
if (white ==null)if( board[x][y].getColor().equals("white") ) white = board[y][x];
}
}
}
System.out.println("this is black tokens color" +black.getColor());
//looks for a dead unit
if(black !=null)
{ blackUnits = black.getUnits();
System.out.println("black :" +blackUnits.keySet().size() ) ;
for(String blackStone : blackUnits.keySet())
{
if( getSetLib(blackStone) == 0 ){ removeSet.add(blackStone);}
}
}
if(white !=null)
{ whiteUnits = white.getUnits();
System.out.println(" white: "+whiteUnits.keySet().size() );
for( String whiteStone : whiteUnits.keySet() )
{if( getSetLib(whiteStone) == 0 ){ removeSet.add(whiteStone);}}
}
board.removeUnitsSet(removeSet);
}
publicint getSetLib(HashSet Units)
{
return 0;
}
}
someone point me in the correct direction PLZ! I don't mind RTFM if you give me a FM and page/line to look at.
THANKS!
Message was edited by:
monji112000

