Class Parser

java.lang.Object
  |
  +--Parser

public class Parser
extends java.lang.Object

The Parser class is used to divide the input-stream from the communication-module into tokens. Those are being built up to a Vector containing VisualObject objects, a String array or a double array, depending on what kind of information the parser module receives.

Author:
Patrick Ficher

Field Summary
private  Communication communication
          The Communication object
private  int currentTime
          current time
private  VisualObject visualObject
          The VisualObject object
 
Constructor Summary
Parser(Communication communication)
          Creates a new Parser instance.
 
Method Summary
 java.util.Vector parse()
          Parse is the main method of the parser.
private  double[] tokenizeBodyevent(java.lang.String bodymsg)
          The tokenizeBodyevent method takes only care of incoming body_sense messages (see Users Manual 4.2.2).
private  java.lang.String[] tokenizeHearevent(java.lang.String hearmsg)
          The tokenizeHearevent method takes only care of incoming hear messages (see Users Manual 4.2.2).
private  java.util.Vector tokenizeVisualevent(java.lang.String seemsg)
          The tokenizeVisualevent method takes only care of incoming see messages.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

communication

private Communication communication
The Communication object

visualObject

private VisualObject visualObject
The VisualObject object

currentTime

private int currentTime
current time
Constructor Detail

Parser

public Parser(Communication communication)
Creates a new Parser instance.
Parameters:
communication - a Communication value defining the communication link to the server via which the commands can be sent.
See Also:
Communication
Method Detail

tokenizeHearevent

private java.lang.String[] tokenizeHearevent(java.lang.String hearmsg)
The tokenizeHearevent method takes only care of incoming hear messages (see Users Manual 4.2.2).
Parameters:
hearmsg - a String which contains the hear message
Returns:
returns a String array with following content:
  • [0]: time
  • [1]: sender { "referee" | "self" | direction | "online_coach_left" | "online_coach_right"}
  • [2]: message

time can be converted to int direction can be converted to double

Author: Patrick Ficher


tokenizeVisualevent

private java.util.Vector tokenizeVisualevent(java.lang.String seemsg)
The tokenizeVisualevent method takes only care of incoming see messages.
Parameters:
hearmsg - a String which contains the see message
Returns:
A Vector containing the perceived and processed VisualObject objects.
See Also:

Author: Patrick Ficher


tokenizeBodyevent

private double[] tokenizeBodyevent(java.lang.String bodymsg)
The tokenizeBodyevent method takes only care of incoming body_sense messages (see Users Manual 4.2.2).
Parameters:
bodymsg - a String which contains the body_sense message
Returns:
returns a double array with following content:
  • [0]: time
  • [1]: view_mode(1){ 0="high" | 1="low" }
  • [2]: view_mode(2){ 0="narrow" | 1="normal" | 2="wide" }
  • [3]: stamina(1) ( Stammina )
  • [4]: stamina(2) ( Effort )
  • [5]: speed(1) ( AmountOfSpeed )
  • [6]: speed(2) ( DirectionOfSpeed )[-180 ~ 180 degrees]
  • [7]: head-angle ( HeadAngle ) [-180 ~ 180 degrees]
  • [8]: kick ( KickCount ) [positive integer]
  • [9]: dash ( DashCount ) [positive integer]
  • [10]: turn ( TurnCount ) [positive integer]
  • [11]: say ( SayCount ) [positive integer]
  • [12]: turn_neck ( TurnNeckCount ) [positive integer]
  • [13]: catch ( CatchCount ) [positive integer]
  • [14]: move ( MoveCount ) [positive integer]
  • [15]: change_view ( ChangeViewCount )[positive integer]
(so all numbers are doubles, but some can be converted to int)

Author: Patrick Ficher


parse

public java.util.Vector parse()
Parse is the main method of the parser. It waits for a new message and starts parsing this message depending on what kind of message it is.
Returns:
A Vector with following content:
  1. see message: several VisualObject objects
  2. body_sense message: a double array
  3. heare message: a String array.

Author: Patrick Ficher