com.swath
Class UserDefinedEvent

java.lang.Object
  extended bycom.swath.UserDefinedEvent
All Implemented Interfaces:
EventIfc
Direct Known Subclasses:
ExampleEvent1

public abstract class UserDefinedEvent
extends java.lang.Object
implements EventIfc

User Defined Event base class.

Since:
SWATH 1.7

Constructor Summary
UserDefinedEvent()
          Constructor.
 
Method Summary
 java.lang.String getClassName()
          Gets the event class name.
 boolean isEventClass(java.lang.Class eventClass)
          Indicates if this event matches a given event class.
 boolean isUserDefined()
          Indicates if this event is user defined or not.
 boolean onText(java.lang.String buffer, java.lang.String text)
          This method is called when new text has arrived from the game server.
 void printTrace(java.lang.Exception e)
          Print an exception and the complete stack trace in the SWATH console window.
 void printTrace(java.lang.String text)
          Print trace text in the SWATH console window.
 void setBufferText(java.lang.String text)
          Sets the current text buffer content.
 void skipBufferText(int count)
          Removes characters from the current text buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDefinedEvent

public UserDefinedEvent()
Constructor.

Method Detail

isEventClass

public final boolean isEventClass(java.lang.Class eventClass)
Description copied from interface: EventIfc
Indicates if this event matches a given event class.

Specified by:
isEventClass in interface EventIfc
Parameters:
eventClass - The event class.
Returns:
true if this event is of the same class, otherwise false.

isUserDefined

public final boolean isUserDefined()
Description copied from interface: EventIfc
Indicates if this event is user defined or not.

Specified by:
isUserDefined in interface EventIfc
Returns:
true if user defined, otherwise false.

getClassName

public final java.lang.String getClassName()
Description copied from interface: EventIfc
Gets the event class name.

Specified by:
getClassName in interface EventIfc
Returns:
The class name.

skipBufferText

public final void skipBufferText(int count)
Removes characters from the current text buffer.

Parameters:
count - Number of characters to remove.
Since:
SWATH 1.7.1
See Also:
setBufferText(java.lang.String), onText(java.lang.String, java.lang.String)

setBufferText

public final void setBufferText(java.lang.String text)
Sets the current text buffer content.

Parameters:
text - The new content.
Since:
SWATH 1.7.1
See Also:
skipBufferText(int), onText(java.lang.String, java.lang.String)

printTrace

public final void printTrace(java.lang.String text)
                      throws java.lang.Exception
Print trace text in the SWATH console window.

Parameters:
text - The text to print.
Throws:
java.lang.Exception
Since:
SWATH 1.7.1

printTrace

public final void printTrace(java.lang.Exception e)
                      throws java.lang.Exception
Print an exception and the complete stack trace in the SWATH console window.

Parameters:
e - The exception to print.
Throws:
java.lang.Exception
Since:
SWATH 1.7.1

onText

public boolean onText(java.lang.String buffer,
                      java.lang.String text)
               throws java.lang.Exception
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.

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
Since:
SWATH 1.7.1
See Also:
skipBufferText(int), setBufferText(java.lang.String), printTrace(java.lang.String)