Wednesday, July 31, 2019

H&M Hennes & Mauritz Ab in Retailing

Hennes & Mauritz (H&M) AB in Retailing December 2009 Scope of the Report Retailing – Hennes & Mauritz  © Euromonitor International Scope †¢ This global company profile covers the following products focusing on the year 2009: Retailing: US$10,430 billion Store-based Retailing: US$9,829 billion Non-Store Retailing: US$601 billion Clothing & Footwear Specialist Retailers: US$791 billion Homeshopping: US$190 billion Internet Retailing: US$243 billionDisclaimer Much of the information in this briefing is of a statistical nature and, while every attempt has been made to ensure accuracy and reliability, Euromonitor International cannot be held responsible for omissions or errors Figures in tables and analyses are calculated from unrounded data and may not sum. Analyses found in the briefings may not totally reflect the companies’ opinions, reader discretion is advised Learn More To find out more about Euromonitor International's complete range of business ntelligence on industries, countries and consumers please visit www. euromonitor. com or contact your local Euromonitor International office: London + 44 (0)20 7251 8024 Vilnius +370 5 243 1577 Chicago +1 312 922 1115 Dubai +971 4 609 1340 Singapore +65 6429 0590 Cape Town +27 21 552 0037 Shanghai +86 21 63726288 Santiago +56 2 4332226 2 Retailing – Hennes & Mauritz  © Euromonitor International Strategic Evaluation Competitive Positioning Geographic Opportunities Category Opportunities Brand and Operational Strategies Recommendations 3 Strategic EvaluationRetailing – Hennes & Mauritz  © Euromonitor International Key Company Facts Hennes & Mauritz (H) AB Headquarters Regional Involvement Stockholm, Sweden Asia Pacific, Eastern Europe, North America, Western Europe, Middle East and Africa Clothing and footwear specialist retailers, homeshopping, internet retailing H robust performance in battle with Inditex †¢ The world’s second largest clothing and footwear Sector Inv olvement World clothing and footwear 1. 7% (2009) specialist retailers share 1. 5% (2008) Retail sales value growth (US$) -4. 1% (2009) 17. % (2008) specialist retailer in 2009, behind Inditex, and ahead of Gap, H continued to record strong sales growth in 2008 and 2009. This was achieved partly thanks to a strong performance in its largest market, Germany, with sales in local currency terms up by double-digits. †¢ Inditex’s and H battle for the world’s largest clothing and footwear retailer position is closely fought, while Gap, which was the world’s largest player in this channel until 2007, has been significantly left behind by the leading two. Hennes & Mauritz (H) AB – Sales excl.VAT vs Profit After Tax 90,000 SEK million 80,000 70,000 60,000 50,000 40,000 30,000 2004 2005 2006 2007 2008 Sales excl VAT Profit after tax 18,000 14,000 12,000 10,000 8,000 6,000 SEK million 16,000 H profits remain healthy †¢ H registered sales excluding VAT of S EK88. 5 billion (US$13. 7 billion) in 2008, an increase of 13% over the year, with profit after tax also up 13% to SEK15. 3 billion (US$2. 4 billion), which highlights the group’s high margin. †¢ Its major rival, Inditex, recorded revenue of EUR10. 4 billion (US$14. 5 billion) in 2008, up 10% on the previous year, with net profit up 0. % to EUR1. 3 billion (US$1. 8 billion). Gap registered sales of US$14. 5 billion, down 8% in the year, as it suffered from poor conditions in its core US market, though the company’s net profit grew by 16% to US$967 million, helped by cost savings. 4 Strategic Evaluation Retailing – Hennes & Mauritz  © Euromonitor International Q3 results: Resilient Performance, Continued Expansion Hennes & Mauritz (H) AB – Q1 to Q3 Sales excluding VAT (SEK billion) Profit after tax (SEK billion) Net margin (%) 73. 4 (2009) 62. 2 (2008) 10. 2 (2009) 10. 2 (2008) 13. 9 (2009) 16. (2008) Resilient performance, with sales driven by stor e network expansion †¢ H sales excluding VAT grew by 13% to SEK23. 6 billion (US$3. 4 billion) in the third quarter ending August 2009. Group profits after tax continued to rise, up by 4% to SEK3. 5 billion (US$506 million). †¢ However, same-store sales declined slightly in local currency terms, with consumer sentiment remaining subdued and hindering sales of non-grocery retailers, especially in the US, while the German market was resilient and strong gains were made in Italy. †¢ For the nine months to August 2009, sales were up by 18% to SEK73. billion (US$10. 6 billion), with growth boosted by new store openings. Profits after tax were up by 0. 2% to SEK10. 2 billion (US$1. 5 billion). Low inventory levels were a major factor contributing to keep costs down. Inditex records lower sales growth than H †¢ Inditex recorded revenues up by 7% to reach EUR4. 9 billion (US$7. 1 billion) in the six months to July 2009. Growth in Asia’s emerging markets continued to boost revenues, especially in China and Hong Kong, offsetting a negative economic environment in its Spanish domestic market where it saw a strong decline in like-for-like sales. Although impacted by the recession in Europe, Inditex’s profits were resilient, helped by efficient cost controls. The group recorded net income down by only 8% on the previous year to EUR375 million (US$550 million), despite sustained investments in network expansion. 5 Hennes & Mauritz (H) AB – Net Sales excl VAT vs Profit After Tax 75,000 72,500 70,000 SEK million 67,500 65,000 62,500 60,000 57,500 55,000 52,500 50,000 2008 Q1 to Q3 Net sales excl VAT 2009 Q1 to Q3 Profit after tax 12,000 11,500 SEK million 11,000 10,500 10,000 9,500 9,000 8,500 8,000Strategic Evaluation Retailing – Hennes & Mauritz  © Euromonitor International SWOT – Hennes & Mauritz (H) AB Brand recognition: low price and style Combining style innovations and low prices are staple attributes of the H br and on which it has built strong consumer recognition. High profile advertising and collaboration with designers help make stores shopping destinations and raise the desirability of its ranges. Operational efficiency A strong control of the whole logistics process helps H achieve low costs, while low inventory contributes to maintain margins.Reliance on outsourcing The reliance on production outsourcing, unlike other rivals such as Inditex, puts H at greater risks of damaging its reputation in terms of product quality and poor labour conditions in developed countries. Modest presence in emerging markets Despite being a global player present in 33 markets, H has developed its presence in Europe and North America mostly, unlike Inditex operating in over 70 countries including many emerging markets. Strengths Weaknesses Opportunities ThreatsInternet retailing The rapid growth of clothing and footwear sales through internet retailing is expected to continue and give H opportunities to r each a wider audience, especially in its core demographic target, teenagers and young adults, whose purchases are often influenced by the internet. Untapped potential in emerging markets Urbanisation, increased disposable incomes and changing lifestyles making the population more aware of fashion trends give major growth opportunities in large emerging markets such as China and Russia. There is also potential in markets where H is absent such as Turkey and Romania.Non-food expansion of grocery retailers Hypermarkets and mass merchandisers including Carrefour, Target, Tesco and Wal-Mart are set to continue developing their offer of non-food products and compete directly against H in the value segment of clothing and footwear retailing. Fast fashion becoming more competitive H faces a growing threat from a number of direct competitors with increasingly global ambitions at the low-priced end of the market such as Associated British Foods with Primark, Fast Retailing with Uniqlo and Mar ks & Spencer, alongside a resurgent Gap. 6 Strategic Evaluation Retailing – Hennes & Mauritz Euromonitor International Key Strategic Objectives and Challenges Speed to market and price strategy Fast product turnaround, flexibility and speed to market are major elements determining fast fashion retailers’ operational efficiency. H record is strong comparable to Inditex in most aspects, although Inditex has an advantage regarding speed to market, as a result of its vertical integration business model. In the midst of the global economic crisis particularly affecting clothing and footwear specialists, H chose to avoid heavy discounting in order to maintain its margins and profits.However, more aggressive price wars may force it to discount more and hit its margins. Ongoing international expansion with a focus on emerging markets H presence in emerging markets is less important than Inditex’s, which has a major store network in Latin America and more stores in the M iddle East and Africa. Expanding in emerging markets remains a priority for H, although growth prospects remain strong in developed markets such as Canada and the US where it can enter numerous new cities, especially in Southern States where it has a modest presence.H CEO KarlJohan Persson appointed in July 2009 restated the group’s global expansion targets, although it appears to be slower than expected, with around 160 new stores likely to be opened out of 225 initially planned for 2009. Maintain brand image and increase desirability Collaborations with designers will need to be continued and reinvented to make products more desirable, make stores more popular shopping destinations and strengthen the emotional bond with consumers and H.Distinctive store layout has been used successfully by Inditex with its Zara chain to convey the desirability of its clothes, and this is a strategy that H could also implement to make the store designs a more important aspect of its strategy . This could allow H to maintain an advantage over smaller rivals with increasing global ambitions for their brands such as Primark and Uniqlo. Late entry into internet retailing Although growth in internet retailing sales is particularly promising for clothing and footwear retailers, H has been a late entrant and will struggle to seize the opportunities offered by this channel.It has left numerous other retailers including pure play internet retailers such as Amazon and Asos and the homeshopping specialist Otto take a lead. Hence, it will be difficult for H to target these consumers and generate traffic to its websites, although it could rely on high-profile advertising and innovative sites to succeed. 7 Retailing – Hennes & Mauritz  © Euromonitor International Strategic Evaluation Competitive Positioning Geographic Opportunities Category Opportunities Brand and Operational Strategies Recommendations 8 Competitive Positioning Retailing – Hennes & Mauritz Euromonitor International H Performs Strongly but Growth is Matched by Inditex †¢ International expansion and fashionable product assortment led to strong growth for H and its main rival Inditex, despite a marked slowdown in 2009 due to the global economic crisis and the strength of the US dollar. Clothing & Footwear Specialist Retailers – World – Retail Value RSP excl Sales Tax – US$ – % Year-on-Year Growth 28 24 20 16 12 8 4 0 -4 -8 -12 2005 % y-o-y growth A C B 2006 World C Mode Brenninkmeijer & Co INDITEX – Industria de Diseno Textil 2007 2008 Hennes & Mauritz (H) AB Gap Inc, The 2009A – H sales record strong growth, on a par with C, thanks to global store network expansion. However, Inditex outperforms H thanks to more aggressive network expansion not only in Western Europe, but also in emerging markets. B – Gap under-performs its main rivals, hindered by a strong reliance on its low-growth domestic market and a less aggressive price s trategy than H. Gap’s image also suffers from a product assortment perceived as more staid than H and Inditex’s. C – The rise of the US dollar against other global currencies in 2009 is causing a fall in value sales for all retailers.H low-priced positioning and its wide global presence helps the company remain resilient in a challenging environment for non-grocery retailers. 9 Competitive Positioning Retailing – Hennes & Mauritz  © Euromonitor International Competitive Context: Inditex and H on the Rise World – Top 10 Clothing & Footwear Specialist Retailers 2005-2009 Company name INDITEX – Industria de Diseno Textil Hennes & Mauritz (H) AB Gap Inc, The C Mode Brenninkmeijer & Co Ross Stores Inc Fast Retailing Co Ltd Shinamura Co Ltd Limited Brands Inc Benetton Group SpA Burlington Coat Factory Warehouse Corp 5-year 2009 % 2005 2006 2007 2008 2009 trend share ?Gap loses its crown †¢ Gap saw declining sales in 2007 3 3 2 1 1 1. 7 ? ? ? ? ? ? ? ? 2 1 4 6 8 12 5 11 2 1 4 6 8 14 5 12 3 1 4 5 8 11 7 10 2 3 4 5 6 11 7 8 2 3 4 5 6 7 8 9 1. 7 1. 5 1. 4 0. 8 0. 8 0. 5 0. 5 0. 5 and 2008, due to unfavourable economic conditions in its US domestic market, which accounted for 81% of its global sales through the clothing and footwear specialists channel. †¢ Compared to H, Gap’s higher price positioning hindered its sales, especially in 2008 and 2009 as the global economic crisis dampened consumer spending. Fast Retailing and Shinamura rising Japan-based Fast Retailing posted a strong performance among the top ? 10 10 12 14 10 0. 4 10 global players, helped partly by the strengthening of the yen to the Note: 2009 provisional data US dollar. Competing with a similar price positioning to H, Fast Strong growth for H, overtakes Gap but is surpassed by Inditex Retailing expanded outside Japan, †¢ Strong sales growth for H over the 2005-2008 period enabled it to especially in China and South overtake key rival Gap . H business model based on low-priced fast Korea, and announced at the end of fashion proved highly popular with consumers. 008 its intentions to open stores in †¢ However, Inditex recorded a stronger performance than H, thanks to a European markets and in the US. more aggressive expansion strategy, especially in emerging markets. The latter was partly helped by a greater reliance on franchised outlets. Although †¢ As Japan’s second largest clothing and footwear retailer, Shinamura’s H new store opening strategy was also ambitious, its presence in ranking was also boosted by emerging markets remained modest compared to Inditex’s. avourable exchange rates, but also †¢ Inditex also benefited from a vertical integration business model enabling it to thanks to new store openings. renew collections more frequently than its main rivals, including H. 10 Competitive Positioning Retailing – Hennes & Mauritz  © Euromonitor International H and Indi tex Neck-and-Neck †¢ H and Inditex have both been highly successful in the clothing and footwear specialists channel over the 2004- 2009 period. Their positioning based on low-priced fast fashion enables them to appeal to a wide range of consumers, especially since 2008 and with the major world economies entering recession.Their fast fashion business model also gives the two players the flexibility to change collections rapidly to adapt to consumer tastes, although Inditex has the edge over H in this respect. †¢ International network expansion was also a major part in driving sales of both companies, although Inditex has a greater presence in emerging markets, especially thanks to a wide reach in Latin America. Thanks to its greater reliance on franchising, new market entry requires fewer resources and entails less risk for Inditex than for H, which is more biased towards company-owned outlets. Although both companies saw their World – Retailing Sales 2004-2009 reta il sales in US dollar terms hit by the fall in the value of the euro 15,000 against the US dollar, they retained their lead over Gap. The latter’s 12,500 strong dependence on the US market proved a disadvantage, as it suffered 10,000 disproportionately from the recession in its domestic market in 2008 and 7,500 2009, which it could not offset with expansion in emerging markets, where it remains absent. ,000 †¢ In addition, Gap adopted a less aggressive pricing strategy than its 2,500 peers, thus losing share rapidly to H and Inditex, but also to players 0 in other channels in the US such as 2004 2005 2006 2007 2008 2009 mass merchandisers Target and WalHennes & Mauritz (H) AB INDITEX – Industria de Diseno Textil Mart. Retail value sales rsp excl tax (US$ mn) 11 Competitive Positioning Retailing – Hennes & Mauritz  © Euromonitor International Overall Stagnation in Sales per OutletWorld – Top 10 Clothing & Footwear Specialist Retailers – Sales per Outlet 2004-2009 – US$ Fixed Exchange Rates Company name INDITEX – Industria de Diseno Textil Hennes & Mauritz (H) AB Gap Inc, The C Mode Brenninkmeijer & Co Ross Stores Inc Fast Retailing Co Ltd Shinamura Co Ltd Limited Brands Inc Benetton Group SpA Burlington Coat Factory Warehouse Corp Note: 2009 provisional data 2004 3,130,909 7,103,455 5,233,467 7,658,816 6,571,607 5,663,966 3,168,427 2,541,956 916,038 8,482,203 2005 3,222,196 7,072,943 4,976,290 7,435,090 6,719,945 4,185,028 3,129,442 2,686,424 911,815 9,062,259 2006 3,245,793 7,102,853 4,882,942 7,276,803 6,967,172 3,720,254 3,222,800 2,799,494 896,071 9,090,081 2007 3,374,326 7,194,397 4,648,360 7,195,536 7,136,890 3,884,908 3,196,295 2,778,019 913,342 9,032,800 2008 3,291,002 7,279,016 4,180,204 6,979,826 6,784,922 4,520,068 3,201,177 2,636,235 949,993 8,904,762 2009 3,267,473 7,303,864 3,753,935 6,843,244 7,238,611 5,203,178 3,163,917 2,543,005 960,191 8,068,446 % growth 2004/2009 4. 4 2. 8 -28. 3 -10. 6 10. 1 -8. 1 -0. 1 0. 0 4. 8 -4. 9Modest growth in sales per outlet for most players, including H †¢ The growth trend in sales per outlet broadly matches the trends in overall sales growth for the top four global retailers, with H and Inditex outperforming C and Gap. Higher sales per outlet for H compared to Inditex largely reflects H larger average outlet size. †¢ Downward price pressure and prevalent discounting in apparel retailing, accompanied by the growing reliance on production outsourcing to low labour cost countries in the clothing industry, contributed to the stagnation or slight decline in sales per outlet for most retailers, especially for C and Fast Retailing. Sharp contraction for Gap †¢ Gap’s higher-priced positioning and its relative resistance to discounting led to a sharp drop in sales per outlet, as it pted to maintain its margins at the expense of overall sales growth. 12 Retailing – Hennes & Mauritz  © Euromonitor International Str ategic Evaluation Competitive Positioning Geographic Opportunities Category Opportunities Brand and Operational Strategies Recommendations 13 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International A Global Player Still Dependent on Western Europe †¢ Among H top 10 global markets in 2009, all of them were located in Western Europe apart from one, the US. This highlights the company’s modest presence in emerging markets. Western Europe will account for 84% of the group’s sales in 2009.This proportion exceeded 90% in 2005, which illustrates H relative success in expanding its presence globally in order to offset the maturity and saturation in Western Europe’s clothing and footwear retailing. †¢ The company’s largest market, Germany, will account for 26% of world sales in 2009. No other market had a share of global sales exceeding 10%, while the domestic market, Sweden, accounts for 5%, which shows that H is not overly dependent on the economy of a single market. In comparison to H, Inditex is more dependent on its domestic market, which will generate 37% of its world sales in 2009. Both companies seek to extend their global reach, especially in emerging markets, although Inditex has a clear lead in this respect.Hence, H operates in 33 markets as of October 2009, compared to around 70 markets for Inditex. Hennes & Mauritz (H) AB – Clothing & Footwear Specialist Retailers (Company's 10 Largest Markets) 2. 0 1. 5 %CAGR 2009-2014 Netherlands Norway Spain 1. 0 Austria 0. 5 Sweden 0. 0 -0. 5 -1. 0 -1. 5 -2. 0 -2. 5 0 25,000 50,000 75,000 100,000 Market Size 2009 (US$ mn) 125,000 150,000 175,000 France Switzerland USA Opportunity Zone Germany United Kingdom Bubble size shows company sales in market, range displayed: US$536 – 3,497 mn 14 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Western Europe: Ongoing Expansion for H&M and Inditex H& M has a wide presence covering most Western European markets, in which its two main competitors are Inditex and C&A. All three companies have seen their share increase over the 2004-2009 period at the expense of smaller players, especially those with a national presence only. †¢ The shares of H&M and Inditex were driven by aggressive continuous network expansion across most markets. H&M has seen major ongoing store network expansion in most major European markets in 2008 and 2009, especially in France, Germany, Italy, Spain and the UK. Its business model has proved to be relatively recession-proof, thanks to its low prices. †¢ C&A has been distanced by the two largest operators.Positioned as a value retailer targeted at families, C&A lost ground thanks to a less fashionable image and an inferior international presence. The company is absent from major European markets including Italy and the UK, and over 50% of its sales in Western Europe are derived from the German market . Clothing & Footwear Specialist Retailers: Retail Value RSP excl Sales Tax – Company Shares by GBO 4 % value share 3 2 1 0 2004 2005 2006 2007 2008 2009 14 12 % value share 10 Hennes & Mauritz (H&M) AB Company Shares – Top 6 Markets – Clothing & Footwear Specialist Retailers – Retail Value RSP excl Sales Tax 8 6 4 2 0 2004 2005 2006 2007 2008 2009 C&A Mode Brenninkmeijer & Co Hennes & Mauritz (H&M) AB INDITEX – Industria de Diseno Textil France Netherlands SwedenGermany Spain United Kingdom 15 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Western Europe: Primark Emerges as New Major Player Primark expends beyond the British Isles to emerge as a new European player †¢ Primark, owned by Associated British Foods, only recently expanding outside Ireland and the UK with its first outlets in Spain in 2008 and Portugal and test stores in Germany and the Netherlands in 2009, has ambitions to develop a wid e pan-European network. A new market entry is planned in Belgium in 2010. The success recorded by its first stores in Spain indicates that it could become a major Europe-wide player. With a strong brand image based on low prices and trendy collections following fashion trends closely, Primark targets teenagers and young adults, thus competing directly against H&M in terms of demographic and price positioning. Clothing & Footwear Specialist Retailers – Western Europe and United KingdomRetail Value RSP excl Sales Tax – Company Shares by GBO 6 5 % value share 4 3 2 1 0 WE – Hennes & Mauritz (H&M) AB WE – Associated British Foods Plc (ABF) 2005 2006 2007 UK – Hennes & Mauritz (H&M) AB 2008 2009 UK – Associated British Foods Plc (ABF) 16 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Recent and Planned Market Entries: Japan, South Korea †¢ Although geographic expansion has been a central feature o f H&M’s strategy, it has focused until recently on Europe nd North America, in contrast to Inditex venturing in several markets in Latin America and Asia Pacific and C&A’s major presence in Brazil. Recent new market entries in Japan in September 2008 and the planned entry in South Korea in spring 2010 confirm H&M’s adoption of a strategy to be less dependent on Europe and North America. Successful new entry in Japan in 2008 †¢ With its first store in the upmarket shopping district of Ginza in Tokyo, H&M’s market entry was successful. Initial reception was very favourable to the new chain, with around 50,000 shoppers visiting the Ginza store over the first week of opening, and a second Tokyo store was opened in November 2008 in the trendy district of Harajuku. The Harajuku outlet was the first H&M worldwide to sell the fashion labelComme des Garcons, with a collection designed by the Japanese designer Rei Kawakubo. This strategy helped create anticipa tion ahead of the new store opening among fashion-conscious consumers and gives H&M a more exclusive image in Japan than it has in other markets. †¢ Two more outlets in Tokyo are planned by the end of 2009 and a fifth is due to open in 2010, in Osaka. In order to expand faster in the mature Japanese market and to match the scale of its larger rival Inditex, H&M is considering acquisitions to be a possible expansion strategy. Intense price competition in Japan †¢ In a market hit by severe recession in 2009, price competition for clothing and footwear items has intensified. This as highlighted by mass merchandiser chains Justo (Aeon), Ito-Yokado (Seven & I) and Seiyu (Wal-Mart) starting to offer jeans at around ? 1,000 in 2009. Among H&M’s most direct competitors in terms of price and image, the dynamic player Fast Retailing with the Uniqlo chain combining low price and fashionable ranges, followed a similar price move in 2009. However, regardless of price H&M has an advantage in terms of fast fashion in being able to source and offer new products and refresh its collection more frequently than Fast Retailing. South Korea – following in the footsteps of Inditex †¢ Following its successful entry in Japan, H&M plans to open its first outlet in South Korea in March 2010 at a flagship store in Seoul’s business district of Myungdong.In a market less saturated than Japan’s and with fewer major international clothing and footwear specialist chains, H&M is expected to be successful. However, similarly to Japan, H&M enters after Inditex has already established a footprint in 2007 and expanded rapidly since. 17 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Further Growth in Large Emerging Markets: China, Russia †¢ With little presence in emerging markets, H&M is attempting to catch up with rivals, especially by expanding in large emerging markets, especially in China and Russia. Ongoing expansion in China to continue †¢ Following market entry in Hong Kong in 2007, H&M expanded rapidly in 2008 and 2009 with new stores in mainland China.Sales in China accounted for almost 1% of global sales in 2009. The first outlet in Beijing was opened in April 2009 south of Tiananmen Square, with H&M becoming the first foreign retailer to be present in this newly renovated part of the city. In order to create more anticipation around the store opening among consumers, it coincided with the launch of a new collection in collaboration with the designer Matthew Williamson. H&M’s presence in China is expected to continue expanding rapidly through new store openings, both in existing cities and by entering new cities where it can target the rapidly growing number of middle-class urban consumers. Among H&M’s global rivals, although Inditex expanded in China and Hong Kong earlier than H&M and has a stronger presence with more outlets, it has a less developed su pplier network in Asia than H&M, and as a result it can struggle to offer competitive prices to compete against H&M and also against local players, which may lead to the adoption a more differentiated positioning than in other markets. †¢ With Gap planning to enter China in 2010, it is likely that a greater number of international clothing and footwear specialist retailers will enter the market. Competing in a similar price segment to H&M, Fast Retailing announced at the end of 2008 its long-term objective to have 100 Uniqlo outlets in China. Russia – untimely entry but sound long-term prospects †¢ H&M opened its first store in Russia in Moscow in March 2009. However, suffering from a fall in gas and oil revenues, the country’s deep recession in 2009 is worse than previously anticipated and makes H&M’s market entry untimely.Rival Inditex has developed a major presence in Russia over several years, which has allowed the group to take advantage of the bo oming economy until 2008 to expand and establish a wide customer base. Longer term, H&M is set to emerge from the recession relatively unscathed thanks to its low-priced positioning and to have major growth prospects. Key point: With no presence in Latin America unlike C&A and Inditex, H&M could benefit from entering the large markets of Brazil and Mexico where its low prices should help build a major customer base. 18 Geographic Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Franchise Deals Give New Middle East Opportunities Middle East and Africa expansion set to gather pace †¢ H&M’s presence in the main Middle East market, the United Arab Emirates, continued to increase rapidly in 2009 hanks to the franchise agreement signed in 2006 with the Kuwait-based company MH Alshaya Group. †¢ Opting to expand through franchise stores and using a similar growth model as Inditex represents a major new development in H&M’s global expan sion strategy in emerging markets, which is likely to help accelerate its global expansion. †¢ Thanks to the partnership with Alshaya Group, H&M entered the markets of Bahrain and Oman in 2009, and also opened its first two stores in Egypt in the second half of the year. H&M is likely to enter other new markets in the Middle East and Africa by the end of 2009, or in 2010, including Lebanon. †¢ Under another franchise deal signed with the local company Match Retail, H&M plans to enter Israel in 2010.Dedicated store concept for Saudi Arabia †¢ As store concept adaptation is an important ingredient in the success for foreign retailers operating in the Middle East and Africa, and require close attention, franchise partners are in a better position than H&M to implement new concepts. †¢ For example, in order to comply with local sharia law that forces shops to have segregated areas for men and for women, for its market entry in Saudi Arabia in autumn 2008, H&M opted t o adapt its store concept to be only open to women and staffed by women. 19 Retailing – Hennes & Mauritz  © Euromonitor International Strategic Evaluation Competitive Positioning Geographic OpportunitiesCategory Opportunities Brand and Operational Strategies Recommendations 20 Category Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Modest Growth Forecast for H&M’s Main Channel †¢ H&M’s sales through the clothing and footwear specialist retailers channel will account for around 97% of its sales in 2009. This channel is forecast to record modest growth over the 2009-2014 period. While channel sales were hindered by the global economic crisis in 2008 and 2009, they are likely to recover to some extent, although they will remain affected by low price pressures on clothing prevailing within this distribution channel as well as in other channels.H&M has stronger prospects than most other clothing and footwear specialist players thanks to its wide international presence and low-cost and flexible business model allowing the group to undercut most rivals while remaining at the forefront of fashion trends. †¢ The remainder of H&M’s sales is accounted for almost equally by homeshopping and internet retailing, although the latter is increasingly supplanting the former, mirroring the wider industry trend. Expanding internet retailing presence will help offset the growing saturation of clothing and footwear retailing. Unlike Inditex, which is also present in the furniture and furnishings stores channel in a number of markets under the Zara Home brand, H&M does not operate other store-based formats. Hennes & Mauritz (H&M) AB – Global Retailing Presence & Prospects by Channel 9 8 7 6 5 4 3 2 1 0 -1 0 100,000 Internet retailing % CAGR 2009-2014Clothing & footwear specialist retailers Homeshopping 200,000 300,000 400,000 500,000 600,000 Market Size 2009 (US$ million) 700,000 800,000 900,000 Bubble size shows company sales in this channel (2009). Range displayed: US$169 – 13,118 million 21 Category Opportunities Retailing – Hennes & Mauritz  © Euromonitor International Battling Against Hypermarkets and Mass Merchandisers Grocery retailers and mass merchandisers increase price pressure on clothing and footwear specialists †¢ Clothing and footwear specialist retailers are increasingly seeing more intense competition from rivals operating †¢ †¢ †¢ †¢ mostly in other store-based channels, such as mass merchandisers and hypermarkets.As H&M is positioned in the low-priced segment in clothing and footwear retailing, it is vulnerable to the direct competition from these channels and needs to cultivate its clear competitive advantage in terms of fashion and desirability. An example of the intensifying competition affecting clothing and footwear retailers is the price war between Fast Retailing (Uniqlo) and mass merchandisers Aeon (Jusco) and Wal -Mart (Seiyu) in Japan to sell jeans at around ? 1,000 in 2009. In the US, Gap’s sales have been eroded by the success of mass merchandiser Target’s aggressively priced clothing ranges. In Western Europe, the expansion of major hypermarket operators including Auchan, Carrefour, Tesco and Wal-Mart into non-food products is set to continue as they seek to improve margins.Although this trend has slowed down to some extent in 2008 and 2009 due to the global economic crisis, with grocery retailers refocusing at least temporarily on more recession-proof food items, the longer-term trend is expected to see hypermarkets attempting to be more competitive in their offer of clothing and footwear, with more appealing ranges to compete more directly against specialist non-grocery retailers. In the UK, Wal-Mart’s Asda chain, thanks to the increased sales of its George apparel range in 2009, threatens to overtake Marks & Spencer and Associated British Foods’ Primark cha in to become the country’s largest clothing retailer. Tesco saw clothing sales improve in the first half of 2009 alongside growth in non-food sales, up by 8%. Meanwhile, Sainsbury’s is planning to increase space allocated to non-food ranges in 2010 and 2011 and widen the reach of its successful TU range of clothes by offering it at more stores. 22 Category OpportunitiesRetailing – Hennes & Mauritz  © Euromonitor International Internet Retailing: H&M’s Late Entry H&M and Inditex both rise to the challenge and plan to develop internet retailing †¢ Beyond store-based rivals, clothing and footwear specialist retailers are increasingly battling against internet retailers and most of them react by developing or expanding their own online retailing activity. With consumers’ familiarity with ordering online generally on the rise, coupled with efforts from internet retailers to make their websites more visually appealing and user-friendly, consumersà ¢â‚¬â„¢ confidence in ordering clothes via the internet has been strongly boosted. Major homeshopping retailers which are also leading players in clothing, for example, Otto, are increasingly moving online. Similarly, H&M’s homeshopping sales in Austria, Germany, Netherlands and the Nordic countries are gradually migrating to internet retailing. The company’s significant experience in homeshopping in these markets prepares it well to tackle the logistics aspects to make internet retailing operations efficient across European markets. †¢ Both Inditex and H&M made announcements in 2009 indicating that they are gradually joining the fray and expanding online in most European markets. Inditex will start operations in major European markets by early 2010, while H&M will launch its website in autumn 2010 in the UK.Thanks to its wide product assortment, the vast choice increases H&M’s chances of success in internet retailing although this requires the site to be d esigned in a way to be easy to navigate. †¢ However, H&M is a late entrant in the channel and appears to have made a protracted move, with a plethora of major other operators including Amazon, Asos, the John Lewis Partnership, Marks & Spencer and Tesco having already obtained a strong foothold in UK online clothes retailing. Rival Gap also plans to launch its own website in the UK, following its earlier initiative in 2009 to sell its products on the Asos. com website. In the US, Gap has a multibrand website and offers combined delivery on cross-brand orders.Aggressive expansion from internet retailing specialists and grocery retailers †¢ Major grocery retailers have high ambitions for online clothes sales, as shown by Tesco’s relaunch of its UK clothing website in September 2009 offering private label and brands, and with Wal-Mart’s Asda offering the George label at Asda Direct since 2008. Websites of grocery retailers also often offer the added convenience o f click-and-collect services. Among specialist internet retailers, Amazon’s acquisition of the US online clothes retailer Zappos for US$850 million in August 2009 signals its ambitions in apparel retailing, and its low prices and high number of visits from customers give it key competitive advantages.Key point: With internet retailing making price comparisons between retailers easier, H&M should focus on advertising its low prices and promotions on its transactional website, while also emphasising the more fashionable design of its clothes in order to differentiate its website from Amazon and the grocery retailers. 23 Retailing – Hennes & Mauritz  © Euromonitor International Strategic Evaluation Competitive Positioning Geographic Opportunities Category Opportunities Brand and Operational Strategies Recommendations 24 Brand and Operational Strategies Retailing – Hennes & Mauritz  © Euromonitor International H&M: A Widely Recognised Global Brand Strong brand a wareness and image †¢ H&M’s strong brand image is associated with value and stylish collections, helped by the collaborations with famous designers. The latest example is the creation of the Jimmy Choo collection to be launched in November 2009.Such events create a great amount of publicity and media coverage to generate added footfall. †¢ In a similar way to Inditex, H&M relies on opening stores at a few flagship locations in major cities in order to build its brand image. Examples of such stores include the Harajuku store in Tokyo and the Champs Elysees store in Paris planned for 2010. †¢ Highlighting the H&M brand’s high level of awareness, it was ranked 21st among the top 100 most valuable global brands according to Interbrand in 2009, with a value exceeding US$15 billion. In comparison, Zara ranked only 50, while Gap came in at number 78. High-profile advertising with celebrities is widely used by H&M, unlike Inditex.H&M spends around 5% of its reve nues on advertising. H&M Brand geographic Asia Pacific, Eastern involvement Europe, Middle East and Africa, North America, Western Europe Brand channels Clothing & footwear specialist retailers World ranking & share 1 and 1. 6% (2009) in clothing and footwear specialist retailers Multi-brand approach from Inditex †¢ In sharp contrast to H&M’s almost exclusive Brands other than H&M gain greater importance †¢ The more upmarket COS successfully launched in the UK in 2007 enabling the group to target wealthier customers and potentially increase its margins. It was subsequently extended to other markets: Belgium, Denmark, Germany and the Netherlands. The Swedish chain Monki, acquired in 2008 and known for its sophisticated and colourful store designs, is not being rebranded and was expanded outside Sweden in 2009 with two stores in Denmark. This should allow H&M to diversify its customer base. reliance on its eponymous brand, Inditex has adopted a strategy based on build ing a vast brand portfolio including Bershka, Massimo Dutti, Pull and Bear, Zara and Zara Home. †¢ The key competitive advantages resulting from this company’s multi-brand strategy is its ability to target a wide range of consumer groups with brands and products tailored to various tastes in order to bring exclusivity and differentiation. The level of independence of the company’s major brands is also an important aspect of Inditex’s capacity to adapt quickly to changing market conditions. Group synergies are ensured thanks to the group's vertical integration, which also contrasts with H strategy of outsourcing. 25 Brand and Operational Strategies Retailing – Hennes & Mauritz  © Euromonitor International Operations and Private Label Strategies Production outsourcing vs.. vertical integration †¢ H sources around 70% of its product assortment from Asia and over one third is purchased from China. It relies heavily on outsourcing production, with over 21 production offices worldwide (10 in Europe, 10 in Asia and 1 in Africa) liaising with over 750 factories.In contrast, Inditex sources the majority of its products from Europe, and most of its production is made in-house in order to cut the time lag between product design and in-store availability. †¢ Although production in Asia helps H undercut Inditex on price, it also makes it more vulnerable to currency fluctuations, with the value of the US dollar strengthening in 2009 against European currencies and making imports from Asia more expensive in its main market, Europe. This reduced at least temporarily the scale of its competitive advantage over Inditex. Low inventory levels †¢ H operational efficiency is reflected in the level of inventory being usually low thanks to the frequent renewal of its collection.However, the focus on reducing inventory in order to protect margins has been detrimental to sales in some months in 2009, especially over the summer, when the company had relatively few items available for markdowns. Although H generally achieves low inventory costs, it is likely to be often surpassed by Inditex in this respect. As one of the pioneers of the fast fashion business model with new ranges being introduced every two weeks, Inditex is particularly efficient in incorporating feedback from stores daily into the development of new products, thanks to vertical integration and as such, H cannot replicate this model. Private label ranges under various names †¢ All of H product assortment consists exclusively of private label. Private label ranges have various names to arget different genders and customer types. For example, Hennes is targeted at 25-35 year-old women, L. O. G. G. is a casual sportswear label and MAMA is a maternity range. Key point: As European consumers’ awareness of ethical issues increases, H is vulnerable to negative publicity surrounding working conditions at factories producing its clothes in Asia. Since it outsources a greater share of its products from Asia than Inditex and has less control over its supply chain, H auditing of factories must be strict and transparent to limit the chances of poor labour conditions being publicised and tarnishing its brand reputation. 26 Retailing – Hennes & Mauritz Euromonitor International Strategic Evaluation Competitive Positioning Geographic Opportunities Category Opportunities Brand and Operational Strategies Recommendations 27 Recommendations Retailing – Hennes & Mauritz  © Euromonitor International Key Recommendations Develop more premium chains alongside core low-priced offering †¢ H focus on affordability remains Internet retailing to be differentiated and wide-reaching †¢ As H is a late entrant in the New market entries and expansion in existing markets †¢ Entering into new emerging a core element of its success and contributed to make the retailer resilient in a recessionary economic environment. Alth ough its low-priced and fashionable image with its eponymous brand H should not be jeopardised, in addition to cultivating it, the retailer should also attempt to widen its customer base and especially target wealthier consumers with its other banners such as COS and Monki stores offering edgy fashion. This could also help increase profits once the economy recovers and consumers become less cost-conscious. internet retailing arena in most European markets and arrives in a crowded and competitive market where Amazon and Otto have made inroads, it will need to offer innovative transactional websites that can convey effectively the textures, colours and finish of its clothes in order to differentiate its offer but still highlight the low prices. H presence in internet retailing could also be extended to markets where it does not seek to open physical stores, mirroring the example of Marks & Spencer delivering products to around 80 countries since autumn 2009. markets, especially in nei ghbouring markets to those where it operates, offers considerable growth opportunities for H. †¢ Romania and Turkey are large European markets where the store concept is likely to be popular and where rival Inditex has developed a major store network. In Latin America, Mexico offers opportunities in the value segment of clothing and footwear retailing. Although it is well covered by C and Wal-Mart, H can cater for more fashionconscious consumer groups. In Asia Pacific, H burgeoning presence could accelerate by expanding to new cities, especially in China and Japan. In the latter market, new store concepts and collections or new banners such as COS and Monki could be tested. 28 Retailing – Hennes & Mauritz  © Euromonitor International Experience more†¦ This research from Euromonitor International is part of a global strategic intelligence system which offers a complete picture of the commercial environment . Also available from Euromonitor International: Global Bri efings The state of the market globally and regionally, emerging trends and pressing industry issues: timely, relevant insight published every month. Global Company ProfilesThe competitive positioning and strategic direction of the leading companies including uniquely sector-specific sales and share data. Country Market Insight Reports The key drivers influencing the industry in each country; comprehensive coverage of supply-side and demand trends and how they shape the future outlook. Interactive Statistical Database Market sizes, market shares, distribution channels and forecasts; the complete market analysed at levels of category detail beyond any other source. Strategy Briefings Executive debate on the global trends changing the consumer markets of the future. Learn More To find out more about Euromonitor International's complete range of business intelligence on industries, countries and consumers please visit

