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

📄 stockdata.java

📁 source code of voyager yellow page
💻 JAVA
字号:
/*
 * RECURSION PROPRIETARY-NOT TO BE DISCLOSED OUTSIDE RECURSION, INC.
 */

/**
 * Created by twheeler on Mar 8, 2007 at 4:08:07 PM
 */
package examples.yellowpages;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.NumberFormat;


/**
 * 
 *
 * @author twheeler
 */
public class StockData implements Serializable
{
  private String ticker;
  private double pe;
  private double[] closingPrices;
  
  /**
   * @param ticker
   * @param pe
   * @param closingPrices
   */
  public StockData(String ticker, double pe, double[] closingPrices)
  {
    this.ticker = ticker;
    this.pe = pe;
    this.closingPrices = closingPrices;
  }
  
  public double[] getClosingPrices()
  {
    return closingPrices;
  }

  public double getPe()
  {
    return pe;
  }
  
  public String getTicker()
  {
    return ticker;
  }
 
  public String toString()
  {
    NumberFormat nf = NumberFormat.getInstance();
    if(nf instanceof DecimalFormat)
    {
      DecimalFormat df = (DecimalFormat) nf;
      df.applyPattern("#.00");
    }
    StringBuffer buf = new StringBuffer();
    buf.append("Ticker:").append(getTicker()).append(", pe:").append(nf.format(getPe()));
    buf.append(", prices:");
    for(int i = 0; i < closingPrices.length; i++)
    {
      buf.append(nf.format(closingPrices[i]));
      if(i != closingPrices.length-1)
        buf.append(", ");
    }
    return buf.toString();
  }
  
}

⌨️ 快捷键说明

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