org.mbari.siam.utils
Class DelimitedStringParser

java.lang.Object
  extended by org.mbari.siam.distributed.PacketParser
      extended by org.mbari.siam.utils.DelimitedStringParser
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BaseResponseParser, CO2SubsystemMonitorParser, CompassPacketParser, ControlLoopParser, DataLogger.RbrPacketParser, InputStateParser, OutputStateParser, Seabird52PacketParser, SeabirdPacketParser, SineDummyParser, ValveServicePacketParser, Ysi.ysiPacketParser

public abstract class DelimitedStringParser
extends PacketParser

Base class for PacketParsers which work on delimited string data. Note that PacketParser is intended to be transferred across a network, and hence implements the java.io.Serializable interface. Thus any member objects of your subclass must either implement Serializable, or be declared 'transient' or 'static'.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mbari.siam.distributed.PacketParser
PacketParser.Field, PacketParser.Record
 
Field Summary
protected  java.lang.String _delimiters
           
protected  java.util.Vector _fieldVector
           
 
Fields inherited from class org.mbari.siam.distributed.PacketParser
_registryName
 
Constructor Summary
DelimitedStringParser()
          no arg constructor
DelimitedStringParser(java.lang.String delimiters)
          Create parser, specifying the delimiter string.
DelimitedStringParser(java.lang.String registryName, java.lang.String delimiters)
          Create parser, specifying the delimiter string.
 
Method Summary
protected  java.lang.Number decimalValue(java.lang.String token)
          Return Number represented by input String token; Number is null if token does not represent a decimal number.
 PacketParser.Field[] parseFields(DevicePacket packet)
          Return fields parsed from DevicePacket.
protected abstract  PacketParser.Field processToken(int nToken, java.lang.String token)
          Process the token, whose position in string is nToken.
 
Methods inherited from class org.mbari.siam.distributed.PacketParser
getField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_delimiters

protected java.lang.String _delimiters

_fieldVector

protected java.util.Vector _fieldVector
Constructor Detail

DelimitedStringParser

public DelimitedStringParser()
no arg constructor


DelimitedStringParser

public DelimitedStringParser(java.lang.String delimiters)
Create parser, specifying the delimiter string.


DelimitedStringParser

public DelimitedStringParser(java.lang.String registryName,
                             java.lang.String delimiters)
Create parser, specifying the delimiter string.

Method Detail

parseFields

public PacketParser.Field[] parseFields(DevicePacket packet)
                                 throws NotSupportedException,
                                        java.text.ParseException
Return fields parsed from DevicePacket.

Specified by:
parseFields in class PacketParser
Throws:
NotSupportedException
java.text.ParseException

decimalValue

protected java.lang.Number decimalValue(java.lang.String token)
Return Number represented by input String token; Number is null if token does not represent a decimal number.


processToken

protected abstract PacketParser.Field processToken(int nToken,
                                                   java.lang.String token)
                                            throws java.text.ParseException
Process the token, whose position in string is nToken. If token corresponds to a Field, create and return the field. Otherwise return null.

Throws:
java.text.ParseException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.