: Class Motor

Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Motor

    java.lang.Object
      |
      +--Motor

class Motor
extends java.lang.Object
implements Rotatable, NonTerminal

A basic motor with a body and a rotor

Field Summary
`private Rectangle` | `body` Original body of the motor.
`private java.util.Vector` | `children` children
`java.awt.Graphics` | `graphics` Graphics context for this Geometric object.
`private Line` | `new_rotor` Modified rotor of the motor to be parallel to major axis.
`private double` | `relative_rotor_angle` Angle that the line from the center of the body to the tip rotor makes with the x axis.
`private Line` | `rotor` Original rotor of the motor.
`private int` | `rotor_length` Rotor length of the rotor.
`private Point` | `tip_position` The position of the tip relative to the center of the body.

Constructor Summary
`(package private)` | `Motor(Rectangle body, Line rotor)` The constructor.

Method Summary
`double` | `getAngle()` Returns the angle of the motor WRT the x axis in radians.
`java.util.Vector` | `getChildren()` This method should return a vector containing the children of this object.
`Polygon[]` | `getPolygonalBoundsArray()` This method should return the polygonal array bounds of this non-terminal object.
`Rectangle` | `getRectangularBounds()` This method should return the Rectangular bounds of this non-terminal object.
`java.lang.String` | `getType()` Implement Paintable
`void` | `paint()` Draw the Motor
`void` | `paint(java.awt.Graphics g)` Draw the Motor
`void` | `paintOriginal(java.awt.Graphics g)` This method is used to paint the original data points that forms this GeometricObject
`void` | `setGraphicsContext(java.awt.Graphics g)` Set graphics context for this Motor object.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### body

    private Rectangle body

  Original body of the motor.

### rotor

    private Line rotor

  Original rotor of the motor.

### new_rotor

    private Line new_rotor

  Modified rotor of the motor to be parallel to major axis.

### rotor_length

    private int rotor_length

  Rotor length of the rotor.

### relative_rotor_angle

    private double relative_rotor_angle

  Angle that the line from the center of the body to the tip rotor makes with the x axis.

### tip_position

    private Point tip_position

  The position of the tip relative to the center of the body.

### children

    private java.util.Vector children

  children

### graphics

    public java.awt.Graphics graphics

  Graphics context for this Geometric object.

Constructor Detail

### Motor

    Motor(Rectangle body,
          Line rotor)

  The constructor.

Method Detail

### getAngle

    public double getAngle()

  Returns the angle of the motor WRT the x axis in radians. This should be made more general by adding an angle field to the class.
  Specified by:
    getAngle in interface Rotatable

### paint

    public void paint()

  Draw the Motor

### paint

    public void paint(java.awt.Graphics g)

  Draw the Motor

### paintOriginal

    public void paintOriginal(java.awt.Graphics g)

  This method is used to paint the original data points that forms this GeometricObject

### setGraphicsContext

    public void setGraphicsContext(java.awt.Graphics g)

  Set graphics context for this Motor object. Must be set at least once before doing any drawing.

### getType

    public java.lang.String getType()

  Implement Paintable

### getRectangularBounds

    public Rectangle getRectangularBounds()

  This method should return the Rectangular bounds of this non-terminal object.
  Specified by:
    getRectangularBounds in interface NonTerminal

### getPolygonalBoundsArray

    public Polygon[] getPolygonalBoundsArray()

  This method should return the polygonal array bounds of this non-terminal object. This is a rough approximation of the constituents of the object.
  Specified by:
    getPolygonalBoundsArray in interface NonTerminal

### getChildren

    public java.util.Vector getChildren()

  This method should return a vector containing the children of this object. Children are the Terminal or NonTerminal constituents of this object.
  Specified by:
    getChildren in interface NonTerminal

Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD