public function deleteIndex($indexname) {

        $index = $this->getIndex($indexname);
        if ($index) {
            $i = $this->findIndexInArray($indexname);
            // Look for prev and next index
            $previndex = $this->getIndex($index->getPrevious());
            $nextindex = $this->getIndex($index->getNext());
            // Change their previous and next attributes
            if ($previndex) {
                $previndex->setNext($index->getNext());
            }
            if ($nextindex) {
                $nextindex->setPrevious($index->getPrevious());
            }
            // Delete the index
            unset($this->indexes[$i]);
            // Reorder the indexes
            $this->orderIndexes($this->indexes);
            // Recalculate the hash
            $this->calculateHash(true);
            // We have one deleted index, so the table has changed
            $this->setChanged(true);
        }
    }