soccerclient.datamanager
Class PlayerInfo

java.lang.Object
  |
  +--soccerclient.datamanager.PlayerInfo
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class PlayerInfo
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Überschrift: PlayerInfo

Beschreibung: This is the heart of datamanger. All information which a player know are safed in this or in some special class like Ball, Score, ... . This class is needed for saving and get information. Some information are safed raw, but all relative values are transformed in absolute values like coordinates or direction of body. If the player starts on the left side the coordinate system is the same of the server's one. Is the startside right, then the coordinate system is turned for 180 degree comparatively with the server. With methods like getObjectDir or getObjectDist the absolute values are transformed back to relative values.

Copyright: Copyright (c) 2002

Organisation: pm39

Author:
J.F.G
See Also:
Serialized Form

Inner Class Summary
(package private)  class PlayerInfo.InvalidNumber
           
(package private)  class PlayerInfo.NoLine
           
 
Field Summary
static boolean ENEMY
           
static boolean FRIEND
           
static boolean LEFT
           
static boolean RIGHT
           
 
Constructor Summary
PlayerInfo()
          Creates a new PlayerInfo instance
 
Method Summary
 Area getAreaOfResponsibility()
           
 Ball getBallObject()
          Returns the ball-object.
 double getBodyDir()
          Returns the direction of the body
 int getCatchCount()
          Returns number of executed catch-commands
 int getChangeViewCount()
          Returns number of executed change_view-commands
 PlayerInfo getCopy()
          Creates and returns a copy of this object.
 int getDashCount()
          Returns number of executed dash-commands
 double getEffort()
          Returns effort
 OtherPlayer getEnemyGoalie()
          Returns information about the goalie of the other team
 java.util.LinkedList getFarEnemy()
          Returns the adverse players which uniformnumber is unknown
 java.util.LinkedList getFarFriend()
          Returns the other friendly players which uniformnumber is unknown
 double getHeadAngle()
          Returns direction of head
 int getKickCount()
          Returns number of executed kick-commands
 Log getLog()
          Returns log-object
 int getMoveCount()
          Returns number of executed move-commands
 java.util.HashMap getNearEnemy()
          Returns the adverse players which uniformnumber is known
 java.util.HashMap getNearFriend()
          Returns the other friendly players which uniformnumber is known
 double getObjectDir(Coordinate coor)
          Returns the relative direction to the object
 double getObjectDist(Coordinate coor)
          Returns the relative distance to the object
 double getOffside()
          Returns x-coordinate of offside-line
 Coordinate getOppGoal()
          Returns the coordinate of the opponent goal
 Coordinate getOwnGoal()
          Returns the coordinate of the own goal
 OtherPlayer getOwnGoalie()
          Returns information about the own goalie
 Coordinate getOwnPositon()
          Returns absolute position
 PlayMode getPlayModeObject()
          Returns the playmode-object of the player.
 int getSayCount()
          Returns number of executed say-commands
 Score getScore()
          Returns score-object
 boolean getSide()
          Returns the side of the own half
 double getSpeedAmount()
          Returns amount of speed
 double getSpeedBallDir()
          Returns speed-direction of ball
 double getSpeedDirection()
          Returns direction of speed
 double getStamina()
          Returns stamina
 Coordinate getStandardPosition()
           
 Coordinate getStartPosition()
          Returns the startposition in the formation
 boolean getStartSide()
          Returns the begining side
 java.lang.String getTeamName()
          Returns teamname
 int getTime()
          Returns time
 int getTurnCount()
          Returns number of executed turn-commands
 int getTurnNeckCount()
          Returns number of executed turn_neck-commands
 int getUniformNumber()
          Returns uniformnumber
 ViewMode getViewMode()
          Returns the viewmode-object of the player.
 boolean getVisualInfoNeeded()
           
 void setBallObject(double distance, double direction, int time)
          Sets the coordinate of ball with timestamp
 void setBody(int quality, int width, double stamina, double effort, double speedAmount, double speedDirection, double headAngle, int kickCount, int dashCount, int turnCount, int sayCount, int turnNeckCount, int catchCount, int moveCount, int changeViewCount)
          Sets the parameters of the body
 void setCatchCount(int catchCount)
          Sets the value executed catch-commands
 void setChangeViewCount(int changeViewCount)
          Sets the value executed change_view-commands
 void setDashCount(int dashCount)
          Sets the value executed dash-commands
 void setEffort(double effort)
          Sets the value of effort
 void setHeadAngle(double headAngle)
          Sets the value of direction of head
 void setKickCount(int kickCount)
          Sets the value executed kick-commands
 void setMoveCount(int moveCount)
          Sets the value executed move-commands
 void setOtherPlayer(boolean team, boolean goalie, double distance, double direction, double distChange, double dirChange, double bodyDir, double headDir, int time)
          Sets the parameters of a OtherPlayer with uniformnumber
 void setOtherPlayer(boolean team, int number, boolean goalie, double distance, double direction, double distChange, double dirChange, double bodyDir, double headDir, int time)
          Sets the parameters of a OtherPlayer without uniformnumber
 void setOwnPosition(int lineNumber, double lineDir, int flagNumber, double flagDist, double flagDir)
          Sets the value of position
 void setSayCount(int sayCount)
          Sets the value executed say-commands
 void setSide(boolean side)
          Sets the side of the own half
 void setSpeedAmount(double speedAmount)
          Sets the value of amount of speed
 void setSpeedDirection(double speedDirection)
          Sets the value of direction of speed
 void setStamina(double stamina)
          Sets the value of stamina
 void setStartSide(boolean startSide)
          Sets the begining side
 void setTeamName(java.lang.String teamName)
          Sets the teamname
 void setTime(int time)
          Sets the value of time
 void setTurnCount(int turnCount)
          Sets the value executed turn-commands
 void setTurnNeckCount(int turnNeckCount)
          Sets the value executed turn_neck-commands
 void setUniformNumber(int nr)
          Sets uniformnumber
 void setVisualInfoNeeded(boolean needed)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final boolean LEFT

