Class ExampleEvent1

java.lang.Object
  extended bycom.swath.UserDefinedEvent
      extended byExampleEvent1
All Implemented Interfaces:
EventIfc

public class ExampleEvent1
extends UserDefinedEvent

This is my first SWATH event.

Since:
SWATH 1.7

Constructor Summary
ExampleEvent1()
           
ExampleEvent1(java.lang.String name, int holds)
          Constructs an ExampleEvent1 event.
 
Method Summary
 int getHolds()
          Gets the number of holds on the ship.
 java.lang.String getShipName()
          Gets the name of the ship.
 boolean onText(java.lang.String buffer, java.lang.String text)
          This method is called when new text has arrived from the game server.
 
Methods inherited from class com.swath.UserDefinedEvent
getClassName, isEventClass, isUserDefined, printTrace, printTrace, setBufferText, skipBufferText
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleEvent1

public ExampleEvent1()

ExampleEvent1

public ExampleEvent1(java.lang.String name,
                     int holds)
Constructs an ExampleEvent1 event.

Parameters:
name - The ship name.
holds - The number of holds.
Method Detail

getShipName

public java.lang.String getShipName()
Gets the name of the ship.

Returns:
The ship name.

getHolds

public int getHolds()
Gets the number of holds on the ship.

Returns:
The number of holds.

onText

public boolean onText(java.lang.String buffer,
                      java.lang.String text)
               throws java.lang.Exception
Description copied from class: UserDefinedEvent
This method is called when new text has arrived from the game server.
You can override this method to handle incoming text.

Text will only be received during the WaitForEvent command. You will be able to scan the incoming text and decide when to post the event.

The current text buffer contains both the previous text and the new text that just arrived. You can use it when searching for information using the string helper methods. To remove text from the current buffer or reset its content, use the skipBufferText and setBufferText methods.

Overrides:
onText in class UserDefinedEvent
Parameters:
buffer - The current text buffer.
text - The new incoming text.
Returns:
true to post this event or false to wait.
Throws:
java.lang.Exception
See Also:
UserDefinedEvent.skipBufferText(int), UserDefinedEvent.setBufferText(java.lang.String), UserDefinedEvent.printTrace(java.lang.String)