当初はArrayを使ってデータを保存するつもりだったのですが、JSを使ってデータを構造化したことがなかったので、JSを使って試してみます。
JS の効率は非常に低く、リンクされたリストに 1,000 個のオブジェクトが含まれる場合、ブラウザの実行が遅くなります。
以前は AJAX3D には大きな可能性があると思っていましたが、普及する前に消滅してしまいそうです。 JS を使用する場合はもちろん、Delphi で開発されたゲームは遅すぎると人々は感じています。
以下は私が実装したリンクリストです:
/ *@author eric
*@mail shmilyhe@163.com
*blog.csdn.net/shmilyhe
*/
<script> <BR>関数 Student(いいえ) ,name){ <BR>this.id=no; <BR>this.scores={中国語:0,数学:0,英語:0} <BR> function List(){ <BR>this.head=null; <BR>this.curr=null; <BR>List.prototype.add=function(o){ <BR>var tem ={ob:o,next:null}; <BR>if(this.head){ <BR>this.end.next=tem; <BR>} else{ <BR> this.head=tem; <BR>this.curr=tem; <BR>} <BR>List.prototype.del=function(inde) { <BR>var n=this.head; <BR>for(var i=0;i<inde;i ){ <BR>n=n.next; <BR>n.next=n。 next.next?n .next.next:null; <BR>} <BR>List.prototype.next=function(){ <BR>var te=null; <BR> te=this.curr .ob; this.curr=this.curr.next;} <BR>return te; <BR>} <BR>List.prototype.hasnext=function(){ <BR>if(this.curr .ob!=null )return true; <BR>return false; <BR>var list=new List() <BR>for(var i=0;i<1000;i ); list.add(new Student(i,'name' i)); <BR>} <BR>var i=0; <BR>while(list.hasnext()){ <BR>document.writeln(list.next) ().name) ; <BR>if(i==10){document.writeln('<br/>'); <BR>i ; <BR> /スクリプト><BR><BR></script>