|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.swath.UserDefinedCommand
ExampleCommand1
This is my first SWATH command. It does simple trading at the port in the current sector.
Trade| Field Summary |
| Fields inherited from class com.swath.UserDefinedCommand |
RETURN_KEY |
| Constructor Summary | |
ExampleCommand1()
|
|
| Method Summary | |
void |
endCommand(boolean finished)
Called by the framework when the command is finished. |
static int |
exec(int fuel,
int organics,
int equipment)
Simple trading at the port in the current sector. |
java.lang.String |
getName()
Called by the framework to get the name of the command. |
boolean |
initCommand()
Called by the framework to initialise the command. |
void |
onEvent(EventIfc event)
This method is called for each posted event. |
void |
onText(java.lang.String buffer,
java.lang.String text)
This method is called when new text has arrived from the game server. |
void |
startCommand()
Called by the framework to start executing the command. |
| Methods inherited from class com.swath.UserDefinedCommand |
atPrompt, execInstance, getClassName, getParams, getResource, initInstance, isInternal, isUserDefined, postEvent, printTrace, printTrace, registerParam, sendString, setBufferText, setResult, skipBufferText |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ExampleCommand1()
| Method Detail |
public java.lang.String getName()
UserDefinedCommand
getName in interface CommandIfcgetName in class UserDefinedCommand
public boolean initCommand()
throws java.lang.Exception
UserDefinedCommand
initCommand in class UserDefinedCommandtrue if the initialisation was successful,
otherwise false.
java.lang.ExceptionUserDefinedCommand.atPrompt(int),
UserDefinedCommand.printTrace(java.lang.String),
UserDefinedCommand.setResult(java.lang.Object)
public void startCommand()
throws java.lang.Exception
UserDefinedCommandonText and onEvent.
startCommand in class UserDefinedCommandjava.lang.ExceptionUserDefinedCommand.sendString(java.lang.String),
UserDefinedCommand.postEvent(com.swath.UserDefinedEvent),
UserDefinedCommand.printTrace(java.lang.String),
UserDefinedCommand.setResult(java.lang.Object),
UserDefinedCommand.onText(java.lang.String, java.lang.String),
UserDefinedCommand.onEvent(com.swath.EventIfc)
public void endCommand(boolean finished)
throws java.lang.Exception
UserDefinedCommand
endCommand in class UserDefinedCommandfinished - true if the command finished correctly or
false if the command was interrupted in some way.
java.lang.Exception
public void onText(java.lang.String buffer,
java.lang.String text)
throws java.lang.Exception
UserDefinedCommandskipBufferText and setBufferText methods.
onText in class UserDefinedCommandbuffer - The current text buffer.text - The new incoming text.
java.lang.ExceptionUserDefinedCommand.skipBufferText(int),
UserDefinedCommand.setBufferText(java.lang.String),
UserDefinedCommand.sendString(java.lang.String),
UserDefinedCommand.postEvent(com.swath.UserDefinedEvent),
UserDefinedCommand.printTrace(java.lang.String),
UserDefinedCommand.setResult(java.lang.Object)
public void onEvent(EventIfc event)
throws java.lang.Exception
UserDefinedCommand
onEvent in class UserDefinedCommandevent - The event.
java.lang.ExceptionUserDefinedCommand.sendString(java.lang.String),
UserDefinedCommand.postEvent(com.swath.UserDefinedEvent),
UserDefinedCommand.printTrace(java.lang.String),
UserDefinedCommand.setResult(java.lang.Object)
public static int exec(int fuel,
int organics,
int equipment)
throws java.lang.Exception
fuel - The amount of Fuel Ore to buy/sell.organics - The amount of Organics to buy/sell.equipment - The amount of Equipment to buy/sell.
java.lang.Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||