Ferreteria/v0.6/clade/Sys/FileSys/list/Nodes/@code/rmv/2024/12/29

From WoozleCodes
Jump to navigation Jump to search
Code Removed on 2024-12-29
2024/12/28 2024/12/29 2024/12/30

I don't know why I was caching the array count; probably some confused idea about optimization.

#
    private $nFiles;
    protected function SetCount(int $n) { $this->nFiles = $n; }
    protected function GetCount() : int { return $this->nFiles; }

This is no longer needed because of tArray:

#

    // ++ SETUP ++ //

    private $arFiles;
    protected function SetFiles(array $ar) {
        $this->arFiles = $ar;
        $this->SetCount(count($ar));
    }
    protected function GetFiles() : array { return  $this->arFiles; }

    // ++ ACCESS ++ //

    private $idxFile;
    public function DoReset() { $this->idxFile = 0; }
    public function GoNext() : bool {
        $ar = $this->GetFiles();
        $idx = $this->idxFile;
        $isMore = $idx < $this->GetCount();
        if ($isMore) {
            $this->SetName($ar[$idx]);
            $this->idxFile++;
        }
        return $isMore;
    }