亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? xyobjarray.htm

?? Last week I posted an article on a simple C++ template class, XYDataArray, I used in my system devel
?? HTM
字號:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Xiangyang Liu">
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
   <title>XYDataArray:  A Template For General Data Arrays</title>
</head>
<body>
&nbsp;
<br>Last week I posted an article on a simple <b><font color="#660000">C++</font></b>
template class <a href="http://www.codeproject.com/useritems/dataarray.asp">XYDataArray</a>
I used in <a href="http://hometown.aol.com/xiangyangl/">my system development
tool</a>.&nbsp; The main purpose of this template class is to store and
sort general data types.&nbsp; I need to implement the same thing in <b><font color="#660000">java</font></b>,
since the tool I developed has a compatible <b><font color="#660000">java</font></b>
version.&nbsp; I checked the <b><font color="#660000">Java SDK</font></b>
documentation before writing my own code, and found that almost everything
I need is already there, like the <b><font color="#660000">C++</font></b>
case.
<p>For example, the <b><font color="#660000">java.util.Vector</font></b>
class is the kind of array I want, it can dynamically change its size.&nbsp;
There is also various implementations of <b><font color="#006600">stable
sort algorithms</font></b> in the <b><font color="#660000">java.util.Arrays</font></b>
class.&nbsp; For example, the following line of code will sort a <b><font color="#660000">java</font></b>
<i><font color="#660000">Object</font></i> array in ascending order.
<p><i><font color="#006600">&nbsp;&nbsp;&nbsp; Arrays.sort(myArray);</font></i>
<p>And the sort is guaranteed to be <b><font color="#006600">stable</font></b>
(equal elements will not be reordered).&nbsp; The objects in <i><font color="#006600">myArray</font></i>
has to be mutually comparable, of course (implementing the <b><font color="#660000">Comparable</font></b>
interface).&nbsp; There are other forms of the <b><font color="#660000">Arrays.sort</font></b>
method that can be used to sort primitive data types (int, double, etc.)
and even subarrays.&nbsp; What about sorting in descending order (note
that sorting in ascending order and then reversing the orders of all elements
makes it <b><font color="#006600">unstable</font></b>)?&nbsp; In that case,
you have to implement a <b><font color="#660000">Comparator</font></b>
class and pass an object of this class along with the data array into another
<b><font color="#660000">Arrays.sort</font></b> method.&nbsp; This is like
passing a function pointer to a generic sort function in <b><font color="#660000">C++</font></b>.&nbsp;
It is not exactly what I want.&nbsp; For example, I don't want to implement
a different <b><font color="#660000">Comparator</font></b> class for each
different way I want to sort my data.&nbsp; What I really need is sorting
the indices instead of the data array itself.&nbsp; For example, I want
to get the index of the <i><font color="#006600">10th</font></i> largest
element or the index of the <i><font color="#006600">6th</font></i> smallest
element in my array.&nbsp; The <b><font color="#006600">SortIndex</font></b>
method in my <b><font color="#660000">C++</font></b> code will give me
exactly what I need.&nbsp; The best part about the <b><font color="#006600">SortIndex</font></b>
method is, I can use it repeatedly to do multi-column sorting on tabulated
data (each column is in a separate array) without rearranging the data
elements!&nbsp; So I converted my <b><font color="#660000">C++</font></b>
template class <a href="http://www.codeproject.com/useritems/dataarray.asp">XYDataArray</a>
into a <b><font color="#660000">java</font></b> class <b><font color="#006600">XYObjArray</font></b>.
<p>The <b><font color="#006600">XYObjArray</font></b> class is almost identical
to its <b><font color="#660000">C++</font></b> counterpart except that
there is no template or operator overloading in <b><font color="#660000">java</font></b>.&nbsp;
In order to use the sort feature, objects in this class has to be mutually
comparable (implementing the <b><font color="#660000">Comparable</font></b>
interface).&nbsp; I have included source code and a simple test program.&nbsp;
There is no restriction on using the source code.&nbsp; The test program
creates an array with randomly generated data and then sorts the array
(and also verifies that the sort is done correctly).&nbsp; Here is the
command line that runs the test program, assuming you already compiled
the code and set the correct <b><font color="#660000">ClassPath.</font></b>
<p>&nbsp;&nbsp;&nbsp; <i><font color="#006600">java ArrayTest</font></i>
<p>Here are the descriptions of the methods in <b><font color="#006600">XYObjArray</font></b>.
<p><b><i><font color="#FF0000">public XYObjArray( );</font></i></b>
<br>This method constructs an empty array.
<p><b><i><font color="#FF0000">public XYObjArray(Object[ ] pObj, int nGrowBy);</font></i></b>
<br>This method constructs an array with given <i><font color="#660000">Object</font></i>
array <i><font color="#006600">pObj</font></i>.&nbsp; The <i><font color="#006600">nGrowBy</font></i>
parameter specifies how the array's internal buffer grows or shrinks.&nbsp;
The<i><font color="#006600"> nGrowBy </font></i>= <i><font color="#006600">64</font></i>
means that the internal buffer will grow in multiples of <i><font color="#006600">64</font></i>
elements.<b><i><font color="#FF0000"></font></i></b>
<p><b><i><font color="#FF0000">public final synchronized int Find(Object
obj);</font></i></b>
<br>This method returns the index of <i><font color="#006600">obj</font></i>
within the array.&nbsp; The return value is <i><font color="#006600">-1</font></i>
if <i><font color="#006600">obj</font></i> is not found.&nbsp; If the array
is already sorted, this method will use binary search instead of linear
search.
<p><b><i><font color="#FF0000">public final synchronized int Locate(Object
obj);</font></i></b>
<br>This method returns the position at which to insert a new element <i><font color="#006600">obj</font></i>.&nbsp;
If the array is already sorted, inserting at the returned position will
keep the array sorted.
<p><b><i><font color="#FF0000">public final synchronized void SetSize(int
nSize, int nGrowBy);</font></i></b>
<br>This method changes the size of the array.&nbsp; If the new size is
bigger than the original size, the array will be chopped.&nbsp; Otherwise,
<b><i><font color="#006600">null</font></i></b> elements will be added
if necessary.&nbsp; In any case, the original elements, except the ones
being chopped off, will be preserved.
<p><b><i><font color="#FF0000">public final synchronized int GetSize( );</font></i></b>
<br>This method returns the current size of the array.
<p><b><i><font color="#FF0000">public final synchronized Object[ ] GetDataPtr(
);</font></i></b>
<br>This method returns the internal data buffer.
<p><b><i><font color="#FF0000">public final synchronized Object GetAt(int
nIndex);</font></i></b>
<br>This method returns the element at the position
<i><font color="#006600">nIndex</font></i>.<b><i><font color="#FF0000"></font></i></b>
<p><b><i><font color="#FF0000">public final synchronized int Add(Object
obj);</font></i></b>
<br>This method adds a new element <i><font color="#006600">obj</font></i>
to the array.&nbsp; If the array is already sorted, adding the new element
will keep the array sorted.&nbsp; Otherwise, the new element will be appended
to the end of the array.&nbsp; The return value is the position of the
newly added element.
<p><b><i><font color="#FF0000">public final synchronized&nbsp; int Insert(int
nIndex, Object obj);</font></i></b>
<br>This method inserts a new element<font color="#006600"> <i>obj</i></font>
to the array at position <i><font color="#006600">nIndex</font></i>. The
return value is <i><font color="#006600">-1</font></i> if <i><font color="#006600">nIndex</font></i>
is invalid (out of the range between <i><font color="#006600">0</font></i>
and the size of the array).&nbsp; Otherwise, it returns <i><font color="#006600">nIndex</font></i>.
<p><b><i><font color="#FF0000">public final synchronized int Remove(int
nIndex);</font></i></b>
<br>This method removes the element<font color="#006600"> </font>at position
<i><font color="#006600">nIndex</font></i> from the array.&nbsp; The return
value is <i><font color="#006600">-1</font></i> if <i><font color="#006600">nIndex</font></i>
is out of range.&nbsp; Otherwise, it returns the size of the new array.
<p><b><i><font color="#FF0000">public final synchronized int SetAt(int
nIndex, Object obj);</font></i></b>
<br>This method assigns the element<font color="#006600"> <i>obj</i></font>
to position <i><font color="#006600">nIndex</font></i> in the array.&nbsp;
The return value is <i><font color="#006600">-1</font></i> if <i><font color="#006600">nIndex</font></i>
is out of range.&nbsp; Otherwise, it returns <i><font color="#006600">nIndex</font></i>.
<p><b><i><font color="#FF0000">public final synchronized void Push(Object
obj);</font></i></b>
<br>This method add a new element <i><font color="#006600">obj</font></i>
to the end of the array.
<p><b><i><font color="#FF0000">public final synchronized Object Pop( );</font></i></b>
<br>This method removes an element from the end of the array, the return
value is the element being removed.
<p><b><i><font color="#FF0000">public final synchronized int GetSort( );</font></i></b>
<br>This method returns <i><font color="#006600">1</font></i> if the array
is sorted in ascending order, it returns <i><font color="#006600">-1</font></i>
if sorted in descending order.&nbsp; Otherwise, it returns <i><font color="#006600">0</font></i>.
<p><b><i><font color="#FF0000">public final synchronized void SetSort(int
nSort);</font></i></b>
<br>If <i><font color="#006600">nSort </font></i>is <i><font color="#006600">1</font></i>,
it will sort the array in ascending order if not already sorted.&nbsp;
If <i><font color="#006600">nSort </font></i>is <i><font color="#006600">-1</font></i>,
it will sort the array in descending order if not already sorted.
<p><b><i><font color="#FF0000">public final synchronized virtual void Sort(int
nSort);</font></i></b>
<br>This method sorts the array.&nbsp; <i><font color="#006600">nSort </font></i>specifies
what order to sort, <i><font color="#006600">1</font></i> for ascending,
<i><font color="#006600">-1</font></i>
for descending.
<p><b><i><font color="#FF0000">public final synchronized virtual void SortIndex(int[
] arrayIndex, int nSort);</font></i></b>
<br>This method does not sort the array itself, instead, it sorts an index
array according to the specified order.&nbsp; <i><font color="#006600">arrayIndex</font></i>
must be an integer array containing integers <i><font color="#006600">0,
1, 2, ..., nSize-1</font></i>, where <i><font color="#006600">nSize</font></i>
is the size of the current array.&nbsp; The
<b><i><font color="#FF0000">Sort</font></i></b>
method is implemented using this method.&nbsp; The algorithm is a combination
of <b><font color="#006600">insertion sort</font></b> and "<font color="#FF0000">randomized</font>"
<b><font color="#006600">quick sort</font></b>.&nbsp; The performance is
as good as the <b><font color="#660000">Arrays.sort</font></b> method in
<b><font color="#660000">Java JDK</font></b> for randomly generated data,
according to my tests.&nbsp; The <b><font color="#660000">Arrays.sort</font></b>
method performs better when the input data is nearly sorted.
<br>&nbsp;
</body>
</html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美一区二区三区网站| 秋霞电影一区二区| 亚洲成va人在线观看| 久久99精品久久只有精品| 成人国产免费视频| 777午夜精品视频在线播放| 亚洲国产精品二十页| 亚洲电影一级黄| 风间由美一区二区三区在线观看| 欧美色综合网站| 中文字幕一区二区三中文字幕| 日本亚洲欧美天堂免费| 欧美日韩精品欧美日韩精品一综合| 91精品国产综合久久福利软件| 国产精品色哟哟| 美女被吸乳得到大胸91| 色狠狠一区二区三区香蕉| 精品精品国产高清a毛片牛牛| 夜夜嗨av一区二区三区四季av| 国产综合一区二区| 欧美一卡在线观看| 亚洲国产精品久久久久婷婷884| 盗摄精品av一区二区三区| 日韩免费福利电影在线观看| 亚洲国产精品自拍| 色欧美片视频在线观看| 亚洲视频电影在线| 国产sm精品调教视频网站| 欧美变态凌虐bdsm| 日本特黄久久久高潮| 欧美吻胸吃奶大尺度电影| 1区2区3区国产精品| 福利一区二区在线观看| 久久伊人中文字幕| 久久99热这里只有精品| 日韩欧美国产不卡| 日韩电影在线观看电影| 欧美理论片在线| 亚洲福利视频一区| 欧美三级电影精品| 亚洲午夜久久久久久久久电影网 | 成人免费精品视频| 久久嫩草精品久久久精品| 久久不见久久见免费视频1| 91精品国产黑色紧身裤美女| 日韩精品乱码av一区二区| 91 com成人网| 免费不卡在线观看| 精品国产91乱码一区二区三区| 韩国三级在线一区| www国产亚洲精品久久麻豆| 久久99精品一区二区三区三区| 精品国产青草久久久久福利| 加勒比av一区二区| 国产欧美日本一区视频| 99在线视频精品| 亚洲在线免费播放| 日韩欧美中文字幕公布| 国产精品888| 中文字幕综合网| 在线精品国精品国产尤物884a| 午夜精品福利一区二区三区蜜桃| 欧美精品乱码久久久久久| 六月婷婷色综合| 国产精品剧情在线亚洲| 色婷婷综合久久久久中文| 午夜精品一区二区三区免费视频| 欧美成人一区二区| 91在线精品秘密一区二区| 亚洲成人你懂的| 久久综合久久鬼色中文字| www.性欧美| 亚洲成人av一区二区三区| 欧美va在线播放| av在线一区二区| 日韩精品一二三| 中文字幕欧美国产| 欧美日韩一区成人| 国产黑丝在线一区二区三区| 亚洲三级在线观看| 精品国内片67194| 91免费在线看| 国产综合久久久久影院| 夜夜揉揉日日人人青青一国产精品| 欧美一级午夜免费电影| 99精品国产91久久久久久| 美女诱惑一区二区| 亚洲免费观看在线视频| 精品国产一区二区三区不卡| 色噜噜狠狠色综合中国| 国产乱一区二区| 亚洲v中文字幕| 国产精品嫩草99a| 日韩欧美激情四射| 欧美午夜精品免费| jizzjizzjizz欧美| 韩国视频一区二区| 日韩不卡免费视频| 亚洲精选免费视频| 欧美国产欧美综合| 精品国产一区二区三区av性色| 91网页版在线| 成人涩涩免费视频| 韩国精品在线观看| 日本欧美肥老太交大片| 亚洲综合色噜噜狠狠| 国产精品卡一卡二| 国产日韩欧美综合一区| 精品国产一区a| 日韩欧美综合在线| 制服.丝袜.亚洲.中文.综合| 91亚洲精品乱码久久久久久蜜桃| 国产成人在线视频网址| 久久福利资源站| 日日夜夜一区二区| 婷婷开心激情综合| 亚洲成av人片在线| 亚洲成国产人片在线观看| 亚洲最快最全在线视频| 亚洲欧美视频在线观看视频| 成人免费在线视频| 亚洲色图视频网站| 亚洲精品免费在线观看| 亚洲色图欧洲色图| 亚洲欧美电影院| 亚洲免费资源在线播放| 亚洲精品国产成人久久av盗摄| 亚洲欧洲精品一区二区三区| 亚洲欧美中日韩| 亚洲麻豆国产自偷在线| 亚洲人妖av一区二区| 亚洲黄色免费电影| 亚洲国产精品久久人人爱蜜臀| 亚洲福利一区二区三区| 亚洲成a天堂v人片| 免费成人在线视频观看| 精品制服美女久久| 国产精品123区| 成a人片国产精品| 色综合一区二区| 欧美日韩一区二区三区在线看| 欧美美女bb生活片| 欧美变态tickle挠乳网站| 久久影音资源网| 亚洲欧美色图小说| 亚洲va国产天堂va久久en| 美女视频网站久久| 国产91丝袜在线播放九色| 色猫猫国产区一区二在线视频| 欧美视频你懂的| 精品福利一区二区三区免费视频| 国产女主播在线一区二区| 国产精品电影一区二区| 亚洲一区二区免费视频| 美国毛片一区二区三区| 福利一区福利二区| 欧美日韩国产一区| 久久综合九色综合久久久精品综合 | 亚洲一二三区在线观看| 久久精品72免费观看| 成人黄色综合网站| 欧美精品亚洲一区二区在线播放| 久久久久久影视| 一区二区成人在线观看| 久久精品国产第一区二区三区| 成人黄色av电影| 在线播放中文字幕一区| 国产精品久久影院| 日本在线观看不卡视频| jizzjizzjizz欧美| 欧美变态tickling挠脚心| 亚洲另类色综合网站| 国产精品羞羞答答xxdd| 欧美日产国产精品| 中文字幕av一区二区三区 | 国产欧美1区2区3区| 偷窥少妇高潮呻吟av久久免费| 国产成人激情av| 制服丝袜中文字幕一区| 亚洲三级在线免费观看| 国产大片一区二区| 欧美精品久久久久久久多人混战 | 韩国精品久久久| 欧美偷拍一区二区| 亚洲国产精品高清| 精品无码三级在线观看视频| 欧美日韩一区二区不卡| 亚洲欧美色一区| 成人小视频在线| 久久综合九色综合97婷婷| 午夜精品久久久久久久| 91免费在线看| 国产精品对白交换视频 | 性欧美大战久久久久久久久| 成人性生交大片免费看中文| 精品福利一区二区三区免费视频| 日韩电影在线免费| 欧美美女视频在线观看| 亚洲午夜一二三区视频| 日本精品视频一区二区三区|