当前位置: 首页>>代码示例>>PHP>>正文


PHP Variable::setValue方法代码示例

本文整理汇总了PHP中Variable::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::setValue方法的具体用法?PHP Variable::setValue怎么用?PHP Variable::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Variable的用法示例。


在下文中一共展示了Variable::setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: query

 public function query($relation, array $instances)
 {
     $term = term($relation);
     $letters = up_letter_gen();
     $to_project = array();
     foreach ($instances as $i) {
         if (strcmp($i, '?') == 0) {
             $to_project[] = $letters->current();
             $term->addVariableByName($letters->current());
         } else {
             $v = new Variable($letters->current());
             $v->setValue($i);
             $term->addVariable($v);
         }
         $letters->next();
     }
     // all variables have value, no need to generate/iterate candidates
     if ($term->readyForResolve()) {
         return $this->isTrue($relation, $term->getInstances());
     }
     /* ---------Have to fill the variables with a candidate value ----------- */
     try {
         if ($this->isRule($relation)) {
             $candidates = $this->instance_generator_for_rule($term);
         } else {
             $candidates = $this->instance_generator_for_fact($term);
         }
     } catch (Exception $e) {
         echo "no candidates for: \n";
         echo "  " . $term->toString() . "\n";
         return array();
     }
     //foreach($candidates as $i) print_r($i);
     $candidate_table = $this->getRelationTable($term->arity());
     foreach ($candidates as $_instances) {
         if ($this->isTrue($relation, $_instances)) {
             $candidate_table->insert_row_array($_instances, TRUE);
         }
     }
     return $candidate_table->project($to_project)->tuples();
 }
开发者ID:318io,项目名称:318-io,代码行数:41,代码来源:reasoner.php

示例2: setVariable

 public function setVariable()
 {
     try {
         if (fRequest::get('remove', 'boolean')) {
             $variable = new Variable(fRequest::get('name'));
             $variable->delete();
             fMessaging::create('success', 'Variable removed successfully.');
         } else {
             try {
                 $variable = new Variable(fRequest::get('name'));
             } catch (fNotFoundException $e) {
                 $variable = new Variable();
                 $variable->setName(fRequest::get('name'));
             }
             $variable->setValue(fRequest::get('value'));
             $variable->store();
             fMessaging::create('success', 'Variable set successfully.');
         }
     } catch (fException $e) {
         fMessaging::create('error', $e->getMessage());
     }
     fURL::redirect(Util::getReferer());
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:23,代码来源:DashboardController.php


注:本文中的Variable::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。