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

pullparse.AimOrder Class Reference

Inheritance diagram for pullparse.AimOrder:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

AimOrder Aug 11, 2004.

A class for an aim order. An "aim order" is a market trading objective, perhaps for a stock market order.

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


Public Member Functions

 AimOrder ()
int getAmount ()
String getInstructions ()
String getMarket ()
String getSymbol ()
float getTargetPrice ()
String toString ()

Protected Member Functions

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

Package Attributes

String mSymbol = null
int mAmount = 0
float mTargetPrice = 0.0F
String mMarket = null
String mInstructions = null

Private Member Functions

void setAmount (int amount)
void setInstructions (String instructions)
void setMarket (String market)
void setSymbol (String symbol)
void setTargetPrice (float targetPrice)

Private Attributes

MessageStates mCurrentState = MessageStates.START_MSG


Constructor & Destructor Documentation

pullparse.AimOrder.AimOrder  ) 
 

00050 {}


Member Function Documentation

int pullparse.AimOrder.getAmount  ) 
 

00059 { 00060 return mAmount; 00061 }

String pullparse.AimOrder.getInstructions  ) 
 

00065 { 00066 return mInstructions; 00067 }

String pullparse.AimOrder.getMarket  ) 
 

00071 { 00072 return mMarket; 00073 }

String pullparse.AimOrder.getSymbol  ) 
 

00077 { 00078 return mSymbol; 00079 }

float pullparse.AimOrder.getTargetPrice  ) 
 

00083 { 00084 return mTargetPrice; 00085 }

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

Reimplemented from pullparse.MessageBase.

00092 { 00093 super.initialize( parser ); 00094 while (mCurrentState != MessageStates.END_MSG) { 00095 int eventType = parser.next(); 00096 if (eventType == XmlPullParser.START_TAG) { 00097 String localName = parser.getName(); 00098 if (localName.equals("symbol")) { 00099 mCurrentState = MessageStates.SYMBOL; 00100 } 00101 else if (localName.equals("amount")) { 00102 mCurrentState = MessageStates.AMOUNT; 00103 } 00104 else if (localName.equals("targetPrice")) { 00105 mCurrentState = MessageStates.TARGET_PRICE; 00106 } 00107 else if (localName.equals("market")) { 00108 mCurrentState = MessageStates.MARKET; 00109 } 00110 else if (localName.equals("processingInstructions")) { 00111 mCurrentState = MessageStates.INSTRUCTIONS; 00112 } 00113 } 00114 else if (eventType == XmlPullParser.TEXT) { 00115 if (mCurrentState == MessageStates.SYMBOL ) { 00116 String text = parser.getText(); 00117 text = text.trim(); 00118 if (text.length() > 0) { 00119 setSymbol( text ); 00120 } 00121 } 00122 else if (mCurrentState == MessageStates.AMOUNT ) { 00123 String text = parser.getText(); 00124 text = text.trim(); 00125 if (text.length() > 0) { 00126 try { 00127 int val = Integer.parseInt( text ); 00128 setAmount( val ); 00129 } 00130 catch (NumberFormatException e) { 00131 throw new ParseException("NumberFormatException for text = " + text ); 00132 } 00133 } 00134 } 00135 else if (mCurrentState == MessageStates.TARGET_PRICE ) { 00136 String text = parser.getText(); 00137 text = text.trim(); 00138 if (text.length() > 0) { 00139 try { 00140 float val = Float.parseFloat( text ); 00141 setTargetPrice( val ); 00142 } 00143 catch (NumberFormatException e) { 00144 throw new ParseException("NumberFormatException for text = " + text ); 00145 } 00146 } 00147 } 00148 else if (mCurrentState == MessageStates.MARKET ) { 00149 String text = parser.getText(); 00150 text = text.trim(); 00151 if (text.length() > 0) { 00152 setMarket( text ); 00153 } 00154 } 00155 else if (mCurrentState == MessageStates.INSTRUCTIONS ) { 00156 String text = parser.getText(); 00157 text = text.trim(); 00158 if (text.length() > 0) { 00159 setInstructions( text ); 00160 } 00161 } 00162 } 00163 else if (eventType == XmlPullParser.END_TAG) { 00164 String localName = parser.getName(); 00165 if (localName.equals("aim_order")) { 00166 mCurrentState = MessageStates.END_MSG; 00167 } 00168 } 00169 } // while 00170 }

void pullparse.AimOrder.setAmount int  amount  )  [private]
 

00062 { 00063 mAmount = amount; 00064 }

void pullparse.AimOrder.setInstructions String  instructions  )  [private]
 

00068 { 00069 mInstructions = instructions; 00070 }

void pullparse.AimOrder.setMarket String  market  )  [private]
 

00074 { 00075 mMarket = market; 00076 }

void pullparse.AimOrder.setSymbol String  symbol  )  [private]
 

00080 { 00081 mSymbol = symbol; 00082 }

void pullparse.AimOrder.setTargetPrice float  targetPrice  )  [private]
 

00086 { 00087 mTargetPrice = targetPrice; 00088 }

String pullparse.AimOrder.toString  ) 
 

00173 { 00174 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 00175 PrintStream ps = new PrintStream( bos ); 00176 super.toStream( ps ); 00177 ps.println("symbol: " + mSymbol ); 00178 ps.println("amount: " + mAmount ); 00179 ps.println("target price: " + mTargetPrice ); 00180 ps.println("market: " + mMarket ); 00181 ps.println("instructions: " + mInstructions ); 00182 String str = bos.toString(); 00183 return str; 00184 }


Member Data Documentation

int pullparse.AimOrder.mAmount = 0 [package]
 

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

Reimplemented from pullparse.MessageBase.

String pullparse.AimOrder.mInstructions = null [package]
 

String pullparse.AimOrder.mMarket = null [package]
 

String pullparse.AimOrder.mSymbol = null [package]
 

float pullparse.AimOrder.mTargetPrice = 0.0F [package]
 


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