RIGHT

public static final boolean RIGHT

FRIEND

public static final boolean FRIEND

ENEMY

public static final boolean ENEMY
Constructor Detail

PlayerInfo

public PlayerInfo()
Creates a new PlayerInfo instance
Method Detail

getCopy

public PlayerInfo getCopy()
                   throws java.lang.Exception
Creates and returns a copy of this object.
Returns:
a PlayerInfo containing a clone of this instance
Throws:
java.lang.CloneNotSupportedException -  

setOtherPlayer

public void setOtherPlayer(boolean team,
                           int number,
                           boolean goalie,
                           double distance,
                           double direction,
                           double distChange,
                           double dirChange,
                           double bodyDir,
                           double headDir,
                           int time)
Sets the parameters of a OtherPlayer without uniformnumber
Parameters:
team - a boolean value specifying whether the other player is a FRIEND or an ENEMY
number - a int value specifying unformnumber
goalie - a boolean value specifying whether the other player is a goalie
distance - a double value specifying the distance to the other player
direction - a double value specifying relative direction to the other player
distChange - a double value specifying change of the distance to the other player
dirChange - a double value specifying change of the relative direction to the other player
bodyDir - a double value specifying relative direction of the other player to this player
headDir - a double value specifying relative direction of the head of the other player to the head of this player
time - a int value specifying the time when the information has been recieved

setOtherPlayer

public void setOtherPlayer(boolean team,
                           boolean goalie,
                           double distance,
                           double direction,
                           double distChange,
                           double dirChange,
                           double bodyDir,
                           double headDir,
                           int time)
Sets the parameters of a OtherPlayer with uniformnumber
Parameters:
team - a boolean value specifying whether the other player is a FRIEND or an ENEMY
number - a int value specifying unformnumber
goalie - a boolean value specifying whether the other player is a goalie
distance - a double value specifying the distance to the other player
direction - a double value specifying relative direction to the other player
distChange - a double value specifying change of the distance to the other player
dirChange - a double value specifying change of the relative direction to the other player
bodyDir - a double value specifying relative direction of the other player to this player
headDir - a double value specifying relative direction of the head of the other player to the head of this player
time - a int value specifying the time when the information has been recieved

getNearFriend

public java.util.HashMap getNearFriend()
Returns the other friendly players which uniformnumber is known
Returns:
a HashMap containing all known friendly players with uniformnumber

getNearEnemy

public java.util.HashMap getNearEnemy()
Returns the adverse players which uniformnumber is known
Returns:
a HashMap containing all known adverse players with uniformnumber

getFarFriend

public java.util.LinkedList getFarFriend()
Returns the other friendly players which uniformnumber is unknown
Returns:
a LinkedList containing all known friendly players without uniformnumber

getFarEnemy

public java.util.LinkedList getFarEnemy()
Returns the adverse players which uniformnumber is unknown
Returns:
a LinkedList containing all known adverse players without uniformnumber

getOwnGoalie

public OtherPlayer getOwnGoalie()
Returns information about the own goalie
Returns:
a OtherPlayer containing own goalie

getEnemyGoalie

