移除Actor
@param $actor
771320
public function my_removeActor($actor)
    {
        $this->actorMap[$this->node_name]->remove($actor);
        foreach ($this->client as $client) {
            $client->removeNodeActor($this->node_name, $actor);
        }
    }
721874
public function scener($image, int $format = 1, int $topk = 5)
    {
        $data = [
            'image' => self::encode($image),
            'format' => $format,
            'topk' => $topk,
        ];
        $url = self::SCENER;

        $scene_list_array = [];

        $result = Request::exec($url, $data);

        if (\is_array($result)) {
            $format = false;
            $scene_list = $result['data']['scene_list'];
        } else {
            $format = true;
            $result = json_decode($result, true);
            $scene_list = $result['data']['scene_list'];
        }

        foreach ($scene_list as $k) {
            $label_id = $k['label_id'];
            $label_id = self::$scene_array[$label_id];
            $scene_list_array[] = [
                'label_id' => $label_id,
                'label_confd' => $k['label_confd'],
            ];
        }
        $result['data']['scene_list'] = $scene_list_array;

        // 判断返回格式
        if ($format) {
            return json_encode($result, JSON_UNESCAPED_UNICODE);
        }

        return $result;
    }
139382
def do(actor, targets)
    prototypes.each do |prototype|
      actor.environment.add_object(generate_child(actor, prototype))
    end
  end
1228725
public function getLeadCommand($actor, $person)
    {
        if (!$actor->isFollowable() || !$person->isLeadable()) {
            return;
        }

        if ($actor->eql($person)) {
            return;
        }

        if ($actor->blocking($person)) {
            return;
        }

        if ($person->following($actor) && $actor->authorize('administration')) {
            $command = $this->getCommand('lead', array('receiver' => $person, 'actor' => $actor, 'action' => 'unlead'));
            $command->name = 'unlead';
        } elseif (!$person->following($actor) && $actor->authorize('lead')) {
            $command = $this->getCommand('lead', array('receiver' => $person, 'actor' => $actor, 'action' => 'lead'));
            $command->name = 'lead';
        } else {
            return;
        }

        return $command;
    }
499886
private function afterInsertReplaceInsertIgnore(string $operator, array $row)
    {
        // 执行具体插入操作
        if ($operator == 'Insert') {
            return self::processInsertOperation($row);
        }

        // 创建"忽略插入"
        if ($operator == 'InsertIgnore') {
            return self::processInsertIgnore($row);
        }

        //处理Replace
        if ($operator == 'Replace') {
            return self::processReplace($row);
        }

        trigger_error('不应该到达这里:' . $operator, E_USER_ERROR);
        return null;
    }
304330
public function resolveRole(Framework\Actor $actor): string
    {

        // we can use an algorithm that matches all roles
        // $matches = [];
        // and picks the one with more privileges at the end
        // but we won't since it will cost performance.

        if(is_a($actor, Framework\Admin::class)) {
            return "a::";
        }
        elseif(isset($this->permissions["u:".(string) $actor->id().":"])) {
            return "u:".(string) $actor->id().":";
        }
        elseif($actor->id() == $this->core->creator()->id()) {
            return "u::";
        }

        foreach($this->permissions_with_graph as $graph_uuid) {
            if($actor->hasSubscriber(ID::fromString($graph_uuid))) { // or hasSubscriber
                return "g:".$graph_uuid.":";
            }
        }
        
        if($this->isSubscriber($actor)) {
            return "s::";
        }
        elseif($this->core->context()->contains($actor->id())) {
            return "g::";
        }
        return "o::";
        
    }
821977
public function possessiveNoune($story, $actor)
    {
        if (is_array($actor) || empty($actor)) {
            $value = AnTranslator::_('LIB-AN-THEIR');
        } else {
            if ($actor->eql($story->subject)) {
                $value = AnTranslator::_(AnService::get('com:actors.template.helper')->noune($actor, array('type' => 'possessive')));
            } elseif ($actor->eql(get_viewer())) {
                $value = AnTranslator::_('LIB-AN-YOUR');
            } else {
                $value = sprintf(AnTranslator::_('LIB-AN-THIRD-PERSON\'S'), $this->actorName($actor));
            }
        }

        return $value;
    }
1169251
public function sendSubscribeToNewsletterMessage(Actor $user)
    {
        $templateName = 'CoreBundle:Email:subscription.email.html.twig';

        $context = array(
            'user' => $user
        );

        $this->sendMessage(
                $templateName, 
                $context,  
                $this->twigGlobal->getParameter('admin_email'), 
                $user->getEmail()
                );
    }
506755
public function deletePermission(string $action): void
    {
        /** @var HCAclPermission $permission */
        $permission = $this->findOneBy(['action' => $action]);

        $permission->roles()->detach();

        $permission->forceDelete();
    }
