|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrobocode.naval.ComponentBase
public abstract class ComponentBase
The abstract class for the basic ship components.
| Nested Class Summary | |
|---|---|
protected static class |
ComponentBase.HiddenComponentHelper
Only visible towards subclasses. |
| Field Summary | |
|---|---|
protected double |
angle
The angle, in radians, of the component. |
protected double |
lastHeading
Keeping track of the heading before the current heading. |
protected ComponentType |
type
The type of this component. |
| Constructor Summary | |
|---|---|
ComponentBase(double x,
double y,
ComponentType type,
double angle)
Creates a new robot component at the specified point. |
|
ComponentBase(Point2D pivot,
ComponentType type)
Creates a new robot component at the specified point. |
|
ComponentBase(Point2D pivot,
ComponentType type,
double angle)
Creates a new robot component at the specified point. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
double |
getAngle()
Get the angle of the component; in radians. |
double |
getAngleDegrees()
Get the angle of the component; in degrees. |
Color |
getColor()
Get the color of the component. |
double |
getGunHeat()
|
double |
getLastAngle()
|
Point2D |
getOrigin(ITransformable peer)
Get the exact location of the component. |
Point2D |
getPivot()
Get the pivot point of the component as a Point2D object. |
byte |
getSerializeType()
|
ComponentType |
getType()
Get the type of the component. |
void |
setAngle(double angle)
Set the angle of the component; in radians. |
void |
setAngleDegrees(double angle)
Set the angle of the component; in degrees. |
void |
setColor(Color color)
Set the color of the component. |
void |
setLastAngle(double lastHeading)
Sets the lastHeading of the component in Radians. |
protected void |
setType(ComponentType type)
Set the type of the component. |
String |
toString()
|
abstract double |
turnRadians(double turnRemaining)
Attempts to turn the component. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected double angle
protected ComponentType type
protected double lastHeading
| Constructor Detail |
|---|
public ComponentBase(Point2D pivot,
ComponentType type)
pivot - The pivot point of the component.type - The type of the child component.
public ComponentBase(double x,
double y,
ComponentType type,
double angle)
x - The X-coordinate of the pivot point of the component.y - The Y-coordinate of the pivot point of the component.type - The type of the child component.angle - The angle of the component in radians.
public ComponentBase(Point2D pivot,
ComponentType type,
double angle)
pivot - The pivot point of the component.type - The type of the child component.angle - The angle of the component in radians.| Method Detail |
|---|
public double getGunHeat()
getGunHeat in interface IComponentpublic Point2D getPivot()
Point2D object.
The point is relative to that of the ship.
getPivot in interface IComponentpublic Point2D getOrigin(ITransformable peer)
getOrigin in interface IComponentpeer - The robot the component belongs to.
public void setLastAngle(double lastHeading)
setLastAngle in interface IComponentlastHeading - The lastHeading in Radians.public double getLastAngle()
getLastAngle in interface IComponentpublic double getAngle()
getAngle in interface IComponentpublic double getAngleDegrees()
getAngleDegrees in interface IComponentpublic void setAngle(double angle)
setAngle in interface IComponentangle - The angle to which to set the component.public void setAngleDegrees(double angle)
setAngleDegrees in interface IComponentangle - The angle to which to set the component.protected void setType(ComponentType type)
type - The type of the component.public ComponentType getType()
getType in interface IComponentpublic void setColor(Color color)
setColor in interface IComponentcolor - The color of the component.public Color getColor()
getColor in interface IComponentpublic abstract double turnRadians(double turnRemaining)
IComponent
turnRadians in interface IComponentturnRemaining - The angle in RADIANS the component still has to turn.
public boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Objectpublic byte getSerializeType()
getSerializeType in interface IComponent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||