public OtherPlayer getEnemyGoalie()
Returns information about the goalie of the other team
Returns:
a OtherPlayer containing the goalie of the other team

setBody

public void setBody(int quality,
                    int width,
                    double stamina,
                    double effort,
                    double speedAmount,
                    double speedDirection,
                    double headAngle,
                    int kickCount,
                    int dashCount,
                    int turnCount,
                    int sayCount,
                    int turnNeckCount,
                    int catchCount,
                    int moveCount,
                    int changeViewCount)
             throws java.lang.Exception
Sets the parameters of the body
Parameters:
quality - a int value specifying quality of the see-sense (ViewMode.LOW|ViewMode.HIGH)
width - a int value specifying width of the see-sense (ViewMode.NARROW|ViewMode.NORMAL|ViewMode.HIGH)
stamina - a double value specifying stamina
effort - a double value specifying effort
speedAmount - a double value specifying amount of speed
speedDirection - a double value specifying amount of effort
headAngle - a double value specifying direction of head
kickCount - a int value specifying the numbers of executed kick-commands
dashCount - a int value specifying the numbers of executed dash-commands
turnCount - a int value specifying the numbers of executed turn-commands
sayCount - a int value specifying the numbers of executed say-commands
turnNeckCount - a int value specifying the numbers of executed turn_neck-commands
catchCount - a int value specifying the numbers of executed catch-commands
moveCount - a int value specifying the numbers of executed move-commands
changeViewCount - a int value specifying the numbers of executed change_view-commands
Throws:
NoViewMode -  

getSide

public boolean getSide()
Returns the side of the own half
Returns:
if the own goal is on the left side the LEFT else RIGHT

setSide

public void setSide(boolean side)
Sets the side of the own half
Parameters:
LEFT - for left side or RIGHT for right side

setStartSide

public void setStartSide(boolean startSide)
Sets the begining side
Parameters:
LEFT - for left side or RIGHT for right side

getStartSide

public boolean getStartSide()
Returns the begining side
Parameters:
void -  

getOppGoal

public Coordinate getOppGoal()
Returns the coordinate of the opponent goal
Returns:
a Coordinate containing the opponent goal

getOwnGoal

public Coordinate getOwnGoal()
Returns the coordinate of the own goal
Returns:
a Coordinate containing the own goal

getOffside

public double getOffside()
Returns x-coordinate of offside-line
Returns:
a double containing offside-line

getUniformNumber

public int getUniformNumber()
Returns uniformnumber
Returns:
a int containing uniformnumber

setUniformNumber

public void setUniformNumber(int nr)
                      throws java.lang.Exception
Sets uniformnumber
Parameters:
nr - a int value specifying uniformnumber
Throws:
PlayerInfo.InvalidNumber - if nr < 1 or nr > 11

getTeamName

public java.lang.String getTeamName()
Returns teamname
Returns:
a String containing teamname

setTeamName

public void setTeamName(java.lang.String teamName)
Sets the teamname
Parameters:
teamName - a String value specifying teamname

getViewMode

public ViewMode getViewMode()
Returns the viewmode-object of the player. With it it is possible to change the viewmode
Returns:
a ViewMode containing viewmode

getPlayModeObject

public PlayMode getPlayModeObject()
Returns the playmode-object of the player.
Returns:
a PlayMode containing playmode

getStamina

public double getStamina()
Returns stamina
Returns:
a double containing stamina

setStamina

public void setStamina(double stamina)
Sets the value of stamina
Parameters:
stamina - a double value specifying stamina

getEffort

public double getEffort()
Returns effort
Returns:
a double containing effort

setEffort

public void setEffort(double effort)
Sets the value of effort
Parameters:
effort - a double value specifying effort

getSpeedAmount

public double getSpeedAmount()
Returns amount of speed
Returns:
a double containing amount of speed

setSpeedAmount

public void setSpeedAmount(double speedAmount)
Sets the value of amount of speed
Parameters:
speedAmount - a double value specifying amount of speed

getSpeedDirection

public double getSpeedDirection()
Returns direction of speed
Returns:
a double containing direction of speed

setSpeedDirection

public void setSpeedDirection(double speedDirection)
Sets the value of direction of speed
Parameters:
speedDirection - a double value specifying direction of speed

getHeadAngle

public double getHeadAngle()
Returns direction of head
Returns:
a double containing direction of head

setHeadAngle

public void setHeadAngle(double headAngle)
Sets the value of direction of head
Parameters:
headAngel - a double value specifying direction of head

getKickCount

public int getKickCount()
Returns number of executed kick-commands
Returns:
a int containing number of executed kick-commands

setKickCount

