mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
changed pathfinder(hopefully one last time)
This commit is contained in:
parent
8c12e0de26
commit
e11c40f645
28 changed files with 401 additions and 416 deletions
40
src/astarnavigator/ArrayList.php
Normal file
40
src/astarnavigator/ArrayList.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
class ArrayList{
|
||||
public $arr = [];
|
||||
public function add(IElement $e){
|
||||
$this->arr[$e->__toString()] = $e;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addAll($es){
|
||||
foreach($es as $e){
|
||||
$this->add($this->add($e));
|
||||
}
|
||||
}
|
||||
|
||||
public function getFirst(){
|
||||
return array_values($this->arr)[0];
|
||||
}
|
||||
|
||||
public function remove(IElement $e){
|
||||
unset($this->arr[$e->__toString()]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __isset($e){
|
||||
return isset($this->arr[$e->__toString()]);
|
||||
}
|
||||
|
||||
public function has(IElement $e){
|
||||
return isset($this->arr[$e->__toString()]);
|
||||
}
|
||||
|
||||
public function sortWith($func){
|
||||
return uasort($this->arr, $func);
|
||||
}
|
||||
|
||||
public function countElements(){
|
||||
return count($this->arr);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue