de.mud.jta.plugin
Class BSX

java.lang.Object
  |
  +--de.mud.jta.Plugin
        |
        +--de.mud.jta.plugin.BSX
All Implemented Interfaces:
FilterPlugin, VisualPlugin

public class BSX
extends Plugin
implements FilterPlugin, VisualPlugin

ultrahighspeed-BSX-command-parser as Plugin for JTA 2.0. Features:

Version:
Java 1.0
Author:
Thomas Kriegelstein (tk4@rb.mud.de)

Field Summary
protected  boolean ignoreErrors
          ignoreErrors in BSX data
protected  java.awt.Panel panel
          the container for this plugin
protected static java.lang.String VERSION
          the BSX style version of this Parser
protected  BSXDisplay visual
          the canvas that contains the Gfx
 
Fields inherited from class de.mud.jta.Plugin
bus, id
 
Constructor Summary
BSX(PluginBus bus, java.lang.String id)
          initialize the parser
 
Method Summary
protected  boolean equals(byte[] a, byte[] b)
          compares two byte[]
 java.awt.Menu getPluginMenu()
          Get the menu entry for this component.
 java.awt.Component getPluginVisual()
          Get the visible components from the plugin.
protected  int hexToInt(byte[] b)
          computes an integer from an byte[2] containing a hexadecimal representation in capitol letters (0-9,A-F)
protected  int parse(byte[] b, int length)
          parse the input buffer
 int read(byte[] b)
          Read a block of data from the back end.
protected  void reset()
          reset the parser
 void setFilterSource(FilterPlugin source)
          Set the source plugin where we get our data from and where the data sink (write) is.
 void write(byte[] b)
          Write a block of data to the back end.
 
Methods inherited from class de.mud.jta.Plugin
error
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

visual

protected BSXDisplay visual
the canvas that contains the Gfx

panel

protected java.awt.Panel panel
the container for this plugin

VERSION

protected static java.lang.String VERSION
the BSX style version of this Parser

ignoreErrors

protected boolean ignoreErrors
ignoreErrors in BSX data
Constructor Detail

BSX

public BSX(PluginBus bus,
           java.lang.String id)
initialize the parser
Method Detail

getPluginVisual

public java.awt.Component getPluginVisual()
Description copied from interface: VisualPlugin
Get the visible components from the plugin.
Specified by:
getPluginVisual in interface VisualPlugin
Following copied from interface: de.mud.jta.VisualPlugin
Returns:
a component that represents the plugin

getPluginMenu

public java.awt.Menu getPluginMenu()
Description copied from interface: VisualPlugin
Get the menu entry for this component.
Specified by:
getPluginMenu in interface VisualPlugin
Following copied from interface: de.mud.jta.VisualPlugin
Returns:
a menu that can be used to change the plugin state

setFilterSource

public void setFilterSource(FilterPlugin source)
Description copied from interface: FilterPlugin
Set the source plugin where we get our data from and where the data sink (write) is. The actual data handling should be done in the read() and write() methods.
Specified by:
setFilterSource in interface FilterPlugin
Following copied from interface: de.mud.jta.FilterPlugin
Parameters:
source - the data source

read

public int read(byte[] b)
         throws java.io.IOException
Description copied from interface: FilterPlugin
Read a block of data from the back end.
Specified by:
read in interface FilterPlugin
Following copied from interface: de.mud.jta.FilterPlugin
Parameters:
b - the buffer to read the data into
Returns:
the amount of bytes actually read

write

public void write(byte[] b)
           throws java.io.IOException
Description copied from interface: FilterPlugin
Write a block of data to the back end.
Specified by:
write in interface FilterPlugin
Following copied from interface: de.mud.jta.FilterPlugin
Parameters:
b - the buffer to be sent

reset

protected void reset()
reset the parser

parse

protected int parse(byte[] b,
                    int length)
             throws java.io.IOException
parse the input buffer
Parameters:
b - input buffer byte array
length - count of valid bytes in buffer
Returns:
new length of valid bytes in buffer

equals

protected boolean equals(byte[] a,
                         byte[] b)
compares two byte[]
Returns:
true if they contain the same values

hexToInt

protected int hexToInt(byte[] b)
computes an integer from an byte[2] containing a hexadecimal representation in capitol letters (0-9,A-F)
Returns:
-1 on parseerror