/** * * @param <array or object> $opList operation list or operation object */ public function deliver(LogootOperation $operation) { $id = $operation->getLogootPosition(); wfDebugLog('p2p', $this->clock . ' - function logootPlusEngine::deliver ' . get_class($operation) . "(" . $id . ")"); $id = $operation->getLogootPosition(); list($min, $val, $max) = $this->dichoSearch($id); if ($operation->type() == LogootOperation::INSERT && $val == NULL) { $dvis = $this->model->getCemetery($id) + 1; if ($dvis == 1) { $this->addPosition($max, $id); $this->addLine($max, $operation->getLineContent()); } else { $this->model->setCemetery($id, $dvis); } } elseif ($operation->type() == LogootOperation::DELETE) { if (isset($val)) { $this->deletePosition($val); $this->deleteLine($val); $dvis = 0; } else { $dvis = $this->model->getCemetery($id) - 1; } $this->model->setCemetery($id, $dvis); } else { wfDebugLog('p2p', $this->clock . '- ' . __METHOD__ . ' - ' . __CLASS__ . '- unkown operation !!!'); exit; } }
/** * * @param <array or object> $opList operation list or operation object */ public function deliver(LogootOperation $operation) { $id = $operation->getLogootPosition(); wfDebugLog('p2p', $this->clock . ' - function logootEngine::deliver ' . get_class($operation) . "(" . $id . ")"); list($min, $val, $max) = $this->dichoSearch($id); if ($operation instanceof LogootIns) { $this->addPosition($max, $id); $this->addLine($max, $operation->getLineContent()); } elseif ($operation instanceof LogootDel) { if (isset($val)) { $this->deletePosition($val); $this->deleteLine($val); } } else { wfDebugLog('p2p', $this->clock . '- ' . __METHOD__ . ' - ' . __CLASS__ . '- unkown operation !!!'); exit; } }