チェンジセット 1371: as3/GameAI/trunk/src/jp

差分発生行の前後
無視リスト:
コミット日時:
2008/09/24 09:35:17 (4 年前)
コミッタ:
hael
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/GameAI/trunk/src/jp/dip/hael/gameai/graph/Graph.as

    r1292 r1371  
    5050                { 
    5151                        isDigraph_ = isDigraph; 
    52                         nodes_ = []; 
    53                         edges_ = []; 
     52                        nNodes_ = 0; 
     53                        nodes_  = []; 
     54                        edges_  = []; 
    5455                } 
    5556                 
     57                 
     58                public function clear():void 
     59                { 
     60                        nNodes_ = 0; 
     61                        nodes_  = []; 
     62                        edges_  = []; 
     63                } 
    5664                 
    5765                /** 
  • as3/GameAI/trunk/src/jp/dip/hael/gameai/tree/Tree.as

    r1293 r1371  
    1111        public class Tree extends Graph 
    1212        { 
    13                 public function get rootIdx():int { return rootIdx_; } 
     13                public function get rootIndex():int { return rootIdx_; } 
    1414                 
    1515                 
    1616                 
    1717                 
    18                 public function parentIdx(idx:int):int { return (nodes_[idx] as TreeNode).parentIdx; } 
     18                public function parentIndex(index:int):int { return (nodes_[index] as TreeNode).parentIdx; } 
    1919                 
    20                 public function childNodeIdxs(idx:int):Array {  
     20                public function childNodeIndexs(index:int):Array {  
    2121                        var i:Array = []; 
    22                         var e:Array = edges_[idx]; 
     22                        var e:Array = edges_[index]; 
    2323                        for each(var e1:Edge in e){ 
    2424                                i.push(e1.dst); 
     
    2727                } 
    2828                 
    29                 public function hasChild(idx:int):Boolean { return (edges_[idx] as Array).length != 0; } 
     29                public function hasChild(index:int):Boolean { return (edges_[index] as Array).length != 0; } 
    3030                 
    3131                 
     
    3636                { 
    3737                        super(false); 
    38                         rootIdx_ = addNode(new TreeNode(0)); 
     38                        rootIdx_ = addNode(new TreeNode(-1)); 
    3939                } 
    4040                 
     
    4242                public function addChild(parentIdx:int):int 
    4343                { 
    44                         var idx:int = addNode(new TreeNode(parentIdx)); 
    45                         if(super.addEdge(new Edge(parentIdx, idx))){ 
    46                                 return idx
     44                        var added:int = addNode(new TreeNode(parentIdx)); 
     45                        if(addEdge(new Edge(parentIdx, added))){ 
     46                                return added
    4747                        }else{ 
    4848                                return -1;