|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.ut3.communication.messages.gbinfomessages.Yylex
public class Yylex
This class is a scanner generated by JFlex 1.4.3 on 5/19/14 4:43 AM from the specification file /mnt/jenkins/var/lib/jenkins/jobs/PogamutUT3 (deploy site)/workspace/src/main/jflex/GB3Parser.jflex
Field Summary | |
---|---|
protected Object |
actObj
|
static String |
DELIMITERS_EXTENDED
|
static String |
DELIMITERS_STANDARD
|
protected ItemTranslator |
itemTranslator
object that is used to translate messages into objects |
protected ItemTypeTranslator |
itemTypeTranslator
object that is used to translate strings into item types |
protected Map<Integer,Double> |
mapIntDouble
Map for list of String, Double |
protected Map<Integer,Double> |
mapIntIDDouble
Map for list of String, Double |
static int |
MSG_ALIVE
|
static int |
MSG_BEG
lexical states |
static int |
MSG_EMP
|
protected IYylexObserver |
observer
observer for the yylex for reporting exceptions |
protected UnrealIdTranslator |
translator
parser reference, this parser will be used for translation of UnrealID to IntID |
static int |
UNPROCESSED_MESSAGE
|
protected double |
ut2004Time
time in the UT2004 |
static int |
YYEOF
This character denotes the end of file |
static int |
YYINITIAL
|
Constructor Summary | |
---|---|
Yylex()
|
|
Yylex(InputStream in)
Creates a new scanner. |
|
Yylex(Reader in)
Creates a new scanner There is also a java.io.InputStream version of this constructor. |
Method Summary | ||
---|---|---|
protected boolean |
booleanValue(String txt)
Return a boolean from boolean token in txt. |
|
protected ItemType.Category |
categoryValue(String txt)
Return a Category of the item. |
|
void |
close()
|
|
protected double |
doubleValue(String txt)
Return a double from num token in txt. |
|
protected void |
exceptionOccured(Exception e,
String info)
Logs the exception if observer present, or print it to System.out. |
|
protected float |
floatValue(String txt)
Return a float from num token in txt. |
|
protected String |
getToken(String text,
int num)
Returns 'num'-th token from 'text' using DELIMITERS_STANDARD. |
|
protected String |
getToken(String text,
String delimiters,
int num)
Returns 'num'-th token from 'text' using 'delimiters'. |
|
protected double[] |
getTriple(String txt)
Return a triple (double[]{x,y,z}) starting from num token(tokens are separated by space) in 'txt' |
|
protected Integer |
integerValue(String txt)
Return an integer from num token in txt. |
|
protected int |
intValue(String txt)
Return an integer from num token in txt. |
|
protected ItemDescriptor |
itemDescriptorValue(ItemType type)
|
|
protected ItemType |
itemTypeValue(String txt)
Return an ItemType instance. |
|
protected Location |
locationValue(String txt)
Return a Location instance starting from num token(tokens are separated by space) in txt |
|
protected long |
longValue(String txt)
Return a long from num token in txt. |
|
static void |
main(String[] argv)
Runs the scanner on input files. |
|
protected javax.vecmath.Point3d |
point3dValue(String txt)
Return a Point3d instance starting from num token(tokens are separated by space) in txt |
|
protected Rotation |
rotationValue(String txt)
Return a Rotation instance starting from num token(tokens are separated by space) in txt |
|
void |
setItemTranslator(ItemTranslator translator)
|
|
void |
setItemTypeTranslator(ItemTypeTranslator translator)
|
|
void |
setObserver(IYylexObserver observer)
|
|
protected
|
setPropertyByReflection(Object object,
String propertyName,
Class<T> valueType,
T value)
Set property of an object by reflection Setter method name is expected to follow name convention "set |
|
void |
setReader(Reader reader)
|
|
void |
setTeamId(ITeamId teamId)
Sets teamId that has to be slipped to every IWorldObjectUpdatedEvent . |
|
void |
setTime(IWorldEvent obj,
double time)
|
|
void |
setTime(IWorldObjectUpdatedEvent obj,
double time)
|
|
void |
setTranslator(UnrealIdTranslator translator)
Set parser translating UnrealID to IntID. |
|
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId |
stringIdValue(String txt)
Returns UnrealId for parsed token. |
|
protected String |
stringValue(String txt)
Returns string for parsed token. |
|
protected InfoMessage |
tryParsingUnprocessedMessage(String messageName)
This method should be overriden to parse additional messages, that are not part of PogamutUDK Core. |
|
protected boolean |
tryParsingUnprocessedMessageParameter(String paramName,
String wholeParamText)
This method should be overridden to parse parameters of additional messages that are not part of PogamuUDK Core. |
|
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId |
unrealIdValue(String txt)
Return an UnrealId instance from identificator token in txt. |
|
protected javax.vecmath.Vector3d |
vector3dValue(String txt)
Return a Vector3d instance starting from num token(tokens are separated by space) in txt |
|
protected Velocity |
velocityValue(String txt)
Return a Velocity instance starting from num token(tokens are separated by space) in txt |
|
protected void |
warning(String info)
Send the warning to observer or prints it to the console. |
|
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId |
worldObjectIdValue(String txt)
Return an UnrealId instance from identificator token in txt. |
|
void |
yybegin(int newState)
Enters a new lexical state |
|
char |
yycharat(int pos)
Returns the character at position pos from the matched text. |
|
void |
yyclose()
Closes the input stream. |
|
int |
yylength()
Returns the length of the matched text region. |
|
InfoMessage |
yylex()
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs. |
|
void |
yypushback(int number)
Pushes the specified amount of characters back into the input stream. |
|
void |
yyreset(Reader reader)
Resets the scanner to read from a new input stream. |
|
int |
yystate()
Returns the current lexical state. |
|
String |
yytext()
Returns the text matched by the current regular expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int YYEOF
public static final int MSG_BEG
public static final int UNPROCESSED_MESSAGE
public static final int YYINITIAL
public static final int MSG_ALIVE
public static final int MSG_EMP
public static final String DELIMITERS_STANDARD
public static final String DELIMITERS_EXTENDED
protected Map<Integer,Double> mapIntIDDouble
protected Map<Integer,Double> mapIntDouble
protected UnrealIdTranslator translator
protected ItemTranslator itemTranslator
protected IYylexObserver observer
protected ItemTypeTranslator itemTypeTranslator
protected double ut2004Time
protected Object actObj
Constructor Detail |
---|
public Yylex()
public Yylex(Reader in)
in
- the java.io.Reader to read input from.public Yylex(InputStream in)
in
- the java.io.Inputstream to read input from.Method Detail |
---|
public void setReader(Reader reader)
setReader
in interface IYylex
public void close() throws IOException
close
in interface IYylex
IOException
public void setItemTranslator(ItemTranslator translator)
setItemTranslator
in interface IUT2004Yylex
public void setItemTypeTranslator(ItemTypeTranslator translator)
setItemTypeTranslator
in interface IUT2004Yylex
public void setObserver(IYylexObserver observer)
setObserver
in interface IYylex
public void setTranslator(UnrealIdTranslator translator)
setTranslator
in interface IUT2004Yylex
public void setTime(IWorldObjectUpdatedEvent obj, double time)
public void setTime(IWorldEvent obj, double time)
protected <T> void setPropertyByReflection(Object object, String propertyName, Class<T> valueType, T value)
object
- the objectpropertyName
- property namevalueType
- property value / setter argument typevalue
- value to setprotected void exceptionOccured(Exception e, String info)
e
- info
- protected void warning(String info)
protected InfoMessage tryParsingUnprocessedMessage(String messageName)
#getParsedObject()
.
For further discussion on how this is done see wiki article.
messageName
-
tryParsingUnprocessedMessageParameter(java.lang.String, java.lang.String)
protected boolean tryParsingUnprocessedMessageParameter(String paramName, String wholeParamText)
tryParsingUnprocessedMessage(java.lang.String)
this method
is called for every parameter.
paramName
- The name of the parameter as appeared in the Gamebots messagewholeParamText
- Whole text of the parameter part of message (contains the param name) - this string can be directly passed to
xxxValue methods of this class to obtain translated values for basically all usable datatypes. If this is not enough, use getToken(java.lang.String, int)
to extract desired part of the message text (the value has index 1)
tryParsingUnprocessedMessage(java.lang.String)
protected String getToken(String text, String delimiters, int num)
text
- delimiters
-
protected String getToken(String text, int num)
text
-
protected int intValue(String txt)
txt
- text of parameter
protected long longValue(String txt)
txt
- text of parameter
protected Integer integerValue(String txt)
txt
- text of parameter
protected double doubleValue(String txt)
txt
- text of parameter
protected float floatValue(String txt)
txt
- text of parameter
protected double[] getTriple(String txt)
txt
- text of parameter
protected Location locationValue(String txt)
txt
- text of parameter
protected ItemType itemTypeValue(String txt)
txt
- text of parameter
protected ItemDescriptor itemDescriptorValue(ItemType type)
protected ItemType.Category categoryValue(String txt)
txt
- text of parameter
protected Velocity velocityValue(String txt)
txt
- text of parameter
protected Rotation rotationValue(String txt)
txt
- text of parameter
protected javax.vecmath.Point3d point3dValue(String txt)
txt
- text of parameter
protected javax.vecmath.Vector3d vector3dValue(String txt)
txt
- text of parameter
protected String stringValue(String txt)
txt
- text of parameter
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId stringIdValue(String txt)
txt
- text of parameter
protected boolean booleanValue(String txt)
txt
- text of parameter
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId unrealIdValue(String txt)
txt
- text of parameter
protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId worldObjectIdValue(String txt)
txt
- text of parameter
public void setTeamId(ITeamId teamId)
IWorldObjectUpdatedEvent
.
setTeamId
in interface IUT2004Yylex
public final void yyclose() throws IOException
IOException
public final void yyreset(Reader reader)
reader
- the new input streampublic final int yystate()
public final void yybegin(int newState)
newState
- the new lexical statepublic final String yytext()
public final char yycharat(int pos)
pos
- the position of the character to fetch.
A value from 0 to yylength()-1.
public final int yylength()
public void yypushback(int number)
number
- the number of characters to be read again.
This number must not be greater than yylength()!public InfoMessage yylex() throws IOException
yylex
in interface IYylex
IOException
- if any I/O-Error occurspublic static void main(String[] argv)
argv
- the command line, contains the filenames to run
the scanner on.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |