⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portfoliovalue.java

📁 Oracle的J2EE Sample
💻 JAVA
字号:
/*
 * @author  : Pushkala
 * @version : 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 *
 * Name of the File : PortfolioValue.java
 *
 * Creation / Modification History
 *    Pushkala        26-Apr-2002        Created
 *
 */
package oracle.otnsamples.ibfbs.trademanagement.ejb;

import java.io.Serializable;
import java.util.Date;

/**
 * This Class encapsulates Portfolio Valuation information for a particular
 * User Account. When the session facade bean TradeManagementSessionFacadeBean
 * queries the Portfolio Info for a particular User Account, the corresponding
 * valuation details like the current price, gain or loss value, percentage
 * gain or loss which needs to be displayed to the user are passed using this
 * PortfolioValue object.
 *
 * @version 1.0
 * @since   1.0
 */
public class PortfolioValue extends PortfolioInfo implements Serializable {

  // Declaring instance variables required to store the
  // PortfolioValue information

  /** Current Price of Stock */
  private float   currPrice;

  /** Gain or Loss Value */
  private float   gainorloss;

  /** Percentage of gain or loss */
  private float   percent;

  /** Current Value */
  private float   currValue;

  /**
   * Default Constructor
   * @since 1.0
   */
  public PortfolioValue() {
    super();
  }

  /**
   * This constructor sets the values of the instance variables with the
   * input values
   *
   * Parameters required to set the values in the base class
   * @param lineNo       Line Number
   * @param quantity     Quantity
   * @param price        Price
   * @param symbol       Symbol
   * @param companyName  Company Name
   * @param purchaseDate Purchase Date
   * @param purchaseMode Purchase Mode
   * @param tradeId      Trade Id
   *
   * @param currPrice  Current Price
   * @param gainorloss Gain or Loss value
   * @param percent    Percentage of Gain or Loss
   * @param currValue  Current Value of Stock
   * @since 1.0
   */
  public PortfolioValue(Integer lineNo, Integer quantity, float price,
                        String symbol, String companyName, Date purchaseDate,
                        String purchaseMode, Integer tradeId, float currPrice,
                        float gainorloss, float percent, float currValue) {

    // Populate PortfolioInfo
    super(lineNo, quantity, price, symbol, companyName,
          purchaseDate, purchaseMode, tradeId);

    setCurrPrice(currPrice);
    setGainorloss(gainorloss);
    setPercent(percent);
    setCurrValue(currValue);
  }

  /**
   * Returns the Current Price
   *
   * @return Current Price of the stock
   * @since 1.0
   */
  public float getCurrPrice() {
    return currPrice;
  }

  /**
   * Sets the current price
   *
   * @param currPrice Current Price
   * @since 1.0
   */
  private void setCurrPrice(float currPrice) {
    this.currPrice = currPrice;
  }

  /**
   * Returns the gain or loss value
   *
   * @return Gain or Loss value of the stock
   * @since 1.0
   */
  public float getGainorloss() {
    return gainorloss;
  }

  /**
   * Sets the gain or loss value
   *
   * @param gainorloss Gain or Loss value
   * @since 1.0
   */
  private void setGainorloss(float gainorloss) {
    this.gainorloss = gainorloss;
  }

  /**
   * This method gets the gain or loss percentage
   *
   * @return Gain or Loss percentage of the stock
   * @since 1.0
   */
  public float getPercent() {
    return percent;
  }

  /**
   * Sets the gain or loss percentage
   *
   * @param percent Percentage of Gain or Loss
   * @since 1.0
   */
  private void setPercent(float percent) {
    this.percent = percent;
  }

  /**
   * Returns the Current Stock Value
   *
   * @return Current Value of the stock
   * @since 1.0
   */
  public float getCurrValue() {
    return currValue;
  }

  /**
   * Sets the Current Stock Value
   *
   * @param currValue Current Stock Value
   * @since 1.0
   */
  private void setCurrValue(float currValue) {
    this.currValue = currValue;
  }

  /**
   * Method to get String representation of this class.
   * Overrides the method toString() in java.lang.Object
   *
   * @return String representation of this class.
   * @since 1.0
   */
  public String toString() {

    StringBuffer sb = new StringBuffer();

    sb.append("Line Number : "   ).append(this.getLineNo());
    sb.append(" Current Price : ").append(this.getCurrPrice());
    sb.append(" Gain or Loss  : ").append(this.getGainorloss());
    sb.append(" Percent : "      ).append(this.getPercent());
    sb.append(" Current Value : ").append(this.getCurrValue());

    return sb.toString();
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -