Short description of method operatorEval

@access public
@author firstname and lastname of author, <author@example.org>
@param  Container firstPart
@param  Container secondPart
@return boolean
17532
public function operatorEval( core_kernel_classes_Container $firstPart,  core_kernel_classes_Container $secondPart)
    {
        $returnValue = (bool) false;

        
        if ($firstPart instanceof core_kernel_classes_Resource ) {
        	$firstPart = new core_kernel_classes_Literal($firstPart->getUri());
		}
        if ($secondPart instanceof core_kernel_classes_Resource ) {
       		$secondPart = new core_kernel_classes_Literal($secondPart->getUri());
        }
        common_Logger::d('First Value : '. $firstPart->literal, array('Generis Expression'));
        common_Logger::d('Second Value : '. $secondPart->literal, array('Generis Expression'));
        common_Logger::d('Operator : '. $this->getLogicalOperator()->getLabel(), array('Generis Expression'));
        
        switch($this->getLogicalOperator()->getUri()) {
			case RulesRdf::INSTANCE_EQUALS_OPERATOR_URI : {
				$returnValue = $this->evalEquals($firstPart,$secondPart);
				break;
			}
			case RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI : {
				$returnValue = $this->evalDifferent($firstPart,$secondPart);
				break;
			}

			case RulesRdf::INSTANCE_SUP_EQ_OPERATOR_URI : {
				$returnValue = $this->evalSupEquals($firstPart,$secondPart);
				break;
			}
			case RulesRdf::INSTANCE_INF_EQ_OPERATOR_URI : {
				$returnValue = $this->evalInfEquals($firstPart,$secondPart);
				break;
			}
			case RulesRdf::INSTANCE_SUP_OPERATOR_URI : {
				$returnValue = $this->evalSup($firstPart,$secondPart);				
				break;			
			}
			case RulesRdf::INSTANCE_INF_OPERATOR_URI : {
				$returnValue = $this->evalInf($firstPart,$secondPart);
				break;
			}
			
			default: {
				var_dump($this);
				throw new common_Exception('Expression ' . $this->getLabel() . ' do not have knowm operator');
			}
		}
		
		$logValue = $returnValue ? ' TRUE ' : ' FALSE ';
		common_Logger::d('Expression Value : '. $logValue, array('Generis Expression'));
        

        return (bool) $returnValue;
    }
1058343
private static String validateOperator(final String operator) {
        if (!OPERATORS.contains(operator) && !BOOLEAN_OPERATORS.contains(operator)) {
            throw new CitrusRuntimeException("Unknown operator '" + operator + "'");
        }
        return operator;
    }
1140323
public function whereColumn($first, $operator = null, $second = null, $boolean = 'and')
    {
        // If the column is an array, we will assume it is an array of key-value pairs
        // and can add them each as a where clause. We will maintain the boolean we
        // received when the method was called and pass it into the nested where.
        if (is_array($first)) {
            return $this->addArrayOfWheres($first, $boolean, 'whereColumn');
        }

        // If the given operator is not found in the list of valid operators we will
        // assume that the developer is just short-cutting the '=' operators and
        // we will set the operators to '=' and set the values appropriately.
        if ($this->invalidOperator($operator)) {
            list($second, $operator) = [$operator, '='];
        }

        // Finally, we will add this where clause into this array of clauses that we
        // are building for the query. All of them will be compiled via a grammar
        // once the query is about to be executed and run against the database.
        $type = 'Column';

        $this->wheres[] = compact(
            'type',
            'first',
            'operator',
            'second',
            'boolean'
        );

        return $this;
    }
449697
protected function create_proposition( $parent_name, $operator = null, $check_value = null ) {
		list( $operator, $check_value ) = $this->normalize_proposition( $operator, $check_value );

		// Allow check value can be a reference value of a variable in the context.
		// This can be done with: ['some-check', '!=', '@another-check'].
		if ( is_string( $check_value ) && 0 === strpos( $check_value, '@' ) ) {
			$check_value = $this->new_variable( substr( $check_value, 1 ) );
		}

		$vars = $this->new_variable( $parent_name );

		// The "is_" operator can not have check value.
		if ( 0 === strpos( $operator, 'is_' ) ) {
			return $vars->{$operator}();
		}

		return $vars->{$operator}( $check_value );
	}
531631
protected function operatorForWhere($key, $operator = null, $value = null)
    {
        if (func_num_args() === 1) {
            $value = true;

            $operator = '=';
        }

        if (func_num_args() === 2) {
            $value = $operator;

            $operator = '=';
        }

        return function ($item) use ($key, $operator, $value) {
            $retrieved = data_get($item, $key);

            $strings = array_filter([$retrieved, $value], function ($value) {
                return is_string($value) || (is_object($value) && method_exists($value, '__toString'));
            });

            if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) {
                return in_array($operator, ['!=', '<>', '!==']);
            }

            switch ($operator) {
                default:
                case '=':
                case '==':  return $retrieved == $value;
                case '!=':
                case '<>':  return $retrieved != $value;
                case '<':   return $retrieved < $value;
                case '>':   return $retrieved > $value;
                case '<=':  return $retrieved <= $value;
                case '>=':  return $retrieved >= $value;
                case '===': return $retrieved === $value;
                case '!==': return $retrieved !== $value;
            }
        };
    }
668538
public function where($key, $operator, $value = null)
    {
        if (func_num_args() == 2) {
            $value = $operator;

            $operator = '=';
        }

        return $this->filter($this->operatorForWhere($key, $operator, $value));
    }
637286
public int evaluate(FieldContainer container)
   {
      //
      // First step - determine the list of criteria we are should use
      //
      List<GraphicalIndicatorCriteria> criteria;
      if (container instanceof Task)
      {
         Task task = (Task) container;
         if (NumberHelper.getInt(task.getUniqueID()) == 0)
         {
            if (m_projectSummaryInheritsFromSummaryRows == false)
            {
               criteria = m_projectSummaryCriteria;
            }
            else
            {
               if (m_summaryRowsInheritFromNonSummaryRows == false)
               {
                  criteria = m_summaryRowCriteria;
               }
               else
               {
                  criteria = m_nonSummaryRowCriteria;
               }
            }
         }
         else
         {
            if (task.getSummary() == true)
            {
               if (m_summaryRowsInheritFromNonSummaryRows == false)
               {
                  criteria = m_summaryRowCriteria;
               }
               else
               {
                  criteria = m_nonSummaryRowCriteria;
               }
            }
            else
            {
               criteria = m_nonSummaryRowCriteria;
            }
         }
      }
      else
      {
         // It is possible to have a resource summary row, but at the moment
         // I can't see how you can determine this.
         criteria = m_nonSummaryRowCriteria;
      }

      //
      // Now we have the criteria, evaluate each one until we get a result
      //
      int result = -1;
      for (GraphicalIndicatorCriteria gic : criteria)
      {
         result = gic.evaluate(container);
         if (result != -1)
         {
            break;
         }
      }

      //
      // If we still don't have a result at the end, return the
      // default value, which is 0
      //
      if (result == -1)
      {
         result = 0;
      }

      return (result);
   }
308928
public function evalEquals( core_kernel_classes_Literal $first,  core_kernel_classes_Literal $second)
    {
        $returnValue = (bool) false;

        
        if($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal)  {
    		$returnValue = $first->literal == $second->literal;
        }
        

        return (bool) $returnValue;
    }
561435
function(map, how, where) {
                        var cid = can.cid(map),
                            firstSerialize = false;
                        if (!serializeMap) {
                            firstSerialize = true;
                            // Serialize might call .attr() so we need to keep different map 
                            serializeMap = {
                                attr: {},
                                serialize: {}
                            };
                        }
                        serializeMap[how][cid] = where;
                        // Go through each property.
                        map.each(function(val, name) {
                            // If the value is an `object`, and has an `attrs` or `serialize` function.
                            var result,
                                isObservable = Map.helpers.isObservable(val),
                                serialized = isObservable && serializeMap[how][can.cid(val)];
                            if (serialized) {
                                result = serialized;
                            } else {
                                if (how === "serialize") {
                                    result = Map.helpers._serialize(map, name, val);
                                } else {
                                    result = Map.helpers._getValue(map, name, val, how);
                                }
                            }
                            // this is probably removable
                            if (result !== undefined) {
                                where[name] = result;
                            }
                        });

                        can.__reading(map, '__keys');
                        if (firstSerialize) {
                            serializeMap = null;
                        }
                        return where;
                    }
568247
private boolean isBoxingMethod(ExecutableElement method) {
    TypeElement declaringClass = ElementUtil.getDeclaringClass(method);
    // Autoboxing methods.
    if (typeUtil.isBoxedType(declaringClass.asType())) {
      String name = ElementUtil.getName(method);
      TypeMirror returnType = method.getReturnType();
      List<? extends VariableElement> params = method.getParameters();
      if (name.equals("valueOf") && params.size() == 1
          && params.get(0).asType().getKind().isPrimitive()) {
        return true;
      }
      if (params.isEmpty() && returnType.getKind().isPrimitive()
          && name.equals(TypeUtil.getName(returnType) + "Value")) {
        return true;
      }
    }
    return false;
  }
1340744
public function evalSupEquals( core_kernel_classes_Literal $first,  core_kernel_classes_Literal $second)
    {
        $returnValue = (bool) false;

        
         if($first instanceof core_kernel_classes_Literal && $second instanceof core_kernel_classes_Literal)  {
	        $returnValue = $first->literal >= $second->literal;
         }
        

        return (bool) $returnValue;
    }
31630
private void attemptPreeval(ExprNode node) {

    // Note that we need to catch RenderException because preevaluation may fail, e.g. when
    // (a) the expression uses a bidi function that needs bidiGlobalDir to be in scope, but the
    //     apiCallScope is not currently active,
    // (b) the expression uses an external function (Soy V1 syntax),
    // (c) other cases I haven't thought up.

    SoyValue preevalResult;
    try {
      preevalResult = preevalVisitor.exec(node);
    } catch (RenderException e) {
      return; // failed to preevaluate
    }
    PrimitiveNode newNode =
        InternalValueUtils.convertPrimitiveDataToExpr(
            (PrimitiveData) preevalResult, node.getSourceLocation());
    if (newNode != null) {
      node.getParent().replaceChild(node, newNode);
    }
  }
327546
@Pure /* not guaranteed pure , since toString() is invoked on the argument a*/
	@Inline("($1 + $2)")
	public static String operator_plus(Object a, String b) {
		return a + b;
	}
991309
public function where($column, $operator = null, $value = null, $boolean = 'and')
    {
        // Tratar alias do _id
        $column = ($column == 'id') ? '_id' : $column;

        // Here we will make some assumptions about the operator. If only 2 values are
        // passed to the method, we will assume that the operator is an equals sign
        // and keep going. Otherwise, we'll require the operator to be passed in.
        list($value, $operator) = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() == 2
        );

        // If the columns is actually a Closure instance, we will assume the developer
        // wants to begin a nested where statement which is wrapped in parenthesis.
        // We'll add that Closure to the query then return back out immediately.
        if ($column instanceof Closure) {
            return $this->whereNested($column, $boolean);
        }

        // If the given operator is not found in the list of valid operators we will
        // assume that the developer is just short-cutting the '=' operators and
        // we will set the operators to '=' and set the values appropriately.
        if ($this->invalidOperator($operator)) {
            list($value, $operator) = [$operator, '='];
        }

        // If the value is a Closure, it means the developer is performing an entire
        // sub-select within the query and we will need to compile the sub-select
        // within the where clause to get the appropriate query record results.
        // BRUNO-AKI
        //if ($value instanceof Closure) {
        //    return $this->whereSub($column, $operator, $value, $boolean);
        //}

        // If the value is "null", we will just assume the developer wants to add a
        // where null clause to the query. So, we will allow a short-cut here to
        // that method for convenience so the developer doesn't have to check.
        if (is_null($value)) {
            return $this->whereNull($column, $boolean, $operator !== '=');
        }

        // Now that we are working with just a simple query we can put the elements
        // in our array and add the query binding to our array of bindings that
        // will be bound to each SQL statements when it is finally executed.
        $type = 'Basic';

        $this->wheres[] = compact(
            'type', 'column', 'operator', 'value', 'boolean'
        );

        return $this;
    }
