FileDocCategorySizeDatePackage
CADState.javaAPI DocExample5843Mon Apr 06 18:10:24 BST 1998None

Shape

public abstract class Shape extends Object implements Serializable

Fields Summary
public static final int
RED
public static final int
BLUE
public static final int
GREEN
private int
xPos
private int
yPos
private int
dimension
private static Random
r
private static int
counter
Constructors Summary
public Shape(int xVal, int yVal, int dim)

      
     
         
    xPos = xVal;
    yPos = yVal;
    dimension = dim;
  
Methods Summary
public abstract intgetColor()

public static ShaperandomFactory()

    int xVal = r.nextInt() % 100;
    int yVal = r.nextInt() % 100;
    int dim = r.nextInt() % 100;
    switch(counter++ % 3) {
      default: 
      case 0: return new Circle(xVal, yVal, dim);
      case 1: return new Square(xVal, yVal, dim);
      case 2: return new Line(xVal, yVal, dim);
    }
  
public abstract voidsetColor(int newColor)

public java.lang.StringtoString()

    return getClass().toString() + 
      " color[" + getColor() +
      "] xPos[" + xPos +
      "] yPos[" + yPos +
      "] dim[" + dimension + "]\n";