FileDocCategorySizeDatePackage
ColorGameBean.javaAPI DocGlassfish v2 API3819Fri May 04 22:34:12 BST 2007colors

ColorGameBean

public class ColorGameBean extends Object

Fields Summary
private String
background
private String
foreground
private String
color1
private String
color2
private String
hint
private int
attempts
private int
intval
private boolean
tookHints
Constructors Summary
Methods Summary
public intgetAttempts()

	return attempts;
    
public java.lang.StringgetColor1()

	 return foreground;
    
public java.lang.StringgetColor2()

	 return background;
    
public booleangetHint()

	return hint.equalsIgnoreCase("Hint");
    
public booleangetHintTaken()

	return tookHints;
    
public intgetIntval()

	return intval;
	
public booleangetSuccess()

	if (background.equalsIgnoreCase("black") ||
	    background.equalsIgnoreCase("cyan")) {
	
	    if (foreground.equalsIgnoreCase("black") ||
		foreground.equalsIgnoreCase("cyan"))
		return true;
	    else
		return false;
	}

	return false;
    
public voidprocessRequest(javax.servlet.http.HttpServletRequest request)


        

	// background = "yellow";
	// foreground = "red";

	if (! color1.equals(foreground)) {
	    if (color1.equalsIgnoreCase("black") ||
			color1.equalsIgnoreCase("cyan")) {
			background = color1;
		}
	}

	if (! color2.equals(background)) {
	    if (color2.equalsIgnoreCase("black") ||
			color2.equalsIgnoreCase("cyan")) {
			foreground = color2;
	    }
	}

	attempts++;
    
public voidreset()

	foreground = "red";
	background = "yellow";
    
public voidsetAction(java.lang.String x)

	if (!tookHints)
	    tookHints = x.equalsIgnoreCase("Hint");
	hint = x;
    
public voidsetColor1(java.lang.String x)

	color1 = x;
    
public voidsetColor2(java.lang.String x)

	color2 = x;
    
public voidsetIntval(int value)

	intval = value;