algoanim.primitives
Class Square

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.Square

public class Square
extends Primitive

Represents a square defined by an upper left corner and its width.

Author:
Stephan Mehlhase

Field Summary
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
Square(SquareGenerator sg, Node upperLeftCorner, int theWidth, java.lang.String name, DisplayOptions display, SquareProperties sp)
          Instantiates the Square and calls the create() method of the associated SquareGenerator.
 
Method Summary
 SquareProperties getProperties()
          Returns the properties of this Square.
 Node getUpperLeft()
          Returns the upper left corner of this Square.
 int getWidth()
          Returns the width of this Square.
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 
Methods inherited from class algoanim.primitives.Primitive
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Square

public Square(SquareGenerator sg,
              Node upperLeftCorner,
              int theWidth,
              java.lang.String name,
              DisplayOptions display,
              SquareProperties sp)
       throws java.lang.IllegalArgumentException
Instantiates the Square and calls the create() method of the associated SquareGenerator.

Parameters:
sg - the appropriate code Generator.
upperLeftCorner - the upper left corner of this Square.
theWidth - the width of this Square.
name - the name of this Square.
display - [optional] the DisplayOptions of this Square.
sp - [optional] the properties of this Square.
Throws:
java.lang.IllegalArgumentException
Method Detail

getWidth

public int getWidth()
Returns the width of this Square.

Returns:
the width of this Square.

getProperties

public SquareProperties getProperties()
Returns the properties of this Square.

Returns:
the properties of this Square.

getUpperLeft

public Node getUpperLeft()
Returns the upper left corner of this Square.

Returns:
the upper left corner of this Square.

setName

public void setName(java.lang.String newName)
Description copied from class: Primitive
Sets the name of this Primitive.

Overrides:
setName in class Primitive
Parameters:
newName - the new name for this Primitive.
See Also:
Primitive.setName(java.lang.String)