📄 sampledata.java
字号:
* @return News instance
*/
public static News getNews(java.util.Date newsdate, String sym, String title, String url) {
News news = new News();
news.setNewsdate(new Timestamp(newsdate.getTime()));
news.setNewstitle(title);
news.setSymbol(sym);
news.setNewsurl(url);
return news;
}
/**
* Construct a collection containing the Stock Exchanges to be populated.
*
* @return Collection of Exchanges to be populated
*/
public static Collection populateExchange() {
Collection xchgs = new ArrayList();
Exchange nyExchange = new Exchange();
nyExchange.setExchangeid(new Integer(1));
nyExchange.setExchangename("NYSE");
nyExchange.setLocation("New York Stock Exchange, USA");
xchgs.add(nyExchange);
return xchgs;
}
/**
* Constructs the Symbols to be populated and returns them in a Collection.
*
* @return Collection of Symbols to be populated.
*/
public static Collection populateSymbol() {
Collection symbols = new ArrayList();
symbols.add(SampleData.getSymbol("ORCL", "Oracle",
"Oracle Corporation is a supplier of software for information management. The Company develops, manufactures, markets and distributes computer software thathelps corporations manage and grow their businesses. The Companys software productscan be categorized into two broad areas: systems software and business applicationssoftware.",
"Y", 1));
symbols.add(SampleData.getSymbol("AOL", "AOL",
"AOL Time Warner Inc. is a fully integrated, Internet-powered media and communications company. The Company was formed in connection with the merger of America Online, Inc.(America Online) and Time Warner Inc. (Time Warner), which was consummated on January 11, 2001. America Online and Time Warner are wholly owned subsidiaries of AOL Time Warner.",
"Y", 1));
symbols.add(SampleData.getSymbol("BEAS", "Bea Systems",
"BEA Systems, Inc. is a e-business infrastructure software company. Customers use BEA products as a deployment platform for Internet-based applications including custom-built and packaged applications, and as a means for robust enterprise application integration among mainframe, client/server and Internet-basedapplications.",
"Y", 1));
symbols.add(SampleData.getSymbol("CSCO", "CISCO Systems",
"Cisco Systems Inc. is engaged in networking for the Internet. Cisco Internet Protocol(IP)-based networking solutions are installed at corporations, public institutions and telecommunication companies, and are found in a growing number of medium-sized commercial enterprises.",
"Y", 1));
symbols.add(SampleData.getSymbol("IBM", "IBM",
"International Business Machines Corporation (IBM) manufactures and sells computer services, hardware and software. The Company also provides financing services in support of its computer business. The Companys major operations comprise a Global Services segment, three hardware product segments (Enterprise Systems, Personal and Printing Systems, and Technology), a Software segment, a Global Financing segmentand an Enterprise Investments segment.",
"Y", 1));
symbols.add(SampleData.getSymbol("HPQ", "HEWLETT-PACKARD",
"Hewlett-Packard Company is a global provider of products, technologies, solutions and services. The Companys offerings span information technology (IT) infrastructure,personal computing and access devices, global services and imaging and printing. In May 2002, the Company merged with Compaq Computer Corporation.",
"Y", 1));
symbols.add(SampleData.getSymbol("MSFT", "Microsoft",
"Microsoft Corporation develops, manufactures, licenses and supports a wide range ofsoftware products for a multitude of computing devices. Microsoft software includes scalable operating systems for servers, personal computers (PCs) and intelligent devices, server applications for client/server environments; knowledge worker productivity applications; and software development tools. ",
"Y", 1));
symbols.add(SampleData.getSymbol("PSFT", "Peoplesoft",
"PeopleSoft, Inc. designs, develops, markets and supports a family of enterprise application software products for use throughout large and medium-sized organizations.The Company provides enterprise application software for customer relationship management (CRM), human resources management, financial management and supply chain management (SCM), along with a range of industry-specific products.",
"Y", 1));
symbols.add(SampleData.getSymbol("SUNW", "Sun Microsystems",
"Sun Microsystems, Inc. (Sun) is a worldwide provider of products, services and support solutions for building and maintaining network computing environments. Sun sells scalable computer and storage systems, high-speed microprocessors, and a comprehensive line of high-performance software for operating network computingequipment. ",
"Y", 1));
return symbols;
}
/**
* Constructs the Stock rates to be populated and returns them in a Collection.
*
* @return Collection of StockRates to be populated
*/
public static Collection populateStockRate() {
Collection stockrates = new ArrayList();
try {
stockrates.add(SampleData.getStockrate("PSFT", dtFormat.parse("28-AUG-2003"),
16.79, 17.29));
stockrates.add(SampleData.getStockrate("HPQ", dtFormat.parse("28-AUG-2003"),
19.52, 20.02));
stockrates.add(SampleData.getStockrate("SUNW", dtFormat.parse("28-AUG-2003"),
3.81, 4.31));
stockrates.add(SampleData.getStockrate("CSCO", dtFormat.parse("28-AUG-2003"),
19.01, 19.51));
stockrates.add(SampleData.getStockrate("IBM", dtFormat.parse("28-AUG-2003"),
82, 82.5));
stockrates.add(SampleData.getStockrate("BEAS", dtFormat.parse("28-AUG-2003"),
12.63, 13.13));
stockrates.add(SampleData.getStockrate("AOL", dtFormat.parse("28-AUG-2003"),
15.85, 16.35));
stockrates.add(SampleData.getStockrate("ORCL", dtFormat.parse("28-AUG-2003"),
12.45, 12.95));
stockrates.add(SampleData.getStockrate("MSFT", dtFormat.parse("28-AUG-2003"),
26.42, 26.92));
}catch(ParseException parseEx) {
System.out.println("Error loading stock rates :"+parseEx);
}
return stockrates;
}
/**
* Constructs the News to be populated and returns them in a Collection.
*
* @return Collection of News items.
*/
public static Collection populateStockNews() {
Collection stocknews = new ArrayList();
try {
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"HPQ", "Yahoo! Finance - Before the Bell- Network Appliance, Hewlett- ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030820%2F80%2Fe6jia.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"CSCO", "TheStreet.com: Cisco, Lucent and Nortel: Prime Lenders for the ... ", "http%3A%2F%2Fwww.thestreet.com%2Ftech%2Ftelecom%2F1163145.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"CSCO", "Cisco: Stock Options Fuel IT Industry Growth", "http%3A%2F%2Fwww.internetnews.com%2Ffina-news%2Farticle.php%2F10795_2233641"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"SUNW", "Before the Bell-Sun drops, GlaxoSmithKline rises", "http%3A%2F%2Fuk.biz.yahoo.com%2F030723%2F80%2Fe4s50.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"AOL", "US stocks to open higher, eyes on AOL, Kodak", "http%3A%2F%2Fuk.biz.yahoo.com%2F030723%2F80%2Fe4s0e.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"SUNW", "Before the Bell-Cyberonics up, Sun Microsystems ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030723%2F80%2Fe4s6o.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"PSFT", "PeopleSoft Beats Estimates, Announces Stock ... ", "http%3A%2F%2Fwww.thestreet.com%2Fbrknews%2Fsoftware%2F1129762.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"HPQ", "Hewlett-Packard, Intel fall",
"http%3A%2F%2Fuk.biz.yahoo.com%2F030820%2F80%2Fe6jgn.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"ORCL", "US tech stocks rise on Oracle. other shares dip", "http%3A%2F%2Fuk.biz.yahoo.com%2F030811%2F80%2Fe5zuo.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"IBM", "US stocks fall as IBM, Nokia earnings disappoint", "http%3A%2F%2Fuk.biz.yahoo.com%2F030717%2F80%2Fe4gw7.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"AOL", "AOL yahoo news", "http%3A%2F%2Ffinance.yahoo.com%2Fq%3Fs%3Daol"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"MSFT", " US stocks fly on Microsoft, McDonald's, budget ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030718%2F80%2Fe4j8w.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"BEAS", "BEA Systems' Profit Up, but Stock Slips", "http%3A%2F%2Fbiz.yahoo.com%2Frb%2F030814%2Ftech_beasystems_earns_1.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"BEAS", "BEA Systems Posts Good Numbers, but Own Stock ... ", "http%3A%2F%2Fwww.thestreet.com%2Ftech%2Fsoftware%2F1173760.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"IBM", "US stocks slide on disappointment over IBM, ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030717%2F80%2Fe4gsx.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"PSFT", "Before the Bell- ImClone, PeopleSoft, Oracle ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030606%2F80%2Fe1pz8.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"PSFT", "PeopleSoft Stock Price", "http%3A%2F%2Fwww.businessweek.com%2Fmagazine%2Fcontent%2F02_15%2Fc3778062.htm"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"BEAS", "AMAT, BEA Systems Rise After Hours", "http%3A%2F%2Fstocks.internetnews.com%2Fclose%2Farticle%2F0%2C%2C1701_866091%2C00.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"MSFT", "Microsoft cuts stock options (archived)", "http%3A%2F%2Ffinance.news.com.au%2Fcommon%2Fstory_page%2F0%2C4057%2C6725129%25255E14305%2C00.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"AOL", "Yahoo! Finance - AOL", "http%3A%2F%2Ffinance.yahoo.com%2Fq%3Fs%3DAOL"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"HPQ", "Before the Bell-Network Appliance up, Hewlett- ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030820%2F80%2Fe6jro.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"ORCL", "Oracle scales back Ellison's stock ...", "http%3A%2F%2Fuk.biz.yahoo.com%2F030716%2F94%2Fe4a9q.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"MSFT", "Microsoft to beef up finance function", "http%3A%2F%2Fwww.msnbc.com%2Fnews%2F942907.asp"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"ORCL", "US tech issues boosted by Oracle; Dow flat", "http%3A%2F%2Fuk.biz.yahoo.com%2F030811%2F80%2Fe6035.html"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"CSCO", "Cisco: Stock Options Fuel IT Industry Growth", "http%3A%2F%2Fwww.internetnews.com%2Ffina-news%2Farticle.php%2F2233641"));
stocknews.add(SampleData.getNews(dtFormat.parse("28-AUG-2003"),
"IBM", "US stocks slide on disappointment over IBM, ... ", "http%3A%2F%2Fuk.biz.yahoo.com%2F030717%2F80%2Fe4gsw.html"));
} catch(ParseException parseEx) {
System.err.println("Error parsing date to construct stock news :"+parseEx);
}
return stocknews;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -