home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-01-24 | 1.2 KB | 56 lines |
- package COM.odi.demo.pport;
-
- /**
- * <H3>Copyright (C) Object Design Inc. 1996, 1997</H3>
- *
- * A Trade represents the purchase or sale of some amount of some
- * security on some date.
- */
-
- import COM.odi.*;
-
- final
- public class Trade
- {
- /* The security that was bought or sold. */
-
- public Security security;
-
- /* The date on which the trade occurred. */
-
- public TradeDate date;
-
- /* The amount by which our position changed. A positive delta
- means that we bought some shares, and a negative delta means
- that we sold some shares. */
-
- public int delta;
-
- /* Make a new Trade. */
-
- Trade(Security security, TradeDate date, int delta)
- {
- this.security = security;
- this.date = date;
- this.delta = delta;
- }
-
- public String asString() {
- StringBuffer tmpString = new StringBuffer(security.getSymbol());
- while (tmpString.length() < 6) {
- tmpString.append( " " );
- }
- tmpString.append( " | " );
- tmpString.append(date.toString());
- tmpString.append( " | " );
- tmpString.append(Integer.toString(delta, 10));
- return tmpString.toString();
- }
-
- /* This class is never used as a persistent hash key. */
- public int hashCode() {
- return super.hashCode();
- }
- }
-
-