Tuesday, July 30, 2019

New Heritage Doll Company: Capital Budgeting Essay

The New Heritage Doll Company’s Vice-President of Production, Emily Harris, had to decide which of two proposals she should approve for the company’s upcoming capital budgeting meetings. The first project involved expanding an existing â€Å"Match My Doll Clothing† line, which had a proven record of success in the past. The second project introduced a new initiative called â€Å"Design Your Own Doll†, which used a web-based software enabling users to customize a doll’s features to the customers’ specifications. To help Emily reach her decision, I will calculate the Net Present Value (NPV) of both projects to find out which project is more profitable. In the financial analysis of both projects Emily was given the following assumptions: 1. Operating projections were used to develop cash flow forecasts and then to calculate Net Present Value, Internal Rates of Return, payback period and other investment metrics. The cash flows excluded all financing charges and non-cash items (i.e. depreciation), and were calculated on an after-corporate-tax basis. The New Heritage’s corporate tax rate was 40% 2. Discount rate was set at 8.4% – for medium-risk project 3. NPV calculations included a terminal value computed as the value of a perpetuity growing at constant rate. I computed Free Cash Flows (FCF) to find out the actual amount of cash from operations that the company could use in developing its new projects. I calculated the terminal value for 2020 as projected FCF in the first year beyond the projection horizon divided by discount rate of 8.4% less the perpetuity growth rate, which in this case was 3%. According to my calculations the MMDM’s terminal value in 2020 is 16,346,000 and DYOD’s is 27,486,000.

