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