??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲第一狼人社区,98在线视频,成人一区二区视频http://www.aygfsteel.com/raymondchen625/category/6966.htmlJavaW记zh-cnFri, 02 Mar 2007 20:22:42 GMTFri, 02 Mar 2007 20:22:42 GMT60不同Ҏ遍历列表的时间效?/title><link>http://www.aygfsteel.com/raymondchen625/archive/2006/03/03/33423.html</link><dc:creator>Raymond的JavaW记</dc:creator><author>Raymond的JavaW记</author><pubDate>Fri, 03 Mar 2006 04:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/raymondchen625/archive/2006/03/03/33423.html</guid><wfw:comment>http://www.aygfsteel.com/raymondchen625/comments/33423.html</wfw:comment><comments>http://www.aygfsteel.com/raymondchen625/archive/2006/03/03/33423.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/raymondchen625/comments/commentRss/33423.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/raymondchen625/services/trackbacks/33423.html</trackback:ping><description><![CDATA[在Java高效~程里面看到变量一个ArrayList的时候,有两U方式:<BR>假设a是个ArrayList<BR><BR>1?for (int i=0;i<a.size();i++) {<BR>2?for (int i=0,n=a.size();i<n;i++) {<BR><BR>带着Ҏ疑我做了一下试验,的确是方?快一点的Q估计是a.size()Ҏ里面p了一点多余的旉。后来我惛_jdk 1.5开始还有一U遍历的for/eachҎQ我做了一下比较,l果有点惊讶?BR><BR>源程序如?BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080"> 1</SPAN><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.ArrayList;<BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_59_781_Open_Image onclick="this.style.display='none'; Codehighlighter1_59_781_Open_Text.style.display='none'; Codehighlighter1_59_781_Closed_Image.style.display='inline'; Codehighlighter1_59_781_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_59_781_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_59_781_Closed_Text.style.display='none'; Codehighlighter1_59_781_Open_Image.style.display='inline'; Codehighlighter1_59_781_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> ProfileArrayList </SPAN><SPAN id=Codehighlighter1_59_781_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_59_781_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_103_354_Open_Image onclick="this.style.display='none'; Codehighlighter1_103_354_Open_Text.style.display='none'; Codehighlighter1_103_354_Closed_Image.style.display='inline'; Codehighlighter1_103_354_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_103_354_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_103_354_Closed_Text.style.display='none'; Codehighlighter1_103_354_Open_Image.style.display='inline'; Codehighlighter1_103_354_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> main(String[] args) </SPAN><SPAN id=Codehighlighter1_103_354_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_103_354_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> s</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000">();<BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_184_234_Open_Image onclick="this.style.display='none'; Codehighlighter1_184_234_Open_Text.style.display='none'; Codehighlighter1_184_234_Closed_Image.style.display='inline'; Codehighlighter1_184_234_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_184_234_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_184_234_Closed_Text.style.display='none'; Codehighlighter1_184_234_Open_Image.style.display='inline'; Codehighlighter1_184_234_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;i</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">15000</SPAN><SPAN style="COLOR: #000000">;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_184_234_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_184_234_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      s.add(</SPAN><SPAN style="COLOR: #000000">""</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">System.currentTimeMillis());<BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Start </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    testOne(s);<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    testTwo(s);<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    testThree(s);<BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    System.out.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">End </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_410_511_Open_Image onclick="this.style.display='none'; Codehighlighter1_410_511_Open_Text.style.display='none'; Codehighlighter1_410_511_Closed_Image.style.display='inline'; Codehighlighter1_410_511_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_410_511_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_410_511_Closed_Text.style.display='none'; Codehighlighter1_410_511_Open_Image.style.display='inline'; Codehighlighter1_410_511_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> testOne(ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> a) </SPAN><SPAN id=Codehighlighter1_410_511_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_410_511_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> j</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;String s</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_472_507_Open_Image onclick="this.style.display='none'; Codehighlighter1_472_507_Open_Text.style.display='none'; Codehighlighter1_472_507_Closed_Image.style.display='inline'; Codehighlighter1_472_507_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_472_507_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_472_507_Closed_Text.style.display='none'; Codehighlighter1_472_507_Open_Image.style.display='inline'; Codehighlighter1_472_507_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;i</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">a.size();i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_472_507_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_472_507_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      s</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">a.get(i);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      j</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_565_675_Open_Image onclick="this.style.display='none'; Codehighlighter1_565_675_Open_Text.style.display='none'; Codehighlighter1_565_675_Closed_Image.style.display='inline'; Codehighlighter1_565_675_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_565_675_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_565_675_Closed_Text.style.display='none'; Codehighlighter1_565_675_Open_Image.style.display='inline'; Codehighlighter1_565_675_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> testTwo(ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> a) </SPAN><SPAN id=Codehighlighter1_565_675_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_565_675_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> j</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    String s</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_636_671_Open_Image onclick="this.style.display='none'; Codehighlighter1_636_671_Open_Text.style.display='none'; Codehighlighter1_636_671_Closed_Image.style.display='inline'; Codehighlighter1_636_671_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_636_671_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_636_671_Closed_Text.style.display='none'; Codehighlighter1_636_671_Open_Image.style.display='inline'; Codehighlighter1_636_671_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,n</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">a.size();i</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">n;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_636_671_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_636_671_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      s</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">a.get(i);<BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      j</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_729_778_Open_Image onclick="this.style.display='none'; Codehighlighter1_729_778_Open_Text.style.display='none'; Codehighlighter1_729_778_Closed_Image.style.display='inline'; Codehighlighter1_729_778_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_729_778_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_729_778_Closed_Text.style.display='none'; Codehighlighter1_729_778_Open_Image.style.display='inline'; Codehighlighter1_729_778_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> testThree(ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> a) </SPAN><SPAN id=Codehighlighter1_729_778_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_729_778_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> j</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_763_776_Open_Image onclick="this.style.display='none'; Codehighlighter1_763_776_Open_Text.style.display='none'; Codehighlighter1_763_776_Closed_Image.style.display='inline'; Codehighlighter1_763_776_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_763_776_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_763_776_Closed_Text.style.display='none'; Codehighlighter1_763_776_Open_Image.style.display='inline'; Codehighlighter1_763_776_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (String s : a) </SPAN><SPAN id=Codehighlighter1_763_776_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_763_776_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    j</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV> <P>通过Profiling工具看结果:<BR>Ҏ      q行旉<BR>testOne   0.055764<BR>testTwo  0.043821<BR>testThres 0.132451<BR><BR>也就是说Qjdk 1.5的for/each循环是最慢的。有点不怿。开头觉得是因ؓ赋值造成的,但后来在另两个方法里面加上赋D句,依然是for/each最慢。比较有的l果?BR><BR>从代码清晰角度,用for/each消耗多一点点旉g也无所谓。但是,另两U代码也不见得“不清晰”,呵呵。看着办了?/P><img src ="http://www.aygfsteel.com/raymondchen625/aggbug/33423.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/raymondchen625/" target="_blank">Raymond的JavaW记</a> 2006-03-03 12:00 <a href="http://www.aygfsteel.com/raymondchen625/archive/2006/03/03/33423.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用JMeterq行压力试http://www.aygfsteel.com/raymondchen625/archive/2006/03/01/32965.htmlRaymond的JavaW记Raymond的JavaW记Wed, 01 Mar 2006 02:04:00 GMThttp://www.aygfsteel.com/raymondchen625/archive/2006/03/01/32965.htmlhttp://www.aygfsteel.com/raymondchen625/comments/32965.htmlhttp://www.aygfsteel.com/raymondchen625/archive/2006/03/01/32965.html#Feedback0http://www.aygfsteel.com/raymondchen625/comments/commentRss/32965.htmlhttp://www.aygfsteel.com/raymondchen625/services/trackbacks/32965.htmlJMeter是apache的jakarta上面的项目,用于软g的压力测试(Load TestQ,不但可以对HTTPQ也可以Ҏ据库Q通过JDBCQ、FTP、Web Service、Java 对象{等q行压力试?BR>
目地址Qhttp://jakarta.apache.org/jmeter