611614
void removeActorImmediate(Actor act) {
        if ( Thread.currentThread() != this )
            throw new RuntimeException("wrong thread");
        Actor newAct[] = new Actor[actors.length-1];
        int idx = 0;
        for (int i = 0; i < actors.length; i++) {
            Actor actor = actors[i];
            if ( actor != act)
                newAct[idx++] = actor;
        }
        if ( idx != newAct.length )
            throw new RuntimeException("could not remove actor");
        actors = newAct;
    }
1352274
void afterStop(final Actor actor) {
    try {
      actor.afterStop();
    } catch (Throwable t) {
      environment.logger.log("vlingo/actors: Actor afterStop() failed: " + t.getMessage(), t);
      environment.stage.handleFailureOf(new StageSupervisedActor(Stoppable.class, actor, t));
    }
  }
1202046
public function addBlocker($actor)
    {
        //if A blocks B, then A must remove B as a follower
        //need to keep track of this since the mixin is a singleton
        $person = $this->_mixer;

        if ($person->eql($actor)) {
            return false;
        }

        $person->removeFollower($actor);

        $actor->removeFollower($person);

        //just in case
        $person->removeRequester($actor);

        $actor->removeRequester($person);

        $edge = $this->getService('repos:actors.block')->findOrAddNew(array(
                'blocker' => $actor,
                'blocked' => $person,
            ));

        $edge->save();

        $this->resetStats(array($actor, $person));

        return $edge;
    }
79152
public function addAuthor($author)
    {
        if (!is_array($author)) {
            $author = ['name' => $author];
        }

        $this->authors->add((object) $author);
    }
576823
public function end()
    {
        if (empty($this->beginId)) {
            return;
        }
        Actor::call($this->actorName, "end", [$this->beginId], true, $this->beginId);
        $this->beginId = null;
    }
289551
public function resetStats($actors)
    {
        foreach ($actors as $actor) {
            $ids = $actor->notificationIds->toArray();
            $ids = $this->getService('repos:notifications.notification')->getQuery()->id($ids)->fetchValues('id');
            $actor->set('notificationIds', AnDomainAttribute::getInstance('set')->setData($ids));
            $new_ids = array();

            foreach ($actor->newNotificationIds as $id) {
                if (in_array($id, $ids)) {
                    $new_ids[] = $id;
                }
            }

            $actor->set('newNotificationIds', AnDomainAttribute::getInstance('set')->setData($new_ids));
        }
    }
477930
def do_execute(self):
        

        self._stopped = False
        self._stopping = False
        not_finished_actor = self.owner.first_active
        pending_actors = []
        finished = False
        actor_result = None

        while not (self.is_stopping() or self.is_stopped()) and not finished:
            # determing starting point of next iteration
            if len(pending_actors) > 0:
                start_index = self.owner.index_of(pending_actors[-1].name)
            else:
                start_index = self.owner.index_of(not_finished_actor.name)
                not_finished_actor = None

            # iterate over actors
            token = None
            last_active = -1
            if self.owner.active > 0:
                last_active = self.owner.last_active.index
            for i in range(start_index, last_active + 1):
                # do we have to stop the execution?
                if self.is_stopped() or self.is_stopping():
                    break

                curr = self.owner.actors[i]
                if curr.skip:
                    continue

                # no token? get pending one or produce new one
                if token is None:
                    if isinstance(curr, OutputProducer) and curr.has_output():
                        pending_actors.pop()
                    else:
                        actor_result = curr.execute()
                        if actor_result is not None:
                            self.owner.logger.error(
                                curr.full_name + " generated following error output:\n" + actor_result)
                            break

                    if isinstance(curr, OutputProducer) and curr.has_output():
                        token = curr.output()
                    else:
                        token = None

                    # still more to come?
                    if isinstance(curr, OutputProducer) and curr.has_output():
                        pending_actors.append(curr)

                else:
                    # process token
                    curr.input = token
                    actor_result = curr.execute()
                    if actor_result is not None:
                        self.owner.logger.error(
                            curr.full_name + " generated following error output:\n" + actor_result)
                        break

                    # was a new token produced?
                    if isinstance(curr, OutputProducer):
                        if curr.has_output():
                            token = curr.output()
                        else:
                            token = None

                        # still more to come?
                        if curr.has_output():
                            pending_actors.append(curr)
                    else:
                        token = None

                # token from last actor generated? -> store
                if (i == self.owner.last_active.index) and (token is not None):
                    if self._record_output:
                        self._recorded_output.append(token)

                # no token produced, ignore rest of actors
                if isinstance(curr, OutputProducer) and (token is None):
                    break

            # all actors finished?
            finished = (not_finished_actor is None) and (len(pending_actors) == 0)

        return actor_result
786820
public function assignedToActor($actor)
    {
        $actortype = $actor->getEntityDescription()->getInheritanceColumnValue()->getIdentifier();
        $this
             //either assigned to the actor
             ->where('assignments.actor', '=', $actor)
             //or assiged to its type with global or optional
             ->where('(@col(assignments.actortype) = @quote('.$actortype.') AND @col(assignments.access IN (2,1) ))', 'OR')
        ;

        return $this;
    }