Class PositionThread

java.lang.Object
  extended by java.lang.Thread
      extended by PositionThread
All Implemented Interfaces:
java.lang.Runnable

public class PositionThread
extends java.lang.Thread

Dieser Thread errechnet ständig die neue Position des Roboters und dessen Winkel zum Spielfeld. Daneben stellt die Klasse Methoden zur Verfügung, um mit diesen Informationen sinnvoll umzugehen.

Author:
Franz Steinmetz

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PositionThread(double startAngle)
           
 
Method Summary
static double getAngle()
           
static double getAngleInDegrees()
           
static double[] getPosition()
           
static double getX()
           
static double getY()
           
static boolean isEast()
           
static boolean isInHintererSpielhaelfte()
           
static boolean isInLinkerSpielhaelfte()
           
static boolean isInRechterSpielhaelfte()
           
static boolean isInVordererSpielhaelfte()
           
static boolean isLeft()
           
static boolean isNorth()
           
static boolean isNorthern()
           
static boolean isRight()
           
static boolean isSouth()
           
static boolean isSouthern()
           
static boolean isWest()
           
 void run()
          Berechnet die aktuelle Position
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PositionThread

public PositionThread(double startAngle)
Method Detail

getAngle

public static double getAngle()
Returns:
den aktuellen Blickwinkel

getAngleInDegrees

public static double getAngleInDegrees()
Returns:
den aktuellen Blickwinkel in Grad

getPosition

public static double[] getPosition()
Returns:
die aktuellen Koordinaten

getX

public static double getX()
Returns:
die aktuelle X-Position

getY

public static double getY()
Returns:
die aktuelle Y-Position

isEast

public static boolean isEast()
Returns:
true, wenn der Winkel zwischen 225° und 315° liegt, sonst false

isInHintererSpielhaelfte

public static boolean isInHintererSpielhaelfte()
Returns:
true, wenn der Roboter sich in der hinteren Spielfeldhälfte, sonst false

isInLinkerSpielhaelfte

public static boolean isInLinkerSpielhaelfte()
Returns:
true, wenn der Roboter sich in der linken Spielfeldhälfte, sonst false

isInRechterSpielhaelfte

public static boolean isInRechterSpielhaelfte()
Returns:
true, wenn der Roboter sich in der rechten Spielfeldhälfte, sonst false

isInVordererSpielhaelfte

public static boolean isInVordererSpielhaelfte()
Returns:
true, wenn der Roboter sich in der vorderen Spielfeldhälfte, sonst false

isLeft

public static boolean isLeft()
Returns:
true, wenn der Winkel zwischen 0° und 180° liegt, sonst false

isNorth

public static boolean isNorth()
Returns:
true, wenn der Winkel zwischen 45° und 315° liegt, sonst false

isNorthern

public static boolean isNorthern()
Returns:
true, wenn der Winkel zwischen 75° und 285° liegt, sonst false

isRight

public static boolean isRight()
Returns:
true, wenn der Winkel zwischen 180° und 360° liegt, sonst false

isSouth

public static boolean isSouth()
Returns:
true, wenn der Winkel zwischen 135° und 225° liegt, sonst false

isSouthern

public static boolean isSouthern()
Returns:
true, wenn der Winkel zwischen 90° und 270° liegt, sonst false

isWest

public static boolean isWest()
Returns:
true, wenn der Winkel zwischen 45° und 135° liegt, sonst false

run

public void run()
Berechnet die aktuelle Position

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread