Class BidInfo

java.lang.Object
  extended by BidInfo

public class BidInfo
extends java.lang.Object

Encoding to and decoding from the BidInfo format used by the web shops and bidding clients to transmit bidding relevant data in a compact form.


Nested Class Summary
 class BidInfo.InvalidFormatException
          Exception thrown by the BidInfo constructor signalling an invalid input string format
 
Constructor Summary
BidInfo(java.lang.String encoded)
          Creates a new BidInfo object that decodes the given string
 
Method Summary
 java.lang.String encode()
          Encode the object contents into a string
static java.lang.String encode(BidInfo info)
          Encode a given BidInfo object into a string
static java.lang.String encode(int vendor, java.lang.String item, float price)
          Encodes a given set of items into a string
 java.lang.String getItem()
          Returns the decoded item identifier
 float getPrice()
          Returns the decoded list price
 int getVendor()
          Returns the decoded vendor number
static void main(java.lang.String[] args)
          Run several test cases
 java.lang.String toString()
          Returns a string representing the BidInfo object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BidInfo

public BidInfo(java.lang.String encoded)
        throws BidInfo.InvalidFormatException
Creates a new BidInfo object that decodes the given string

Throws:
BidInfo.InvalidFormatException
Method Detail

getVendor

public int getVendor()
Returns the decoded vendor number


getItem

public java.lang.String getItem()
Returns the decoded item identifier


getPrice

public float getPrice()
Returns the decoded list price


encode

public java.lang.String encode()
Encode the object contents into a string


toString

public java.lang.String toString()
Returns a string representing the BidInfo object

Overrides:
toString in class java.lang.Object

encode

public static java.lang.String encode(int vendor,
                                      java.lang.String item,
                                      float price)
Encodes a given set of items into a string


encode

public static java.lang.String encode(BidInfo info)
Encode a given BidInfo object into a string


main

public static void main(java.lang.String[] args)
Run several test cases