使用Q?q行bin目录下的jmeterw.batQ运行jmeter.bat也可以,不过׃有一个命令窗口显C?BR>
要提醒一下的是jmeterҎ当前pȝ的locale昄菜单的语aQؓ了方便想讄回英文的话,可以修改jmeter.properties文gQ设|language=en  Q我下蝲?.1.1版本把“退出”误译ؓ“推出”,怎么看都不顺?Q?BR>
使用Q?BR>
JMeter的测试计划(Test PlanQ呈树状l构Q树里面有多U元素类型,树状l构的元素之间有的是有承关pȝQ其原理有点cMlog4jQ。下面简qC下元素类型:

1?STRONG>ThreadGroup
      ֐思义是U程l,试必须有一个ThreadGroup元素作ؓ基础Q否则就没有试U程在跑了)Q这个元素可以配|跑多少个线E、每个线E@环多次Q所有线E数的d动时_Ramp-up periodQ等{?BR>
2?STRONG>Controller
     包括Logical Controller和SamplerQ前者用来作一些逻辑上的控制Q例如轮换、条件、@环等{。Sampler是真正“干zZ的“取样器”,例如“HTTP Request”,是拿来执行一个HTTPh的?BR>
3?STRONG>Listener
    Listener对请求过E进行监听,可以单理解ؓ获取l果的东东。例如Simple Data WriterQ可以把l果写到一个文本文仉Q其实所有Listener都可以写数据到文仉Q,q有View Results in TableQ就是把l果昄在表格里?BR>
4?Timer
    用来控制执行程中的旉延迟{功能?BR>
5?Assertion
    断言Q加到Sampler里面可以对返回的l果q行判断Q例如判断HTTPq回l果里面是否含有某个字符丌Ӏ如果断a为真QJMeter会标记请求ؓ成功Q否则标Cؓp|?BR>
6?Configuration Element
   
配置用的元素Q很有用。由于测试计划是树状和有l承关系的,可以在高层次指定一个Configuration ElementQ低层次的相关Sampler如果没有昑ּ地指定配|,q扉K层次的配|信息。(跟log4j很像吧?Q?BR>
7?Pre-Processor/Post-Processor Elements
   用来在Samplerq行前和q行后作一些预处理和后处理工作的。例如动态修改请求的参数Q预处理Q,从返回信息里面提取信息(后处理){等?BR>
举例Q要做一个最单的HTTP压力试Q??0个线E访问一个URLQ每个线E访?00ơ?BR>做法Q?BR>1?在Test Plan下面加一个Thread GroupQ配|里面,U程数填10Q@环次数填100
2?在Thread Group下面加一个HTTP RequestQ这是一个SamplerQ在它的配置里面填写L信息Q端口、协议、\径、参数等信息
3?在HTTP Request下面加一个View Results in TableQ如果你x记录记到文gQ则填写文g路径?BR>4?保存一些这个Test PlanQ就可以选择Run菜单下面的Run来运行了。直到Run菜单从灰色变回黑色Q就表示q行完了。在View Results in Table下面Q你可以看到q行l果?BR>
关于元素的详l描q可以参?A >官方文档?BR>
JMeter功能很丰富的Q还有很强的扩展能力Q而且又是免费Q值得研究使用?/FONT>


]]>
使用TPTP和eclipseq行ProfilingQ剖析)Q简?/title><link>http://www.aygfsteel.com/raymondchen625/archive/2006/02/27/32637.html</link><dc:creator>Raymond的JavaW记</dc:creator><author>Raymond的JavaW记</author><pubDate>Mon, 27 Feb 2006 06:14:00 GMT</pubDate><guid>http://www.aygfsteel.com/raymondchen625/archive/2006/02/27/32637.html</guid><wfw:comment>http://www.aygfsteel.com/raymondchen625/comments/32637.html</wfw:comment><comments>http://www.aygfsteel.com/raymondchen625/archive/2006/02/27/32637.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/raymondchen625/comments/commentRss/32637.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/raymondchen625/services/trackbacks/32637.html</trackback:ping><description><![CDATA[<P>本文只作很简要介l,可视作备忘参考?BR><BR>TPTP是eclipse官方的profiling插gQ初步用下感觉功能强大?BR><BR>下蝲安装Q??A >http://www.eclipse.org/tptp/</A>下蝲Q我选择AllQRuntimeQ然后像其它插g一栯压到eclipse的目录,然后允许eclipse -clean来刷C把?BR><BR>使用Q?nbsp;<BR>   常用的profiling单来讲就对程序运行进行记录,然后从数据中分析哪些Ҏq行旉长,哪些对象吃内存多Q哪些类的实例多{等。一个比较好的用入门sample在这里: <A >http://www.eclipse.org/tptp/home/documents/tutorials/profilingtool/profilingexample_32.html</A> 我就不罗嗦了?BR><BR>值得多讲的是Remote ProfilingQ就是远E剖析。实现的原理是在q程机器上运行一个代理进E,要被q程剖析的程序或者Application Server启动的时候加一个JVM参数来识别这个代理进E,两者相互作用,代理可以把攉到的信息发给在远E的一方(是q行着eclipse的一方)?BR><BR>因此要实现Remote ProfilingQ还要在目标机器上装一个agent?--><BR><BR>下蝲安装Q?A >http://www.eclipse.org/tptp/home/downloads/drops/TPTP-4.0.1.html</A> 选择对应操作pȝ?FONT color=#000000><STRONG>Agent Controller</STRONG>下蝲Q选择Runtime卛_?BR><BR>下蝲后,阅读依照getting_started.html的说明来安装卛_Q这里简qC下:<BR>1?把它的bin目录攑ֈPATH里面<BR>2?q行一下SetConfig来设|参敎ͼ注意如果惌除本地localhost意外所以机器都讉K的话Q要注意讄Network Access ModeQ默认是localhost的?BR>3?q行RAStart来启动代理(Linux下)<BR>4?服务器端E序Q例如tomcatQ启动的JVM参数里面加入-XrunpiAgent:server=enabled卛_Q还有其它参数值参见文档)<BR>5?然后可以在q程用eclipse来启动一个Profilingq程来attach到这个agent controller了。效果和在eclipse里面直接profile应用E序一栗?BR><BR></FONT></P><img src ="http://www.aygfsteel.com/raymondchen625/aggbug/32637.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/raymondchen625/" target="_blank">Raymond的JavaW记</a> 2006-02-27 14:14 <a href="http://www.aygfsteel.com/raymondchen625/archive/2006/02/27/32637.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Volatile Fieldshttp://www.aygfsteel.com/raymondchen625/archive/2006/02/19/31476.htmlRaymond的JavaW记Raymond的JavaW记Sun, 19 Feb 2006 07:58:00 GMThttp://www.aygfsteel.com/raymondchen625/archive/2006/02/19/31476.htmlhttp://www.aygfsteel.com/raymondchen625/comments/31476.htmlhttp://www.aygfsteel.com/raymondchen625/archive/2006/02/19/31476.html#Feedback0http://www.aygfsteel.com/raymondchen625/comments/commentRss/31476.htmlhttp://www.aygfsteel.com/raymondchen625/services/trackbacks/31476.htmlVolatile Fields

Sometimes, it seems excessive to pay the cost of synchronization just to read or write an instance field or two. After all, what can go wrong? Unfortunately, with modern processors and compilers, there is plenty of room for error:

  • Computers with multiple processors can temporarily hold memory values in registers or local memory caches. As a consequence, threads running in different processors may see different values for the same memory location!

  • Compilers can reorder instructions for maximum throughput. Compilers won't choose an ordering that changes the meaning of the code, but they make the assumption that memory values are only changed when there are explicit instructions in the code. However, a memory value can be changed by another thread!

If you use locks to protect code that can be accessed by multiple threads, then you won't have these problems. Compilers are required to respect locks by flushing local caches as necessary and not inappropriately reordering instructions. The details are explained in the Java Memory Model and Thread Specification developed by JSR 133 (see http://www.jcp.org/en/jsr/detail?id=133). Much of the specification is highly complex and technical, but the document also contains a number of clearly explained examples. A more accessible overview article by Brian Goetz is available at http://www-106.ibm.com/developerworks/java/library/j-jtp02244.html.

NOTE

Brian Goetz coined the following "synchronization motto": "If you write a variable which may next be read by another thread, or you read a variable which may have last been written by another thread, you must use synchronization."


The volatile keyword offers a lock-free mechanism for synchronizing access to an instance field. If you declare a field as volatile, then the compiler and the virtual machine take into account that the field may be concurrently updated by another thread.

For example, suppose an object has a boolean flag done that is set by one thread and queried by another thread. You have two choices:

  1. Use a lock, for example:

    public synchronized boolean isDone() { return done; }
    private boolean done;
    

    (This approach has a potential drawback: the isDone method can block if another thread has locked the object.)

  2. Declare the field as volatile:

    public boolean isDone() { return done; }
    private volatile boolean done;
    

Of course, accessing a volatile variable will be slower than accessing a regular variablethat is the price to pay for thread safety.

NOTE

Prior to JDK 5.0, the semantics of volatile were rather permissive. The language designers attempted to give implementors leeway in optimizing the performance of code that uses volatile fields. However, the old specification was so complex that implementors didn't always follow it, and it allowed confusing and undesirable behavior, such as immutable objects that weren't truly immutable.


In summary, concurrent access to a field is safe in these three conditions:

  • The field is volatile.

  • The field is final, and it is accessed after the constructor has completed.

  • The field access is protected by a lock.



]]>
在lucene实现按关键字出现ơ数排序的列?/title><link>http://www.aygfsteel.com/raymondchen625/archive/2006/02/04/29526.html</link><dc:creator>Raymond的JavaW记</dc:creator><author>Raymond的JavaW记</author><pubDate>Sat, 04 Feb 2006 06:26:00 GMT</pubDate><guid>http://www.aygfsteel.com/raymondchen625/archive/2006/02/04/29526.html</guid><wfw:comment>http://www.aygfsteel.com/raymondchen625/comments/29526.html</wfw:comment><comments>http://www.aygfsteel.com/raymondchen625/archive/2006/02/04/29526.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/raymondchen625/comments/commentRss/29526.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/raymondchen625/services/trackbacks/29526.html</trackback:ping><description><![CDATA[需求: 在lucene索引中徏立了很多关键字的索引Q想获得一个当前用L关键字列表,q且每个关键字还带有使用了多次的信息?BR><BR>解决ҎQ?BR>使用自定义的HitCollector对象Q代码如? <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.io.IOException;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.ArrayList;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.Collections;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.HashMap;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.Iterator;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.util.Set;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> org.apache.lucene.document.Document;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> org.apache.lucene.search.HitCollector;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> org.apache.lucene.search.IndexSearcher;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_347_1561_Open_Image onclick="this.style.display='none'; Codehighlighter1_347_1561_Open_Text.style.display='none'; Codehighlighter1_347_1561_Closed_Image.style.display='inline'; Codehighlighter1_347_1561_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_347_1561_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_347_1561_Closed_Text.style.display='none'; Codehighlighter1_347_1561_Open_Image.style.display='inline'; Codehighlighter1_347_1561_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> TagCollector </SPAN><SPAN style="COLOR: #0000ff">extends</SPAN><SPAN style="COLOR: #000000"> HitCollector </SPAN><SPAN id=Codehighlighter1_347_1561_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_347_1561_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> IndexSearcher searcher;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> HashMap</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String,Integer</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> tagList</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> HashMap</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String,Integer</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000">();<BR><IMG id=Codehighlighter1_499_528_Open_Image onclick="this.style.display='none'; Codehighlighter1_499_528_Open_Text.style.display='none'; Codehighlighter1_499_528_Closed_Image.style.display='inline'; Codehighlighter1_499_528_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_499_528_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_499_528_Closed_Text.style.display='none'; Codehighlighter1_499_528_Open_Image.style.display='inline'; Codehighlighter1_499_528_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> TagCollector(IndexSearcher searcher) </SPAN><SPAN id=Codehighlighter1_499_528_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_499_528_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.searcher</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">searcher;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    @Override<BR><IMG id=Codehighlighter1_586_847_Open_Image onclick="this.style.display='none'; Codehighlighter1_586_847_Open_Text.style.display='none'; Codehighlighter1_586_847_Closed_Image.style.display='inline'; Codehighlighter1_586_847_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_586_847_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_586_847_Closed_Text.style.display='none'; Codehighlighter1_586_847_Open_Image.style.display='inline'; Codehighlighter1_586_847_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> collect(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> docID, </SPAN><SPAN style="COLOR: #0000ff">float</SPAN><SPAN style="COLOR: #000000"> score) </SPAN><SPAN id=Codehighlighter1_586_847_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_586_847_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG id=Codehighlighter1_594_791_Open_Image onclick="this.style.display='none'; Codehighlighter1_594_791_Open_Text.style.display='none'; Codehighlighter1_594_791_Closed_Image.style.display='inline'; Codehighlighter1_594_791_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_594_791_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_594_791_Closed_Text.style.display='none'; Codehighlighter1_594_791_Open_Image.style.display='inline'; Codehighlighter1_594_791_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">try</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_594_791_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_594_791_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            Document doc</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">searcher.doc(docID);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            String[] tagValues</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">doc.getValues(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">tag</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG id=Codehighlighter1_701_787_Open_Image onclick="this.style.display='none'; Codehighlighter1_701_787_Open_Text.style.display='none'; Codehighlighter1_701_787_Closed_Image.style.display='inline'; Codehighlighter1_701_787_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_701_787_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_701_787_Closed_Text.style.display='none'; Codehighlighter1_701_787_Open_Image.style.display='inline'; Codehighlighter1_701_787_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>            </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (tagValues</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_701_787_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_701_787_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG id=Codehighlighter1_744_782_Open_Image onclick="this.style.display='none'; Codehighlighter1_744_782_Open_Text.style.display='none'; Codehighlighter1_744_782_Closed_Image.style.display='inline'; Codehighlighter1_744_782_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_744_782_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_744_782_Closed_Text.style.display='none'; Codehighlighter1_744_782_Open_Image.style.display='inline'; Codehighlighter1_744_782_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>                </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;i</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">tagValues.length;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_744_782_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_744_782_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>                    addTagCount(tagValues[i]);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_815_843_Open_Image onclick="this.style.display='none'; Codehighlighter1_815_843_Open_Text.style.display='none'; Codehighlighter1_815_843_Closed_Image.style.display='inline'; Codehighlighter1_815_843_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_815_843_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_815_843_Closed_Text.style.display='none'; Codehighlighter1_815_843_Open_Image.style.display='inline'; Codehighlighter1_815_843_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">catch</SPAN><SPAN style="COLOR: #000000"> (IOException e) </SPAN><SPAN id=Codehighlighter1_815_843_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_815_843_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            e.printStackTrace();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG id=Codehighlighter1_893_1025_Open_Image onclick="this.style.display='none'; Codehighlighter1_893_1025_Open_Text.style.display='none'; Codehighlighter1_893_1025_Closed_Image.style.display='inline'; Codehighlighter1_893_1025_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_893_1025_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_893_1025_Closed_Text.style.display='none'; Codehighlighter1_893_1025_Open_Image.style.display='inline'; Codehighlighter1_893_1025_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> addTagCount(String tagName) </SPAN><SPAN id=Codehighlighter1_893_1025_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_893_1025_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> count</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR><IMG id=Codehighlighter1_946_992_Open_Image onclick="this.style.display='none'; Codehighlighter1_946_992_Open_Text.style.display='none'; Codehighlighter1_946_992_Closed_Image.style.display='inline'; Codehighlighter1_946_992_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_946_992_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_946_992_Closed_Text.style.display='none'; Codehighlighter1_946_992_Open_Image.style.display='inline'; Codehighlighter1_946_992_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (tagList.containsKey(tagName)) </SPAN><SPAN id=Codehighlighter1_946_992_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_946_992_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            count</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">(Integer)tagList.get(tagName)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        tagList.put(tagName,count);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG id=Codehighlighter1_1074_1095_Open_Image onclick="this.style.display='none'; Codehighlighter1_1074_1095_Open_Text.style.display='none'; Codehighlighter1_1074_1095_Closed_Image.style.display='inline'; Codehighlighter1_1074_1095_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1074_1095_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1074_1095_Closed_Text.style.display='none'; Codehighlighter1_1074_1095_Open_Image.style.display='inline'; Codehighlighter1_1074_1095_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> HashMap</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">String,Integer</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> getTagList() </SPAN><SPAN id=Codehighlighter1_1074_1095_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_1074_1095_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> tagList;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    @SuppressWarnings(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">unchecked</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR><IMG id=Codehighlighter1_1197_1556_Open_Image onclick="this.style.display='none'; Codehighlighter1_1197_1556_Open_Text.style.display='none'; Codehighlighter1_1197_1556_Closed_Image.style.display='inline'; Codehighlighter1_1197_1556_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1197_1556_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1197_1556_Closed_Text.style.display='none'; Codehighlighter1_1197_1556_Open_Image.style.display='inline'; Codehighlighter1_1197_1556_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">TagSummary</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> getSortedTagList(</SPAN><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000"> ascending) </SPAN><SPAN id=Codehighlighter1_1197_1556_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_1197_1556_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">TagSummary</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> list</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> ArrayList</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">TagSummary</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000">();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        Iterator keyIterator</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">tagList.keySet().iterator();<BR><IMG id=Codehighlighter1_1341_1458_Open_Image onclick="this.style.display='none'; Codehighlighter1_1341_1458_Open_Text.style.display='none'; Codehighlighter1_1341_1458_Closed_Image.style.display='inline'; Codehighlighter1_1341_1458_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1341_1458_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1341_1458_Closed_Text.style.display='none'; Codehighlighter1_1341_1458_Open_Image.style.display='inline'; Codehighlighter1_1341_1458_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000"> (keyIterator.hasNext()) </SPAN><SPAN id=Codehighlighter1_1341_1458_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_1341_1458_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            String key</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">(String)keyIterator.next();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> value</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">tagList.get(key);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            list.add(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> TagSummary(key,value));<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        Collections.sort(list);<BR><IMG id=Codehighlighter1_1504_1538_Open_Image onclick="this.style.display='none'; Codehighlighter1_1504_1538_Open_Text.style.display='none'; Codehighlighter1_1504_1538_Closed_Image.style.display='inline'; Codehighlighter1_1504_1538_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1504_1538_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1504_1538_Closed_Text.style.display='none'; Codehighlighter1_1504_1538_Open_Image.style.display='inline'; Codehighlighter1_1504_1538_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">ascending) </SPAN><SPAN id=Codehighlighter1_1504_1538_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_1504_1538_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>            Collections.reverse(list);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> list;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>功能说明Q?每个搜烦到的hitsQ都会调用这个方法的collectҎQ因此可以在q个对象当中放一个HashMapQ篏计记录每个关键字得到的次数?BR><BR>排序部分用另外的一个TagSummarycL获得Q这里就不详l给Z?BR><BR>问题Q?q是一个直观的ҎQ但是相信频J调用这LҎ会造成服务器的严重负担。可以考虑一下用~存的方法,在没有关键字未曾发生改变之前Q只在第一ơ调用这LҎQ之后把l果~存在数据表或者内存当中。有更新的时候,通过版本号对比以军_是否需要更新?img src ="http://www.aygfsteel.com/raymondchen625/aggbug/29526.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/raymondchen625/" target="_blank">Raymond的JavaW记</a> 2006-02-04 14:26 <a href="http://www.aygfsteel.com/raymondchen625/archive/2006/02/04/29526.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Resin + Struts 的中文ؕ码问题解?/title><link>http://www.aygfsteel.com/raymondchen625/archive/2006/01/19/28708.html</link><dc:creator>Raymond的JavaW记</dc:creator><author>Raymond的JavaW记</author><pubDate>Thu, 19 Jan 2006 15:28:00 GMT</pubDate><guid>http://www.aygfsteel.com/raymondchen625/archive/2006/01/19/28708.html</guid><wfw:comment>http://www.aygfsteel.com/raymondchen625/comments/28708.html</wfw:comment><comments>http://www.aygfsteel.com/raymondchen625/archive/2006/01/19/28708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/raymondchen625/comments/commentRss/28708.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/raymondchen625/services/trackbacks/28708.html</trackback:ping><description><![CDATA[问题Q?BR>使用Struts的ActionForm接收到的中文全部是ؕ码,例如提交q去的“测试”字W串Q得到的是??????؈????”。开头以为是传统的encoding识别的问题,但是用各U编码重新构造得到的byte[]数组Q依然无法得到正的中文。但是如果用普通的jsp来接收form的数据,中文是完全正常的?BR>我开始觉得是struts的流E当中,错误C用了~码Q以x后得到的l果完全׃。搜索了好多文章Qȝ扑ֈ一个比较接q的?BR>解决ҎQ?BR>定义一个filterQfilter只做一件事情,是Q?BR>      request.setCharacterEncoding("UTF-8");<BR>在web.xml的filter mapping?讑֮和struts的action同样的mapping?BR><BR>解释Q?Filter最先拦截webhQ在q里讄了正的CharacterEncodingQ接下来各个处理的组件就不会搞错了。在没有Filter的情况下Q我的resin服务器上获得的是nullQ估计struts不同的处理组件对null的解释和处理不太一_D错误的生?BR><BR>要注意我所有页面都是UTF-8~码Q所以在filter里面定义了UTF-8Q如果是其它的编码,q里应该相应改一下?img src ="http://www.aygfsteel.com/raymondchen625/aggbug/28708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/raymondchen625/" target="_blank">Raymond的JavaW记</a> 2006-01-19 23:28 <a href="http://www.aygfsteel.com/raymondchen625/archive/2006/01/19/28708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java判定字符是否中文http://www.aygfsteel.com/raymondchen625/archive/2006/01/17/28293.htmlRaymond的JavaW记Raymond的JavaW记Tue, 17 Jan 2006 04:09:00 GMThttp://www.aygfsteel.com/raymondchen625/archive/2006/01/17/28293.htmlhttp://www.aygfsteel.com/raymondchen625/comments/28293.htmlhttp://www.aygfsteel.com/raymondchen625/archive/2006/01/17/28293.html#Feedback0http://www.aygfsteel.com/raymondchen625/comments/commentRss/28293.htmlhttp://www.aygfsteel.com/raymondchen625/services/trackbacks/28293.html

   System.out.println(Character.UnicodeBlock.of('?));
   System.out.println(Character.UnicodeBlock.of('j'));
   System.out.println(Character.UnicodeBlock.of(3267));

q行l果Q?BR>CJK_UNIFIED_IDEOGRAPHS
BASIC_LATIN
KANNADA

其实不完全够用,因ؓ如果得到“CJK_UNIFIED_IDEOGRAPHS”,q可能是日文或者韩文。不q对我的需求是_了。如果要准确判断中文Q去查一下unicode代码可以了?BR>


]]>
实现队列的JavaScript对象http://www.aygfsteel.com/raymondchen625/archive/2006/01/16/28205.htmlRaymond的JavaW记Raymond的JavaW记Mon, 16 Jan 2006 07:52:00 GMThttp://www.aygfsteel.com/raymondchen625/archive/2006/01/16/28205.htmlhttp://www.aygfsteel.com/raymondchen625/comments/28205.htmlhttp://www.aygfsteel.com/raymondchen625/archive/2006/01/16/28205.html#Feedback2http://www.aygfsteel.com/raymondchen625/comments/commentRss/28205.htmlhttp://www.aygfsteel.com/raymondchen625/services/trackbacks/28205.html this.size=size;
 this.data=new Array();
 this.add=function(ele) {
  if (this.data.length<this.size) {
   this.data[this.data.length]=ele;
  } else {
   this.data.shift();
   this.data[this.data.length]=ele;
  }
 };
 this.getData=function() {
  return this.data;
 };
 this.toCookieValue=function(delimiter) {
  var result='';
  for (var i=0;i<this.data.length ;i++ )
  {
   if(i==0) {
    result=escape(this.data[i]);
   } else {
    result+=delimiter+escape(this.data[i]);
   }
  }
  return result;
 };
}


]]>
Resin ~译的奇怪问题解?/title><link>http://www.aygfsteel.com/raymondchen625/archive/2006/01/13/27945.html</link><dc:creator>Raymond的JavaW记</dc:creator><author>Raymond的JavaW记</author><pubDate>Fri, 13 Jan 2006 08:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/raymondchen625/archive/2006/01/13/27945.html</guid><wfw:comment>http://www.aygfsteel.com/raymondchen625/comments/27945.html</wfw:comment><comments>http://www.aygfsteel.com/raymondchen625/archive/2006/01/13/27945.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/raymondchen625/comments/commentRss/27945.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/raymondchen625/services/trackbacks/27945.html</trackback:ping><description><![CDATA[使用Resin 3.0开发,很奇怪Eclipse在启动了remote debugQ然后加断点的时候说我的cL有加行号。我N了选项Q明明是加了行号的呀。甚x在一个必定会走过的类前面加个log打出来,路照CQ居然在console不见log。百思不得其解,快崩溃之前。终于想起了临时目录?BR><BR>Resin默认L在WEB-INF下面生成work和tmp目录Q是放jsp~译而成的类的。我把这两个目录删除了。一切正常,断点也可以加了?BR><BR>原因Q?应该是resin在判断类是否需要重新编译时有点问题Q对于我jsp里面有用到的类发生变化以后Q调用它的jsp文g没有重新~译。导致类文g不更斎ͼq带出了一堆古怪的错误?BR><BR>下次C了,有问题,先删临时目录Q?img src ="http://www.aygfsteel.com/raymondchen625/aggbug/27945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/raymondchen625/" target="_blank">Raymond的JavaW记</a> 2006-01-13 16:05 <a href="http://www.aygfsteel.com/raymondchen625/archive/2006/01/13/27945.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͳ</a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank">ͨ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">μ</a>| <a href="http://" target="_blank">鴨</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ½</a>| <a href="http://" target="_blank">ʼ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ﶫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̫</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">۳</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͻ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>