package greenfoot;
public class UserInfoVisitor
{
private static UserInfo myInfo;
public static UserInfo allocate(String userName, int rank, String singletonUserName)
{
if (singletonUserName != null && singletonUserName.equals(userName))
{
if (myInfo != null && myInfo.getUserName().equals(singletonUserName))
{
myInfo.setRank(rank);
}
else
{
myInfo = new UserInfo(userName, rank);
}
return myInfo;
}
else
{
return new UserInfo(userName, rank);
}
}
public static GreenfootImage readImage(byte[] imageFileContents)
{
return new GreenfootImage(imageFileContents);
}
}
top,
use,
map,
class UserInfoVisitor
. allocate
. readImage
40 neLoCode
+ 0 LoComm