1 2 5 14 package org.jacorb.trading.db.simple.offers; 15 16 import java.io.*; 17 import java.util.*; 18 import org.omg.CosTrading.RegisterPackage.*; 19 import org.omg.CosTrading.Property; 20 21 public class Offer implements Serializable 22 { 23 private String m_id; 24 private String m_object; 25 private Vector m_props; 26 private transient OfferInfo m_description; 27 28 static final long serialVersionUID = 4241426996695613295L; 29 30 private Offer() 31 { 32 } 33 34 public Offer(String id, org.omg.CORBA.Object obj, Property[] props) 35 { 36 m_id = id; 37 m_object = org.jacorb.trading.TradingService.getORB().object_to_string(obj); 38 setProperties(props); 39 m_description = null; 40 } 41 42 public OfferInfo describe() 43 { 44 OfferInfo result = null; 45 46 if (m_description == null) { 47 result = new OfferInfo(); 48 result.reference = org.jacorb.trading.TradingService.getORB().string_to_object(m_object); 49 result.properties = new Property[m_props.size()]; 50 int count = 0; 51 Enumeration e = m_props.elements(); 52 while (e.hasMoreElements()) { 53 OfferProperty prop = (OfferProperty)e.nextElement(); 54 result.properties[count] = prop.describe(); 55 count++; 56 } 57 58 m_description = result; 59 } 60 else 61 result = m_description; 62 63 return result; 64 } 65 66 67 public void modify(Property[] props) 68 { 69 setProperties(props); 70 m_description = null; 71 } 72 73 74 public int hashCode() 75 { 76 return m_id.hashCode(); 77 } 78 79 80 public boolean equals(java.lang.Object o) 81 { 82 Offer offer = (Offer)o; 83 return m_id.equals(offer.m_id); 84 } 85 86 87 protected void setProperties(Property[] props) 88 { 89 m_props = new Vector(); 90 for (int i = 0; i < props.length; i++) 91 { 92 OfferProperty prop = new OfferProperty(props[i]); 93 m_props.addElement(prop); 94 } 95 } 96 97 98 private void readObject(ObjectInputStream in) 99 throws IOException, ClassNotFoundException 100 { 101 in.defaultReadObject(); 102 m_description = null; 103 } 104 } 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | Popular Tags |