Main Page | Packages | Class Hierarchy | Class List | File List | Class Members

pullparse.MessageBase Class Reference

Inheritance diagram for pullparse.MessageBase:

Inheritance graph
[legend]
Collaboration diagram for pullparse.MessageBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

MessageBase Aug 11, 2004.

A base class for messages in a market trading system. The "product" might be an computer driven trading program. The user is the identifier for the person who started the product or who is using a manual entry trading system. The local ID is an ID that is meaningful to the trading product.

Author:
Ian Kaplan, www.bearcave.com, iank@bearcave.com


Public Member Functions

 MessageBase ()
String getLocalID ()
String getProduct ()
String getUser ()
void toStream (PrintStream ps)

Protected Member Functions

void initialize (XmlPullParser parser) throws ParseException, XmlPullParserException, IOException

Private Member Functions

void setLocalID (String localID)
void setProduct (String product)
void setUser (String user)

Private Attributes

String mProduct = null
String mUser = null
String mLocalID = null
MessageStates mCurrentState = MessageStates.START_MSG


Constructor & Destructor Documentation

pullparse.MessageBase.MessageBase  ) 
 

00055 {}


Member Function Documentation

String pullparse.MessageBase.getLocalID  ) 
 

00057 { 00058 return mLocalID; 00059 }

String pullparse.MessageBase.getProduct  ) 
 

00063 { 00064 return mProduct; 00065 }

String pullparse.MessageBase.getUser  ) 
 

00069 { 00070 return mUser; 00071 }

void pullparse.MessageBase.initialize XmlPullParser  parser  )  throws ParseException, XmlPullParserException, IOException [protected]
 

Reimplemented in pullparse.AimOrder, and pullparse.Control.

00078 { 00079 while (mCurrentState != MessageStates.END_MSG) { 00080 int eventType = parser.next(); 00081 if (eventType == XmlPullParser.START_TAG) { 00082 String localName = parser.getName(); 00083 if (localName.equals("product")) { 00084 mCurrentState = MessageStates.PRODUCT; 00085 } 00086 else if (localName.equals("user")) { 00087 mCurrentState = MessageStates.USER; 00088 } 00089 else if (localName.equals("localID")) { 00090 mCurrentState = MessageStates.LOCAL_ID; 00091 } 00092 else { 00093 String msg = parser.getPositionDescription(); 00094 msg = msg + ": Unexpected tag found initializing MessageBase = " + localName; 00095 throw new ParseException( msg ); 00096 } 00097 } 00098 else if (eventType == XmlPullParser.TEXT) { 00099 if (mCurrentState == MessageStates.PRODUCT) { 00100 String text = parser.getText(); 00101 text = text.trim(); 00102 if (text.length() > 0) { 00103 setProduct( text ); 00104 } 00105 } 00106 else if (mCurrentState == MessageStates.USER) { 00107 String text = parser.getText(); 00108 text = text.trim(); 00109 if (text.length() > 0) { 00110 setUser( text ); 00111 } 00112 } 00113 else if (mCurrentState == MessageStates.LOCAL_ID) { 00114 String text = parser.getText(); 00115 text = text.trim(); 00116 if (text.length() > 0) { 00117 setLocalID( text ); 00118 } 00119 } 00120 } 00121 else if (eventType == XmlPullParser.END_TAG) { 00122 String localName = parser.getName(); 00123 if (localName.equals("localID")) { 00124 mCurrentState = MessageStates.END_MSG; 00125 } 00126 } 00127 } // while 00128 } // initialize

void pullparse.MessageBase.setLocalID String  localID  )  [private]
 

00060 { 00061 mLocalID = localID; 00062 }

void pullparse.MessageBase.setProduct String  product  )  [private]
 

00066 { 00067 mProduct = product; 00068 }

void pullparse.MessageBase.setUser String  user  )  [private]
 

00072 { 00073 mUser = user; 00074 }

void pullparse.MessageBase.toStream PrintStream  ps  ) 
 

00132 { 00133 ps.println("product: " + mProduct ); 00134 ps.println("user: " + mUser ); 00135 ps.println("local ID: " + mLocalID ); 00136 }


Member Data Documentation

MessageStates pullparse.MessageBase.mCurrentState = MessageStates.START_MSG [private]
 

Reimplemented in pullparse.AimOrder, and pullparse.Control.

String pullparse.MessageBase.mLocalID = null [private]
 

String pullparse.MessageBase.mProduct = null [private]
 

String pullparse.MessageBase.mUser = null [private]
 


The documentation for this class was generated from the following file:
Generated on Sat Aug 28 14:08:27 2004 for PullParse by doxygen 1.3.8