예제 #1
0
        // Encode function to convert String to object of type OrderClass by splitting using space whcih is the delimiter used in Encoder class
        public static OrderClass Decode(String d1)
        {
            String[]   s       = d1.Split(' ');
            OrderClass object1 = new OrderClass();

            object1.setSenderID(Int32.Parse(s[0]));
            object1.setAmount(Int32.Parse(s[1]));
            object1.setCreditCard(Int32.Parse(s[2]));
            object1.setUnitPrice(Int32.Parse(s[3]));
            return(object1);
        }
예제 #2
0
        // Encode function to convert object of type OrderClass to String by adding space as delimiter
        public static String Encode(OrderClass e)
        {
            String s = Convert.ToString(e.getSenderID()) + " " + Convert.ToString(e.getAmount()) + " " + Convert.ToString(e.getCreditCard()) + " " + Convert.ToString(e.getUnitPrice());;

            return(s);
        }