uavsim.datatypes
Class A_Arc<_ANGLETYPE_ extends A_Angle<_ANGLETYPE_>>

java.lang.Object
  extended by uavsim.datatypes.A_Arc<_ANGLETYPE_>
Type Parameters:
_ANGLETYPE_ - - the type of angle: mathematical or navigational
Direct Known Subclasses:
ArcMathematical, ArcNavigational

public abstract class A_Arc<_ANGLETYPE_ extends A_Angle<_ANGLETYPE_>>
extends java.lang.Object

Defines the shared aspects of an arc formed by two angles.

Author:
Dan Tappan [23.06.11]

Nested Class Summary
 class A_Arc.A_ArcIterator
          Defines the shared aspects of an iterator for the arc.
 
Field Summary
protected  _ANGLETYPE_ _angleEnd
          the end angle
protected  _ANGLETYPE_ _angleStart
          the start angle
 
Constructor Summary
A_Arc(_ANGLETYPE_ angleStart, _ANGLETYPE_ angleEnd)
          Creates an abstract arc.
 
Method Summary
 _ANGLETYPE_ getAngleEnd()
          Gets the end angle.
 _ANGLETYPE_ getAngleStart()
          Gets the start angle.
abstract  double getArcLength(boolean isCounterclockwise)
          Determines the length of the arc from start to end.
abstract  A_Arc.A_ArcIterator getIteratorInstance(_ANGLETYPE_ step, boolean isCounterclockwise, boolean isInclusiveRange)
          Generates an iterator.
abstract  A_Arc<_ANGLETYPE_> getReverse()
          Swaps the start and end angles.
 double getSubarcLength(boolean isCounterclockwise, double divisor)
          Divides the arc into subarcs and returns their length.
 double getSubdivisionCount(_ANGLETYPE_ angle, boolean isCounterclockwise)
          Divides the arc by an angle and returns how many subarcs there are.
 boolean isContained(_ANGLETYPE_ angle, boolean isInclusive)
          Returns whether an angle is on the arc interval [start,end) or [start,end].
protected  boolean isStartBeforeEnd()
          Determines whether the start angle is smaller than the end angle.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_angleEnd

protected final _ANGLETYPE_ extends A_Angle<_ANGLETYPE_> _angleEnd
the end angle


_angleStart

protected final _ANGLETYPE_ extends A_Angle<_ANGLETYPE_> _angleStart
the start angle

Constructor Detail

A_Arc

public A_Arc(_ANGLETYPE_ angleStart,
             _ANGLETYPE_ angleEnd)
Creates an abstract arc.

Parameters:
angleStart - - the start angle
angleEnd - - the end angle
Method Detail

getAngleEnd

public _ANGLETYPE_ getAngleEnd()
Gets the end angle.

Returns:
the angle

getAngleStart

public _ANGLETYPE_ getAngleStart()
Gets the start angle.

Returns:
the angle

getArcLength

public abstract double getArcLength(boolean isCounterclockwise)
Determines the length of the arc from start to end.

Parameters:
isCounterclockwise - - whether to follow the arc counterclockwise
Returns:
the length

getIteratorInstance

public abstract A_Arc.A_ArcIterator getIteratorInstance(_ANGLETYPE_ step,
                                                        boolean isCounterclockwise,
                                                        boolean isInclusiveRange)
Generates an iterator.

Parameters:
step - - the step
isCounterclockwise - - whether to follow the arc counterclockwise
isInclusiveRange - - whether to include the end angle in the steps
Returns:
the iterator

getReverse

public abstract A_Arc<_ANGLETYPE_> getReverse()
Swaps the start and end angles.

Returns:
the new arc

getSubarcLength

public double getSubarcLength(boolean isCounterclockwise,
                              double divisor)
Divides the arc into subarcs and returns their length.

Parameters:
divisor - - the divisor
isCounterclockwise - - whether to follow the arc counterclockwise
Returns:
the length

getSubdivisionCount

public double getSubdivisionCount(_ANGLETYPE_ angle,
                                  boolean isCounterclockwise)
Divides the arc by an angle and returns how many subarcs there are.

Parameters:
angle - - the angle
isCounterclockwise - - whether to follow the arc counterclockwise
Returns:
the count, which is fractional

isContained

public boolean isContained(_ANGLETYPE_ angle,
                           boolean isInclusive)
Returns whether an angle is on the arc interval [start,end) or [start,end].

Parameters:
angle - - the angle
isInclusive - - whether to include the end angle
Returns:
the result

isStartBeforeEnd

protected boolean isStartBeforeEnd()
Determines whether the start angle is smaller than the end angle.

Returns:
the result

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object