499842
static function processElementTransformationChild( $useComments, $php, $tpl, &$node,
                                                $elementTree, $elementList, &$resourceData )
    {
        $count = is_countable( $elementList ) ? count( $elementList ) : 0;
        $lastElement = null;
        $newElementList = array();
        for ( $i = 0; $i < $count; ++$i )
        {
            $element =& $elementList[$i];
            $elementType = $element[0];
            if ( $elementType == eZTemplate::TYPE_OPERATOR )
            {
                $operatorName = $element[1][0];
                $operatorParameters = array_slice( $element[1], 1 );
                if ( !isset( $tpl->Operators[$operatorName] ) )
                    return false;

                if ( is_array( $tpl->Operators[$operatorName] ) )
                {
                    $tpl->loadAndRegisterOperators( $tpl->Operators[$operatorName] );
                }
                $operatorObject =& $tpl->Operators[$operatorName];
                if ( is_object( $operatorObject ) )
                {
                    $hasTransformationSupport = false;
                    $transformParameters = false;
                    $inputAsParameter = false;
                    $knownType = 'static';
                    if ( method_exists( $operatorObject, 'operatorTemplateHints' ) )
                    {
                        $hints = $operatorObject->operatorTemplateHints();
                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['element-transformation'] ) and
                             $hints[$operatorName]['element-transformation'] )
                        {
                            $hasTransformationSupport = true;
                        }

                        if ( $hasTransformationSupport  and
                             isset( $hints[$operatorName]['element-transformation-func'] ) )
                        {
                            $transformationMethod = $hints[$operatorName]['element-transformation-func'];
                        }
                        else
                        {
                            $transformationMethod = 'templateElementTransformation';
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['transform-parameters'] ) )
                        {
                            $transformParameters = $hints[$operatorName]['transform-parameters'];
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['input-as-parameter'] ) )
                        {
                            $inputAsParameter = $hints[$operatorName]['input-as-parameter'];
                        }

                        if ( isset( $hints[$operatorName]['output'] ) and !$hints[$operatorName]['output'] )
                        {
                            $knownType = 'null';
                        }
                        else if ( isset( $hints[$operatorName]['output-type'] ) )
                        {
                            $knownType = $hints[$operatorName]['output-type'];
                        }
                    }
                    if ( $hasTransformationSupport and
                         method_exists( $operatorObject, $transformationMethod ) )
                    {
                        $resetNewElementList = false;
                        if ( $transformParameters )
                        {
                            $newParameters = array();
                            if ( $inputAsParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $newElementList, $resourceData );
                                if ( count( $newParameterElements ) > 0 or
                                     $inputAsParameter === 'always' )
                                {
                                    $newParameters[] = $newParameterElements;
                                    $resetNewElementList = true;
                                }
                            }

                            foreach ( $operatorParameters as $operatorParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $operatorParameter, $resourceData );
                                if ( !$newParameterElements )
                                    $newParameters[] = $operatorParameter;
                                else
                                    $newParameters[] = $newParameterElements;
                            }
                            $operatorParameters = $newParameters;
                        }

                        $newElements = $operatorObject->$transformationMethod( $operatorName, $node, $tpl, $resourceData,
                                                                               $element, $lastElement, $elementList, $elementTree,
                                                                               $operatorParameters );
                        if ( is_array( $newElements ) )
                        {
                            if ( $resetNewElementList )
                            {
                                $newElementList = $newElements;
                            }
                            else
                            {
                                $newElementList = array_merge( $newElementList, $newElements );
                            }
                        }
                        else
                        {
                            $newElementList[] = $element;
                        }
                    }
                    else
                    {
                        $newElementList[] = $element;
                    }
                }
                else if ( $resourceData['test-compile'] )
                {
                    $tpl->warning( '', "Operator '$operatorName' is not registered." );
                }
            }
            else
            {
                $newElementList[] = $element;
            }
            $lastElement = $element;
        }
        return $newElementList;
    }
803667
protected function evaluateOperator($value, $operator, $operand)
    {
        if ($operator === 'instanceof' && $value instanceof NodeInterface) {
            if ($this->operandIsSimpleType($operand)) {
                return $this->handleSimpleTypeOperand($operand, $value);
            } elseif ($operand === NodeInterface::class || $operand === Node::class || $operand === \Neos\ContentRepository\Domain\Model\NodeInterface::class || $operand === TraversableNodeInterface::class) {
                return true;
            } else {
                $isOfType = $value->getNodeType()->isOfType($operand[0] === '!' ? substr($operand, 1) : $operand);
                return $operand[0] === '!' ? $isOfType === false : $isOfType;
            }
        } elseif ($operator === '!instanceof' && $value instanceof NodeInterface) {
            return !$this->evaluateOperator($value, 'instanceof', $operand);
        }
        return parent::evaluateOperator($value, $operator, $operand);
    }
907635
def run_operator(operator, revision, config):
    """"""
    instance = operator.cls(config)
    logger.debug(f"Running {operator.name} operator on {revision.key}")
    return operator.name, instance.run(revision, config)