public void setKickCount(int kickCount)
Sets the value executed kick-commands
Parameters:
kickCount - a int value specifying executed kick-commands

getDashCount

public int getDashCount()
Returns number of executed dash-commands
Returns:
a int containing number of executed dash-commands

setDashCount

public void setDashCount(int dashCount)
Sets the value executed dash-commands
Parameters:
dashCount - a int value specifying executed dash-commands

getTurnCount

public int getTurnCount()
Returns number of executed turn-commands
Returns:
a int containing number of executed turn-commands

setTurnCount

public void setTurnCount(int turnCount)
Sets the value executed turn-commands
Parameters:
turnCount - a int value specifying executed turn-commands

getSayCount

public int getSayCount()
Returns number of executed say-commands
Returns:
a int containing number of executed say-commands

setSayCount

public void setSayCount(int sayCount)
Sets the value executed say-commands
Parameters:
sayCount - a int value specifying executed say-commands

getTurnNeckCount

public int getTurnNeckCount()
Returns number of executed turn_neck-commands
Returns:
a int containing number of executed turn_neck-commands

setTurnNeckCount

public void setTurnNeckCount(int turnNeckCount)
Sets the value executed turn_neck-commands
Parameters:
turnNeckCount - a int value specifying executed turn_neck-commands

getCatchCount

public int getCatchCount()
Returns number of executed catch-commands
Returns:
a int containing number of executed catch-commands

setCatchCount

public void setCatchCount(int catchCount)
Sets the value executed catch-commands
Parameters:
catchCount - a int value specifying executed catch-commands

getMoveCount

public int getMoveCount()
Returns number of executed move-commands
Returns:
a int containing number of executed move-commands

setMoveCount

public void setMoveCount(int moveCount)
Sets the value executed move-commands
Parameters:
moveCount - a int value specifying executed move-commands

getChangeViewCount

public int getChangeViewCount()
Returns number of executed change_view-commands
Returns:
a int containing number of executed change_view-commands

setChangeViewCount

public void setChangeViewCount(int changeViewCount)
Sets the value executed change_view-commands
Parameters:
changeViewCount - a int value specifying executed change_view-commands

getTime

public int getTime()
Returns time
Returns:
a int containing time

setTime

public void setTime(int time)
Sets the value of time
Parameters:
time - a int value specifying time

getOwnPositon

public Coordinate getOwnPositon()
Returns absolute position
Returns:
a Coordinate containing absolute position

getBallObject

public Ball getBallObject()
Returns the ball-object. With it it is possible to change the information on the ball
Returns:
a Ball containing absolute position of the ball

setBallObject

public void setBallObject(double distance,
                          double direction,
                          int time)
Sets the coordinate of ball with timestamp
Parameters:
distance - a double value specifying relative distance to the ball
direction - a double value specifying relative direction to the ball
time - a int value specifying tiemstamp

getScore

public Score getScore()
Returns score-object
Returns:
a Score

setOwnPosition

public void setOwnPosition(int lineNumber,
                           double lineDir,
                           int flagNumber,
                           double flagDist,
                           double flagDir)
                    throws java.lang.Exception
Sets the value of position
Parameters:
lineNumber - a int value specifying the line
lineDist - a double value specifying distance to the line
lineDir - a double value specifying relative direction to the line
flagNumber - a int value specifying the flag
flagDist - a double value specifying distance to the flag
flagDir - a double value specifying relative direction to the flag
Throws:
NoFlag, - NoLine

getLog

public Log getLog()
Returns log-object
Returns:
a Logcode>

getStartPosition

public Coordinate getStartPosition()
Returns the startposition in the formation
Returns:
a Coordinate containing startposition

getStandardPosition

public Coordinate getStandardPosition()

getAreaOfResponsibility

public Area getAreaOfResponsibility()

getBodyDir

public double getBodyDir()
Returns the direction of the body
Returns:
a double containing direction of body

getSpeedBallDir

public double getSpeedBallDir()
Returns speed-direction of ball
Returns:
a double containing speed-direction of ball

getObjectDir

public double getObjectDir(Coordinate coor)
Returns the relative direction to the object
Parameters:
coor - a Coordinate value specifying coordinate of the object
Returns:
a Coordinate containing relative direction to object

getObjectDist

public double getObjectDist(Coordinate coor)
Returns the relative distance to the object
Parameters:
coor - a Coordinate value specifying coordinate of the object
Returns:
a Coordinate containing relative distance to object

getVisualInfoNeeded

public boolean getVisualInfoNeeded()

setVisualInfoNeeded

public void setVisualInfoNeeded(boolean needed)