Monday, July 29, 2019

Java Based Search Engine

ACKNOWLEDGMENT I express thanks and gratitude to Mr. †¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦H. O. D computer science department, †¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦College for his encouraging support and guidance in carrying out the project. I would like to express gratitude and indebtedness to Mr†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦, for his valuable advice and guidance without which this project would not have seen the light of the day. I thank Mr†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦ , project guide , GSS for his insistence on good programming technique which helped us to design and develop a successful model of an Chatting Tool. Name CONTENTS 1.STUDY & ANALYSIS PHASE 1. 1 INTRODUCTION 1. 1. 1 PURPOSE OF THE PROJECT 1. 1. 2 PROBLEM IN EXISTING SYSTEM 1. 1. 3 SOLUTION OF THESE PROBLEMS 1. 1. 4 SCOPE OF THE PROJECT 1. 1. 5 LIMITATIONS 1. 1. 6 HARDWARE & SOFTWARE SPECIFICATIONS 1. 1. 7 ORGANISATION PROFILE 2. PROJECT ANALYSIS 1. STUDY OF THE SYSTEM 2. INPUT & OUTPUT 3. PROCESS MODULES USED WITH JUSTIFICATION 3. DESIGN PHASE 1. DATAFLOW 2. UML DIAGRAMS 4. IMPLEMENTATION PHASE 5. TESTING 1. TYPES OF TESTING 1. COMPILING TEST 2. EXECUTION TEST 3. OUTPUT TEST 5. PROJECT CODING 6. OUTPUT SCREENS 7. CONCLUSION 8. BIBLOGRAPHYSTUDY PHASE INTRODUCTION: EXISTING SYSTEM With the advent of the Internet in the past decade, searching for information in various formats has been redefined by the internet search engines, most of them being based on information retrieval (IR) indexing techniques. IR-based searching, which usually allows formulation of queries with multiple words PROPOSED SYSTEM This Java application is basically a recursive file finder. You can search for files based on their filename, their contents, or both in selected directory and as well as sub directories of the specified directory.Engine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories. You can specify which directory to start looking in, which files to search through, and what pattern to look for in the files. The various fields expect regular expressions, like Global Regular Expression, ‘Engine’ has not only the graphical interface, but also a command-line interface. This is useful for quick searches through, say, a development tree. Engine requires the Java 2 Platform, Standard Edition version 1. 4 or higher. SOLUTION OF THESE PROBLEMSRegular expressions figure into all kinds of text-manipulation tasks. Searching and search-and-replace are among the more common uses, but regular expressions can also be used to test for certain conditions in a text file or data stream. You might use regular expressions, for example, as t he basis for a short program that separates incoming mail from incoming spam. In this case, the program might use a regular expression to determine whether the name of a known spammer appeared in the â€Å"From:† line of the email. Email filtering programs, in fact, very often use regular expressions for exactly this type of operation. SCOPE OF THE PROJECTEngine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories. The main aim of this project is to develop a java based recursive file finder. Engine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories LIMITATIONS Regular expressions tend to be easier to write than they are to read. This is less of a problem if you are the only one who ever needs to maintain the program (or sed routine, or shell script, or what have you), but if several people need to watch over it, the syntax can turn into more of a hindrance th an an aid.Ordinary macros (in particular, editable macros such as those generated by the major word processors and editors) tend not to be as fast, as flexible, as portable, as concise, or as fault-tolerant as regular expressions, but they have the advantage of being much more readable; even people with no programming background whatsoever can usually make enough sense of a macro script to change it if the need arises. For some jobs, such readability will outweigh all other concerns.As with all things in computing, it's largely a question of fitting the tool to the job. HARDWARE & SOFTWARE SPECIFICATIONS Environment: Java Runtime Environment version 1. 4 or better installed. Operating System: Any O. S. compatable with JVM Hard disk:10 GB Processor:PIII or higher ORGANIZATION PROFILE EMINENT SOFTWARE SOLUTIONS EMINENT TECHNOLOGIES (ET) is an IT Solution Provider for a dynamic environment where business and technology strategies converge.Our approach focuses on new ways of business co mbining IT innovation and adoption while also leveraging an organization's current IT assets. We work with large global corporations and new generation technology companies – to build new products or services and to implement prudent business and technology strategies in today's environment. EMINENT's range of expertise includes: Software Development Services Engineering Services Systems Integration Customer Relationship Management Supply Chain Management Product Development Electronic CommerceConsulting IT Outsourcing We apply technology with innovation and responsibility to achieve two broad objectives: Effectively address the business issues our customers face today Generate new opportunities that will help them stay ahead in the future This approach rests on: A strategy where we Architect, Integrate and Manage technology services and solutions — we call it AIM for success. A robust offshore development methodology and reduced demand on customer resources A focus on the use of reusable frameworks to provide cost and time benefitsWe combine the best people, processes and technology to achieve excellent results consistently. We offer customers the advantages of: Speed: We understand the importance of timing, of getting there before the competition. A rich portfolio of reusable, modular frameworks helps jump start projects. Tried and tested methodology ensures that we follow a predictable, low-risk path to achieve results. Our track record is testimony to complex projects delivered within and even before schedule. Expertise: Our teams combine cutting edge technology skills with rich domain expertise.What's equally important — we share a strong customer orientation that means we actually start by listening to the customer. We're focused on coming up with solutions that serve customer requirements today and anticipate future needs. A Full Service Portfolio: We offer customers the advantage of being able to Architect, Integrate and Manage tec hnology services. This means that they can rely on one, fully accountable source instead of trying to integrate disparate multi-vendor solutions. Services: GSS is providing its services to Sain medicaments Pvt.Ltd, Grace drugs and pharmaceuticals Private Limited Alka Drugs and Pharmaceuticals Pvt Ltd to name just a few with out rich experience and expertise in Information Technology we are in the best position to provide software solutions to distinct business requirements. PROJECT ANALYSIS STUDY OF THE SYSTEM This application can be mainly divided into two modules:- †¢ User Interface †¢ File Manipulation and filtering INPUT AND OUTPUT: User has to input the File Name or File Contents and he has to select the Drive or Directory in which searching has to be done.Application will search for the files matching with given criteria and shows the output in the text area of the application. PROCESS MODEL USED WITH JUSTIFICTION The model used here is a SPIRAL MODEL. This Model dem ands a direct consideration of technical risk at all stages of the project and if properly applied it reduces risk before they become problematic, hence it becomes easier to handle a project when using this kind of model where in the end user can evaluate the program at the end of each stage and suggest modification if required.PROJECT DESIGN DATA FLOW DIAGRAM 0th Level 1st Level 2nd Level 2nd Level 3rd Level UML DIAGRAMS USE CASE DIAGRAM [pic] CLASS DIAGRAM [pic] ACTIVITY DIAGRAM [pic] SEQUENCE DIAGRAM [pic] IMPLEMENTATION PHASE MODULES: 1. COMPONENT THIS IS THE FRONT END CONSOLE OF THE USER TO INTERACT WITH SEARCH ANALYZER. 2. TOOLBAR COORDINATIOR THIS MODULE HAS THE EMBEDED TOOLS WHICH ARE TO IMPLEMENT SEARCH. 3. MAP FINDER THIS MODULE IS MAPS THE SEARCH CORRESPONDING TO THE USERS QUERY. 4. DYNAMIC STATUS FINDERTHIS IS THE DYNAMIC MODULE WHICH GIVES THE STATUS OF THE SEARCH . 5. GREP GENERATOR GREP GENERATOR IS THE MAJOR MODULE ON WHICH THE SEARCH IS DONE BASED ON REGULAR EXPRESS IONS . OUTPUT SCREENS Engine view [pic] Browse [pic] Search [pic] Help [pic] Error [pic] PROJECT CODING CODE EXPLANATION Regular expressions simplify pattern-matching code Discover the elegance of regular expressions in text-processing scenarios that involve pattern matching Text processing often involves matching text against a pattern.Although Java's character and assorted string classes offer low-level pattern-matching support, that support commonly leads to complex code. To help you write simpler pattern-matching code, Java provides regular expressions with java. util. regex package. Text processing frequently requires code to match text against patterns. That capability makes possible text searches, email header validation, custom text creation from generic text (e. g. , â€Å"Dear Mr. Chakradhar† instead of â€Å"Dear Customer†), and so on. Java supports pattern matching via its character and assorted string classes.Because that low-level support commonly leads t o complex pattern-matching code, Java also offers regular expressions to help you write simpler code. After introducing regular expression terminology, the java. util. regex package's classes, and a program that demonstrates regular expression constructs, I explore many of the regular expression constructs that the Pattern class supports. I also examine the methods comprising Pattern and other java. util. regex classes. A practical application of regular expressions concludes my discussion.Regular expressions' long history begins in the theoretical computer science fields of automata theory and formal language theory. That history continues to Unix and other operating systems, where regular expressions are often used in Unix and Unix-like utilities: examples include awk (a programming language that enables sophisticated text analysis and manipulation-named after its creators, Aho, Weinberger, and Kernighan), emacs (a developer's editor), and grep (a program that matches regular expr essions in one or more text files and stands for global regular expression print).Regular expressions trace back to the work of an American mathematician by the name of Stephen Kleene (one of the most influential figures in the development of theoretical computer science) who developed regular expressions as a notation for describing what he called â€Å"the algebra of regular sets. † His work eventually found its way into some early efforts with computational search algorithms, and from there to some of the earliest text-manipulation tools on the Unix platform (including ed and grep). In the context of computer searches, the â€Å"*† is formally known as a â€Å"Kleene star. â€Å"A regular expression, also known as a regex or regexp, is a string whose pattern (template) describes a set of strings. The pattern determines what strings belong to the set, and consists of literal characters and meta characters, characters that have special meaning instead of a literal m eaning. The process of searching text to identify matches—strings that match a regex's pattern—is pattern matching. Java's java. util. regex package supports pattern matching via its Pattern, Matcher, and PatternSyntaxException classes: 1. Pattern objects, also known as patterns, are compiled regexes 2.Matcher objects, or matchers, are engines that interpret patterns to locate matches in character sequences, objects whose classes implement the java. lang. CharSequence interface and serve as text sources 3. PatternSyntaxException objects describe illegal regex patterns Code for mainwindow package jog. engine; import java. awt. *; import java. awt. event. *; import java. io. *; import java. net. URL; import java. util. prefs. *; import java. util. regex. *; import javax. swing. *; import javax. swing. filechooser. FileFilter; import jog. engine. *; public class MainWindow extends JFrame implements ActionListener, FileSearchListener { rotected Preferences preferences; pro tected JTextField lookInField; protected JTextField filePatternField; protected JTextField searchForField; protected JTextField excludeField; protected JCheckBox includeSubCheckBox; protected JList resultList; protected RunSearch runner; protected JButton browseButton; protected JButton helpButton; protected JButton startButton; protected JButton stopButton; protected JButton closeButton; protected JLabel status; protected JPanel cardPanel; protected CardLayout cardLayout; private boolean stopFlag; public MainWindow() { super(Bundle. getString(â€Å"AppTitle†)); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent event) { handleClose(); } }); preferences = Preferences. userRoot(). node(â€Å"com/bluemarsh/jrgrep†); Container pane = getContentPane(); GridBagLayout gb = new GridBagLayout(); pane. setLayout(gb); GridBagConstraints gc = new GridBagConstraints(); gc. insets = new Insets(3, 3, 3, 3); JLabel label = new JLabel(Bundle. getString(â€Å" lookInLabel†)); gc. anchor = GridBagConstraints. EAST; gb. setConstraints(label, gc); pane. add(label); String s = preferences. get(â€Å"lookIn†, â€Å"†); lookInField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints.HORIZONTAL; gc. weightx = 1. 0; gb. setConstraints(lookInField, gc); pane. add(lookInField); browseButton = new JButton(Bundle. getString(â€Å"browseLabel†)); browseButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. gridwidth = GridBagConstraints. REMAINDER; gc. fill = GridBagConstraints. NONE; gc. weightx = 0. 0; gb. setConstraints(browseButton, gc); pane. add(browseButton); label = new JLabel(Bundle. getString(â€Å"filePatternLabel†)); gc. anchor = GridBagConstraints. EAST; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"filter†, â€Å"†); ilePatternField = new JTextField(s, 20); gc. anchor = GridBagC onstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(filePatternField, gc); pane. add(filePatternField); Component glue = Box. createGlue(); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. gridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. setConstraints(glue, gc); pane. add(glue); label = new JLabel(Bundle. getString(â€Å"searchForLabel†)); gc. anchor = GridBagConstraints. EAST; gc. fill = GridBagConstraints.NONE; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"searchFor†, â€Å"†); searchForField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(searchForField, gc); pane. add(searchForField); helpButton = new JButton(Bundle. getStrin g(â€Å"helpLabel†)); helpButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. gridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. etConstraints(helpButton, gc); pane. add(helpButton); label = new JLabel(Bundle. getString(â€Å"excludeLabel†)); gc. anchor = GridBagConstraints. EAST; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"exclude†, â€Å"†); excludeField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(excludeField, gc); pane. add(excludeField); glue = Box. createGlue(); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. ridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. setConstraints(glue, gc); pane. add(glue); includeSubCheckBox = new JC heckBox( Bundle. getString(â€Å"includeSubDirLabel†), true); includeSubCheckBox. setSelected(preferences. getBoolean( â€Å"recurse†, true)); gc. anchor = GridBagConstraints. WEST; gb. setConstraints(includeSubCheckBox, gc); pane. add(includeSubCheckBox); startButton = new JButton( Bundle. getString(â€Å"startSearchLabel†)); startButton. addActionListener(this); gc. gridwidth = 1; gb. setConstraints(startButton, gc); pane. add(startButton); status=new JLabel(â€Å"†); Color c=new Color(240,100,100); tatus. setForeground(c); gc. gridwidth = 1; gb. setConstraints(status, gc); pane. add(status); stopButton = new JButton(Bundle. getString(â€Å"stopLabel†)); stopButton. setEnabled(false); stopButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. gridwidth = GridBagConstraints. RELATIVE; gb. setConstraints(stopButton, gc); pane. add(stopButton); closeButton = new JButton(Bundle. getString(â€Å"closeLabel†)); closeButton . addActionListener(this); gc. gridwidth = GridBagConstraints. REMAINDER; gb. setConstraints(closeButton, gc); pane. add(closeButton); resultList = new JList(new ResultsListModel());JScrollPane scroller = new JScrollPane(resultList); cardPanel = new JPanel(new CardLayout()); cardLayout = (CardLayout) cardPanel. getLayout(); cardPanel. add(scroller, â€Å"list†); gc. gridwidth = GridBagConstraints. REMAINDER; gc. gridheight = GridBagConstraints. REMAINDER; gc. fill = GridBagConstraints. BOTH; gc. weightx = 1. 0; gc. weighty = 1. 0; gb. setConstraints(cardPanel, gc); pane. add(cardPanel); int width = preferences. getInt(â€Å"windowWidth†, 0); int height = preferences. getInt(â€Å"windowHeight†, 0); if (width == 0 && height == 0) { pack(); } else { setSize(width, height); } int top = preferences. getInt(â€Å"windowTop†, 100); nt left = preferences. getInt(â€Å"windowLeft†, 100); setLocation(left, top); stopFlag=false; } public void actionPerformed (ActionEvent event) { JButton button = (JButton) event. getSource(); //System. out. println(â€Å"action â€Å"+button); if (button == closeButton) { handleClose(); } else if (button == browseButton) { handleBrowse(); } else if (button == startButton) { status. setText(â€Å"Search Started†); //System. out. println(â€Å"Search started†); startSearch(); } else if (button == helpButton) { displayHelp(); } else if (button == stopButton) { //System. out. println(â€Å"Search stopped†); stopButton. setEnabled(false); runner. stop(); stopFlag=true; /int count=((ListModel)resultList. getModel()). getSize(); //status. setText(â€Å"Search Stopped â€Å"+count+† Files Found†); } } protected void displayHelp() { if (cardPanel. getComponentCount() < 2) { URL helpUrl = Bundle. getResource(â€Å"helpFile†); try { JEditorPane editor = new JEditorPane(helpUrl); editor. setEditable(false); JScrollPane scroller = new JScrollPane(editor); cardPanel. add(sc roller, â€Å"help†); } catch (IOException ioe) { searchFailed(ioe); return; } } cardLayout. show(cardPanel, â€Å"help†); } public void fileFound(FileFoundEvent event) { ResultsListModel model = (ResultsListModel) resultList. etModel(); model. addElement(event. getFile()); } protected void handleBrowse() { String dirStr = lookInField. getText(); JFileChooser fc; if (dirStr. equals(â€Å"†)) { String lastdir = preferences. get(â€Å"lastdir†, null); if (lastdir == null || lastdir. length() == 0) { lastdir = System. getProperty(â€Å"user. dir†); } fc = new JFileChooser(lastdir); } else { fc = new JFileChooser(dirStr); } fc. setFileSelectionMode(JFileChooser. DIRECTORIES_ONLY); if (fc. showOpenDialog(this) ! = JFileChooser. CANCEL_OPTION) { File dir = fc. getSelectedFile(); String path = dir. getPath(); lookInField. setText(path); references. put(â€Å"lastdir†, path); } } protected void handleClose() { preferences. putInt(â€Å"windowTopâ⠂¬ , getY()); preferences. putInt(â€Å"windowLeft†, getX()); preferences. putInt(â€Å"windowWidth†, getWidth()); preferences. putInt(â€Å"windowHeight†, getHeight()); preferences. put(â€Å"lookIn†, lookInField. getText()); preferences. put(â€Å"filter†, filePatternField. getText()); preferences. put(â€Å"searchFor†, searchForField. getText()); preferences. put(â€Å"exclude†, excludeField. getText()); preferences. putBoolean(â€Å"recurse†, includeSubCheckBox. isSelected()); System. exit(0); } public void searchComplete() { stopButton. etEnabled(false); //status. setText(â€Å"Search completed†); int count=((ListModel)resultList. getModel()). getSize(); if(count==0){ status. setText(â€Å"Search Completed No Files Found†); } if(stopFlag){ status. setText(â€Å"Search Stopped â€Å"+count +† Files Found†); stopFlag=false; }else{ status. setText(â€Å"Search Completed â€Å"+count +† Fil es Found†); } } public void searchFailed(Throwable t) { Object[] messages = {Bundle. getString(â€Å"exceptionOccurred†),t. getMessage()}; JOptionPane. showMessageDialog(this, messages, Bundle. getString(â€Å"errorTitle†), JOptionPane. ERROR_MESSAGE); } protected void startSearch() { cardLayout. how(cardPanel, â€Å"list†); ResultsListModel model = (ResultsListModel) resultList. getModel(); model. clear(); String dirStr = lookInField. getText(); if (dirStr == null || dirStr. length() == 0) { dirStr = â€Å". â€Å"; } File dir = new File(dirStr); if (! dir. exists()) { JOptionPane. showMessageDialog(this, Bundle. getString(â€Å"pathDoesNotExist†), Bundle. getString(â€Å"errorTitle†), JOptionPane. ERROR_MESSAGE); return; } String target = searchForField. getText(); String filter = filePatternField. getText(); String exclude = excludeField. getText(); try { Pattern. compile(target); Pattern. compile(filter); Pattern. ompile(exclude); } cat ch (PatternSyntaxException pse) { Object[] messages = {Bundle. getString(â€Å"invalidRegexPattern†), pse. getMessage()}; JOptionPane. showMessageDialog(this, messages, Bundle. getString(â€Å"errorTitle†),JOptionPane. ERROR_MESSAGE); return; } if (runner == null) { runner = new RunSearch(this); } runner. search(dir, target, filter, includeSubCheckBox. isSelected(), exclude); Thread th = new Thread(runner); th. start(); stopButton. setEnabled(true); } } Code for bundle package jog. engine; import java. net. URL; import java. util. MissingResourceException; import java. til. ResourceBundle; public class Bundle { private static ResourceBundle resourceBundle; static { resourceBundle = ResourceBundle. getBundle(Bundle. class. getName()); } public static ResourceBundle getBundle() { return resourceBundle; } public static URL getResource(String key) { String name = getString(key); return name == null ? null : Bundle. class. getResource(name); } public static String getString (String key) { try { return resourceBundle. getString(key); } catch (MissingResourceException mre) { return null; } } } Code for runsearch package jog. engine; import java. io. File; import jog. engine. *; mport java. lang. *; class RunSearch implements Runnable { protected File dir; protected String lookFor; protected String filter; protected boolean subDirs; protected String exclude; protected FileSearchListener listener; protected Searcher searcher; public RunSearch(FileSearchListener listener) { this. listener = listener; } public void run() { if (searcher == null) { searcher = new Searcher(); if (listener ! = null) { searcher. addSearchListener(listener); } } searcher. search(dir, lookFor, filter, subDirs, exclude); } public void search(File dir, String lookFor, String filter, boolean subDirs, String exclude) this. dir = dir; this. lookFor = lookFor; this. filter = filter; this. subDirs = subDirs; this. exclude = exclude; } public void stop() { //System. out. println(â€Å"Sea rcher is one:†+ isAlive()); System. out. println(â€Å"Searcher†); if (searcher ! = null) { searcher. stopSearching(); searcher=null; System. out. println(â€Å"Searcher one†); } //System. out. println(â€Å"Searcher is :†+ isAlive()); //System. out. println(â€Å"Searcher one†); } } Code for searcher package jog. engine; import java. io. *; import java. nio. *; import java. nio. channels. *; import java. nio. charset. *; import java. util. *; import java. til. regex. *; import javax. swing. event. EventListenerList; import jog. engine. *; class Searcher { protected static Pattern linePattern; protected static Charset charset; protected static CharsetDecoder decoder; protected EventListenerList searchListeners; protected volatile boolean stopSearch; protected Pattern targetPattern; protected Matcher targetMatcher; protected Pattern filterPattern; protected Matcher filterMatcher; protected Pattern excludePattern; protected Matcher excludeMatcher; sta tic { try { linePattern = Pattern. compile(â€Å". * ? â€Å"); } catch (PatternSyntaxException pse) { System. out. rintln(â€Å"Ye flipping gods! â€Å"); } charset = Charset. forName(â€Å"ISO-8859-1†); decoder = charset. newDecoder(); } public Searcher() { searchListeners = new EventListenerList(); } public void addSearchListener(FileSearchListener listener) { searchListeners. add(FileSearchListener. class, listener); } protected void fireDone() { if (searchListeners == null) { return; } Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. length – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchListener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. earchComplete(); } } } protected void fireError(Throwable t) { if (searchListeners == null) { return; } Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. length – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchLi stener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. searchFailed(t); } } } protected void fireFound(String match) { if (searchListeners == null) { return; } FileFoundEvent event = new FileFoundEvent(this, match); Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. ength – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchListener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. fileFound(event); } } event = null; } public void removeSearchListener(FileSearchListener listener) { searchListeners. remove(FileSearchListener. class, listener); } public void search(File startIn, String target, String filter, boolean recurse, String exclude) { stopSearch = false; try { targetPattern = Pattern. compile(target); filterPattern = Pattern. compile(filter); if (exclude ! = null && exclude. length() > 0) { excludePattern = Pattern. ompile(exclude); } searchLow(startIn, recurse); } catch (IOExcepti on ioe) { fireError(ioe); } catch (PatternSyntaxException pse) { fireError(pse); } targetPattern = null; targetMatcher = null; filterPattern = null; filterMatcher = null; excludePattern = null; excludeMatcher = null; fireDone(); } protected void searchLow(File startIn, boolean recurse) throws IOException { String[] files = startIn. list(); if (files == null) { return; } for (int ii = 0; ii < files. length; ii++) { if (stopSearch) { break; } File file = new File(startIn, files[ii]); if (file. isFile() && file. canRead()) { String filename = file. etCanonicalPath(); if (filterMatcher == null) { filterMatcher = filterPattern. matcher(filename); } else { filterMatcher. reset(filename); } if (! filterMatcher. find()) { continue; } FileInputStream fis = new FileInputStream(file); FileChannel fc = fis. getChannel(); MappedByteBuffer bb = fc. map(FileChannel. MapMode. READ_ONLY, 0, fc. size()); CharBuffer cb = decoder. decode(bb); boolean matchFound = false; if ((targetPattern. flags() & Pa ttern. DOTALL) ! = 0) { if (targetMatcher == null) { targetMatcher = targetPattern. matcher(cb); } else { argetMatcher. reset(cb); } if (targetMatcher. find()) { matchFound = true; } } else { Matcher lm = linePattern. matcher(cb); while (lm. find()) { CharSequence cs = lm. group(); if (targetMatcher == null) { targetMatcher = targetPattern. matcher(cs); } else { targetMatcher. reset(cs); } if (targetMatcher. find()) { matchFound = true; } if (lm. end() == cb. limit()) { break; } } } if (matchFound) { fireFound(filename); } } else if (recurse && file. isDirectory()) { String dirname = file. getName(); if (excludePattern ! = null) { if (excludeMatcher == null) { excludeMatcher = excludePattern. atcher(dirname); } else { excludeMatcher. reset(dirname); } if (! excludeMatcher. find()) { searchLow(file, recurse); } } else { searchLow(file, recurse); } } } } public void stopSearching() { stopSearch = true; } } Code for filesearch listener package jog. engine; import java. util. EventListe ner; import jog. engine. FileFoundEvent; interface FileSearchListener extends EventListener { public void fileFound(FileFoundEvent event); public void searchComplete(); public void searchFailed(Throwable t); } Code for tty package jog. engine; import java. io. *; import java. util. regex. *; mport jog. engine. *; public class tty implements FileSearchListener { protected static int argIndex; protected static String excludeStr = â€Å"†; protected static String nameStr = â€Å"†; protected static void displayHelp() { String str = Bundle. getString(â€Å"ttyHelp1†); int i = 1; while (str ! = null) { System. out. println(str); i++; str = Bundle. getString(â€Å"ttyHelp† + i); } } public void fileFound(FileFoundEvent event) { System. out. println(event. getFile()); } protected static boolean processArgs(String[] args) { while (argIndex < args. length) { String arg = args[argIndex]; if (arg. equals(â€Å"-exclude†)) { rgIndex++; excludeStr = args[argInd ex]; } else if (arg. equals(â€Å"-h†) || arg. equals(â€Å"-help†) || arg. equals(â€Å"–help†)) { displayHelp(); return false; } else if (arg. equals(â€Å"-name†)) { argIndex++; nameStr = args[argIndex]; } else { break; } argIndex++; } return true; } public void searchComplete() {} public void searchFailed(Throwable t) { System. err. println(Bundle. getString(â€Å"exceptionOccurred†)); System. err. println(t. getMessage()); } public static void main(String[] args) { try { if (! processArgs(args)) { return; } } catch (ArrayIndexOutOfBoundsException aioobe) { System. err. println(Bundle. etString(â€Å"ttyMissingArguments†)); return; } if (argIndex == args. length) { System. err. println(Bundle. getString(â€Å"ttyMissingRequired†)); return; } String target = args[argIndex]; argIndex++; String dirStr = null; if (argIndex == args. length) { dirStr = â€Å". â€Å"; } else { dirStr = args[argIndex]; } File dir = new File(dirS tr); if (! dir. exists()) { System. err. println(Bundle. getString(â€Å"pathDoesNotExist†)); return; } try { Pattern. compile(target); Pattern. compile(nameStr); } catch (PatternSyntaxException pse) { System. err. println(Bundle. getString(â€Å"invalidRegexPattern†)); System. rr. println(pse. getMessage()); return; } Searcher searcher = new Searcher(); tty instance = new tty(); searcher. addSearchListener(instance); searcher. search(dir, target, nameStr, true, excludeStr); searcher. removeSearchListener(instance); } } Code for filefoundevent package jog. engine; import java. util. EventObject; class FileFoundEvent extends EventObject { protected String file; public FileFoundEvent(Object source, String file) { super(source); this. file = file; } public String getFile() { return file; } } Code for result list model package jog. engine; import java. util. Vector; import javax. wing. AbstractListModel; import jog. engine. *; class ResultsListModel extends AbstractListMod el { protected Vector listData; public ResultsListModel() { listData = new Vector(); } public void addElement(Object o) { listData. add(o); fireIntervalAdded(this, listData. size(), listData. size()); } public void clear() { int size = listData. size(); listData. clear(); fireIntervalRemoved(this, 0, size); } public Object getElementAt(int i) { try { return listData. elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { return null; } } public int getSize() { return listData. size(); } } Code for main package jog. ngine; import jog. engine. *; public class Main { public static void main(String[] args) { new MainWindow(). show(); // new jog. searchdesk. MainWindow. show(); } } For a tool with full regex support, metacharacters like â€Å"*† and â€Å"? † (or â€Å"wildcard operators,† as they are sometimes called) are only the tip of the iceberg. Using a good regex engine and a well-crafted regular expression, one can easily search through a text file (or a hundred text files) searching for words that have the suffix â€Å". html† (but only if the word begins with a capital letter and occurs at the beginning of the line), replace the . tml suffix with a . sgml suffix, and then change all the lower case characters to upper case. With the right tools, this series of regular expressions would do just that: s/(^[A_Z]{1})([a-z]+). sgml/12. html/g tr/a-z/A-Z/ As you might guess from this example, concision is everything when it comes to crafting regular expressions, and while this syntax won't win any beauty prizes, it follows a logical and fairly standardized format which you can learn to rea+*d and write easily with just a little bit of practice. In a regular expression, everything is a generalized pattern.If I type the word â€Å"serendipitous† into my editor, I've created one instance of the word â€Å"serendipitous. † If, however, I indicate to my tool (or compiler, or editor, or what have you) that I'm now typing a regular expression, I am in effect creating a template that matches all instances of the characters â€Å"s,† â€Å"e,† â€Å"r,† â€Å"e,† â€Å"n,† â€Å"d,† â€Å"i,† â€Å"p,† â€Å"i,† â€Å"t,† â€Å"o,† â€Å"u,† and â€Å"s† all in a row. The standard way to find â€Å"serendipitous† (the word) in a file is to use â€Å"serendipitous† (the regular expression) with a tool like egrep (or extended grep): $ egrep â€Å"serendipitous† foobar ;hitsThis line, as you might guess, asks egrep to find instances of the pattern â€Å"serendipitous† in the file â€Å"foobar† and write the results to a file called â€Å"hits†. In the preceding examples, we have been using regular expressions that adhere to the first rule of regular expressions: namely, that all alphanumeric characters match themselves. There are other characters, however, that match in a mor e generalized fashion. These are usually referred to as the meta characters. Some meta characters match single characters. This includes the following symbols: . Matches any one character †¦]Matches any character listed between the brackets [^†¦]Matches any character except those listed between the brackets Suppose we have a number of filenames listed out in a file called â€Å"Important. files. † We want to â€Å"grep out† those filenames which follow the pattern â€Å"blurfle1†, â€Å"blurfle2†, â€Å"blurfle3,† and so on, but exclude files of the form â€Å"1blurfle†, â€Å"2blurfle†, â€Å"3blurfle† The following regex would do the trick: $ egrep â€Å"blurfle. † Important. files ;blurfles The important thing to realize here is that this line will not match merely the string â€Å"blurfle. (that is, â€Å"blurfle† followed by a period). In a regular expression, the dot is a reserved symbol (we'll ge t to matching periods a little further on). This is fine if we aren't particular about the character we match (whether it's a â€Å"1,† a â€Å"2,† or even a letter, a space, or an underscore). Narrowing the field of choices for a single character match, however, requires that we use a character class. Character classes match any character listed within that class and are separated off using square brackets.So, for example, if we wanted to match on â€Å"blurfle† but only when it is followed immediately by a number (including â€Å"blurfle1† but not â€Å"blurflez†) we would use something like this: $ egrep â€Å"blurfle[0123456789]† Important. files >blurfles The syntax here is exactly as it seems: â€Å"Find ‘blurfle' followed by a zero, a one, a two, a three, a four, a five, a six, a seven, an eight, or a nine. † Such classes are usually abbreviated using the range operator (â€Å"-â€Å"): $ egrep â€Å"blurfle[0-9]† Important. files >blurfles The following regex would find â€Å"blurfle† followed by any alphanumeric character (upper or lower case). egrep â€Å"blurfle[0-9A-Za-z]† Important. files >blurfles (Notice that we didn't write blurfle[0-9 A-Z a-z] for that last one. The spaces might make it easier to read, but we'd be matching on anything between zero and nine, anything between a and z, anything between A and Z, or a space. ) A carat at the beginning of the character class negates that class. In other words, if you wanted to find all instances of blurfle except those which end in a number, you'd use the following: $ egrep â€Å"blurfle[^0-9]† Important. files >blurfles Many regex implementations have â€Å"macros† for various character classes.In Perl, for example, d matches any digit ([0-9]) and w matches any â€Å"word character† ([a-zA-Z0-9_]). Grep uses a slightly different notation for the same thing: [:digit:] for digits and [:alnum:] for alpha numeric characters. The man page (or other documentation) for the particular tool should list all the regex macros available for that tool. Quantifiers The regular expression syntax also provides metacharacters which specify the number of times a particular character should match. ?Matches any character zero or one times *Matches the preceding element zero or more times +Matches the preceding element one or more times num}Matches the preceding element num times {min, max}Matches the preceding element at least min times, but not more than max times These metacharacters allow you to match on a single-character pattern, but then continue to match on it until the pattern changes. In the last example, we were trying to search for patterns that contain â€Å"blurfle† followed by a number between zero and nine. The regex we came up with would match on blurfle1, blurfle2, blurfle3, etc. If, however, you had a programmer who mistakenly thought that â€Å"blurfle† was supposed t o be spelled â€Å"blurffle,† our regex wouldn't be able to catch it.We could fix it, though, with a quantifier. $ egrep â€Å"blur[f]+le[0-9]† Important. files >blurfles Here we have â€Å"Find ‘b', ‘l', ‘u,' ‘r' (in a row) followed by one or more instances of an ‘f' followed by ‘l' and ‘e' and then any single digit character between zero and nine. † There's always more than one way to do it with regular expressions, and in fact, if we use single-character metacharacters and quantifiers in conjunction with one another, we can search for almost all the variant spellings of â€Å"blurfle† (â€Å"bllurfle,† â€Å"bllurrfle†, bbluuuuurrrfffllle†, and so on).One way, for example, might employ the ubiquitous (and exceedingly powerful) . * combination: $ egrep â€Å"b. *e† Important. files ;blurfles If we work this out, we come out with something like: â€Å"find a ‘b' followed by any c haracter any number of times (including zero times) followed by an ‘e'. † It's tempting to use â€Å". *† with abandon. However, bear in mind that the preceding example would match on words like â€Å"blue† and â€Å"baritone† as well as â€Å"blurfle. † Suppose the filenames in blurfle are numbered up to 12324, but we only care about the first 999: $ egrep â€Å"blurfle[0-9]{3}† Important. files >bluflesThis regex tells egrep to match any number between zero and nine exactly three times in a row. Similarly, â€Å"blurfle[0-9]{3,5}† matches any number between zero and nine at lest three times but not more than five times in a row. Anchors Often, you need to specify the position at which a particular pattern occurs. This is often referred to as â€Å"anchoring† the pattern: ^Matches at the start of the line $Matches at the end of the line Matches at the end of a word Matches at the beginning or the end of a word BMatches a ny charater not at the beginning or end of a word ^† and â€Å"$† are some of the most useful metacharacters in the regex arsenal–particularly when you need to run a search-and-replace on a list of strings. Suppose, for example, that we want to take the â€Å"blurfle† files listed in Important. files, list them out separately, run a program called â€Å"fragellate† on each one, and then append each successive output to a file called â€Å"fraggled_files. † We could write a full-blown shell script (or Perl script) that would do this, but often, the job is faster and easier if we build a very simple shell script with a series of regular expressions.We'd begin by greping the files we want to operate on and writing the output to a file. $ egrep â€Å"blurfle[0-9]† Important. file ;script. sh This would give us a list of files in script. sh that looked something like this: blurfle1 blurfle2 blurfle3 blurfle4 . . . Now we use sed (or the â⠂¬Å"/%s† operator in vi, or the â€Å"query-replace-regexp† command in emacs) to put â€Å"fragellate† in front of each filename and â€Å">>fraggled_files† after each filename. This requires two separate search-and-replace operations (though not necessarily, as I'll explain when we get to backreferences).With sed, you have the ability to put both substitution lines into a file, and then use that file to iterate through another making each substitution in turn. In other words, we create a file called â€Å"fraggle. sed† which contains the following lines: s/^/fraggelate / s/$/ >>fraggled_files/ Then run the following â€Å"sed routine† on script. sh like so: $ sed -f fraggle. sed script. sh >script2. sh Our script would then look like this: fraggelate blurfle1 >>fraggled_files fraggelate blurfle2 >>fraggled_files fraggelate blurfle3 >>fraggled_files raggelate blurfle4 >>fraggled_files . . Chmod it, run it, and you're done. Of course, this is a somewhat trivial example (â€Å"Why wouldn't you just run â€Å"fragglate blurfle* ;;fraggled_files† from the command line? â€Å"). Still, one can easily imagine instances where the criteria for the file name list is too complicated to express using [filename]* on the command line. In fact, you can probably see from this sed-routine example that we have the makings of an automatic shell-script generator or file filter. You may also have noticed something odd about that caret in our sed routine.Why doesn't it mean â€Å"except† as in our previous example? The answer has to do with the sometimes radical difference between what an operator means inside the range operator and what it means outside it. The rules change from tool to tool, but generally speaking, you should use metacharacters inside range operators with caution. Some tools don't allow them at all, and others change the meaning. To pick but one example, most tools would interpret [A-Za-z. ] as â€Å"Any character between A and Z, a and z or a period. † Most tools provide some way to anchor a match on a word boundary.In some versions of grep, for example, you are allowed to write: $ grep â€Å"fle>† Important. files ;blurfles This says: â€Å"Find the characters â€Å"f†, â€Å"l†, â€Å"e†, but only when they come at the end of a word. †  tells the regex engine to match any word boundary (whether it's at the beginning or the end) and B tells it to match any position that isn't a word boundary. This again can vary considerably from tool to tool. Some tools don't support word boundaries at all, and others support them using a slightly different syntax.The tools that do support word boundaries generally consider words to be bounded by spaces or punctuation, and consider numerals to be legitimate parts of words, but there are some variations on these rules that can effect the accuracy of your matches. The man page or other documentation should resolve the matter. Escape Characters By now, you're probably wondering how you go about searching for one of the special characters (asterisks, periods, slashes, and so on). The answer lies in the use of the escape character–for most tools, the backslash (â€Å"†).To reverse the meaning of a special character (in other words, to treat it as a normal character instead of as a metacharacter), we simply put a backslash before that character. So, we know that a regex like â€Å". *† finds any character any number of times. But suppose we're searching for ellipses of various lengths and we just want to find periods any number of times. Because the period is normally a special character, we'd need to escape it with a backslash: $ grep â€Å". *† Important. Files ;ellipses. files Unfortunately, this contribute to the legendary ugliness of regular expressions more than any other element of the syntax.Add a few escape characters, and a simple sed routine designed to replace a couple of URL's quickly degenerates into confusion: sed ‘s/http://etext. lib. virginia. edu//http://www. etext. virginia. edu/g To make matters worse, the list of what needs to be escaped differs from tool to tool. Some tools, for example, consider the â€Å"+† quantifier to have its normal meaning (as a ordinary plus sign) until it is escaped. If you're having trouble with a regex (a sed routine that won't parse or a grep pattern that won't match even though you're certain the pattern exists), try playing around with the escapes.Or better yet, read the man page. Alternation Alternation refers to the use of the â€Å"|† symbol to indicate logical OR. In a previous example, we used â€Å"blur[f]+le† to catch those instances of â€Å"blurfle† that were misspelled with two â€Å"f's†. Using alternation, we could have written: $ egrep â€Å"blurfle|blurffle† Important. files ;blurfles This means simply â€Å"Find either blur fle OR blurffle. † The power of this becomes more evident when we use parentheses to limit the scope of the alternative matches.Consider the following regex, which accounts for both the American and British spellings of the word â€Å"gray†: $ egrep â€Å"gr(a|e)y† Important. files ;hazy. shades Or perhaps a mail-filtering program that uses the following regex to single out past correspondence between you and the boss: /(^To:|^From:) (Seaman|Ramsay)/ This says, â€Å"Find a ‘To:' or a ‘From:' line followed by a space and then either the word ‘Seaman' or the word ‘Ramsay' This can make your regex's extremely flexible, but be careful! Parentheses are also meta characters which figure prominently in the use of . . . Back referencesPerhaps the most powerful element of the regular expression syntax, back references allows you to load the results of a matched pattern into a buffer and then reuse it later in the expression. In a previous example , we used two separate regular expressions to put something before and after a filename in a list of files. I mentioned at that point that it wasn't entirely necessary that we use two lines. This is because back references allow us to get it down to one line. Here's how: s/(blurfle[0-9]+)/fraggelate 1 >>fraggled_files/ The key elements in this example are the parentheses and the â€Å"1†.Earlier we noted that parentheses can be used to limit the scope of a match. They can also be used to save a particular pattern into a temporary buffer. In this example, everything in the â€Å"search† half of the sed routine (the â€Å"blurfle† part) is saved into a buffer. In the â€Å"replace† half we recall the contents of that buffer back into the string by referring to its buffer number. In this case, buffer â€Å"1†. So, this sed routine will do precisely what the earlier one did: find all the instances of blurfle followed by a number between zero and nine a nd replace it with â€Å"fragellate blurfle[some number] ;;fraggled files†.Backreferences allow for something that very few ordinary search engines can manage; namely, strings of data that change slightly from instance to instance. Page numbering schemes provide a perfect example of this. Suppose we had a document that numbered each page with the notation . The number and the chapter name change from page to page, but the rest of the string stays the same. We can easily write a regular expression that matches on this string, but what if we wanted to match on it and then replace everything but the number and the chapter name? //Page 1, Chapter 2/ Buffer number one (â€Å"1†) holds the first matched sequence, ([0-9]+); buffer number two (â€Å"2†) holds the second, ([A-Za-z]+). Tools vary in the number of backreference they can hold. The more common tools (like sed and grep) hold nine, but Python can hold up to ninety-nine. Perl is limited only by the amount of ph ysical memory (which, for all practical purposes, means you can have as many as you want). Perl also lets you assign the buffer number to an ordinary scalar variable ($1, $2, etc. ) so you can use it later on in the code block. a.OBJECT ORIENTED PROGRAMMING AND JAVA Object-oriented Programming was developed because of limitations found in earlier approaches of programming. To appreciate what OOP does, we need to understand what these limitations are and how they arose from traditional programming. PROCEDURAL LANGUAGES Pascal, C, Basic, FORTRAN, and similar languages are procedural languages. That is, each statement in the language tells the computer to do something: Get some input, add these numbers, divide by 6, display the output. A program in a procedural language is a list of instructions.For very small programs no other organizing principle (often called a paradigm) is needed. The programmer creates the list of instructions, and the computer carries them out. Division into Func tions When programs become larger, a single list of instructions becomes unwieldy. Few programmers can comprehend a program of more than a few hundred statements unless it is broken down into smaller units. For this reason the function was adopted as a way to make programs more comprehensible to their human creators. (The term functions is used in C++ and C.In other languages the same concept may be referred to as a subroutine, a subprogram, or a procedure. ) A program is divided into functions, and (ideally, at least) each function has a clearly defined purpose and a clearly defined interface to the other functions in the program. The idea of breaking a program into functions can be further extended by grouping a number of functions together into a larger entity called a module, but the principle is similar: grouping a number of components that carry out specific tasks.Dividing a program into functions and modules is one of the cornerstones of structured programming, the somewhat l oosely defined discipline that has influenced programming organization for more than a decade. Problems with Structured Programming As programs grow ever larger and more complex, even the structured programming approach begins to show signs of strain. You may have heard about, or been involved in, horror stories of program development. The project is too complex, the schedule slips, more programmers are added, complexity increases, costs skyrocket, the schedule slips further, and disaster ensues.Analyzing the reasons for these failures reveals that there are weaknesses in the procedural paradigm itself. No matter how well the structured programming approach is implemented, large programs become excessively complex. What are the reasons for this failure of procedural languages? One of the most crucial is the role played by data. Data Undervalued In a procedural language, the emphasis is on doing things–read the keyboard, invert the vector, check for errors, and so on. The subd ivision of a program into functions continues this emphasis. Functions do things just as single program statements do.What they do may be more complex or abstract, but the emphasis is still on the action. What happens to the data in this paradigm? Data is, after all, the reason for a program's existence. The important part of an inventory program isn't a function that displays the data, or a function that checks for correct input; it's the inventory data itself. Yet data is given second-class status in the organization of procedural languages. For example, in an inventory program, the data that makes up the inventory is probably read from a disk file into memory, where it is treated as a global variable.By global we mean that the variables that constitute the data are declared outside of any function, so they are accessible to all functions. These functions perform various operations on the data. They read it, analyze it, update it, rearrange it, display it, write it back to the dis k, and so on. We should note that most languages, such as Pascal and C, also support local variables, which are hidden within a single function. But local variables are not useful for important data that must be accessed by many different functions. Now suppose a new programmer is hired to write a function to analyze this nventory data in a certain way. Unfamiliar with the subtleties of the program, the programmer creates a function that accidentally corrupts the. This is easy to do, because every function has complete access to the data. It's like leaving your personal papers in the lobby of your apartment building: Anyone can change or destroy them. In the same way, global data can be corrupted by functions that have no business changing it. Another problem is that, since many functions access the same data, the way the data is stored becomes critical.The arrangement of the data can't be changed without modifying all the functions that access it. If you add new data items, for exa mple, you'll need to modify all the functions that access the data so that they can also access these new items. It will be hard to find all such functions, and even harder to modify all of them correctly. It's similar to what happens when your local supermarket moves the bread from aisle 4 to aisle 12. Everyone who patronizes the supermarket must figure out where the bread has gone, and adjust their shopping habits accordingly.What is needed is a way to restrict access to the data, to hide it from all but a few critical functions. This will protect the data, simplify maintenance, and offer other benefits as well. Relationship to the Real World Procedural programs are often difficult to design. The problem is that their chief components–functions and data structures–don't model the real world very well. For example, suppose you are writing a program to create the elements of a graphics user interface: menus, windows, and so on. Quick now, what functions will you need? What data structures?The answers are not obvious, to say the least. It would be better if windows and menus corresponded more closely to actual program elements. New Data Types There are other problems with traditional languages. One is the difficulty of creating new data types. Computer languages typically have several built-in data types: integers, floating-point numbers, characters, and so on. What if you want to invent your own data type? Perhaps you want to work with complex numbers, or two dimensional coordinates, or dates—quantities the built-in data types don’t handle easily.Being able to create your own types is called extensibility; you can extend the capabilities of the language. Traditional languages are not usually extensible. Without unnatural convolutions, you can’t bundle together both X and Y coordinates into a single variable called Point, and then add and subtract values of this type. The result is that traditional programs are more complex to write and maintain. The object oriented approach The fundamental idea behind object-oriented languages is to combine into a single unit both data and the functions that operate on that data.Such a unit is called an object. An object’s functions, called member methods in Java, typically provide the only way to access its data. If you want to read the item and return the value to you, you call a member function in the object. It will read the item and return the value to you. You can’t access the data directly. The data is hidden, so it is safe from accidental modification. Data and its functions are said to be encapsulated into a single entity. Data encapsulation and data hiding are key terms in the description of object oriented languages.If you want to modify the data in an object, you know exactly what functions interact with it: the member functions in the object. No other functions can access the data. This simplifies writing, debugging, and maintaining the progra m. A Java program typically consists of a number of objects, which communicate with each other by calling one another’s members functions. We should mention that what are called member functions in C++ are called methods in Java. Also, data items are referred to as instance variables. Calling an object’s member function is referred to as sending a message to the object.