Validates the product equation.
    * Validates the feature order
    * Validates the product spec (mandatory functional features)
    :param poi: optional product of interest
3211
def validate_product_equation(poi=None):
    
    from . import utils
    from . import validators

    container_dir, product_name = tasks.get_poi_tuple(poi=poi)
    feature_list = utils.get_features_from_equation(container_dir, product_name)
    ordering_constraints = utils.get_feature_order_constraints(container_dir)
    spec_path = utils.get_feature_ide_paths(container_dir, product_name).product_spec_path

    print('*** Starting product.equation validation')

    # --------------------------------------------------------
    # Validate the feature order
    print('\tChecking feature order')

    feature_order_validator = validators.FeatureOrderValidator(feature_list, ordering_constraints)
    feature_order_validator.check_order()

    if feature_order_validator.has_errors():
        print('\t\txxx ERROR in your product.equation feature order xxx')
        for error in feature_order_validator.get_violations():
            print('\t\t\t', error[1])
    else:
        print('\t\tOK')

    # --------------------------------------------------------
    # Validate the functional product specification
    print('\tChecking functional product spec')

    if not os.path.exists(spec_path):

        print(
            '\t\tSkipped - No product spec exists.\n'
            '\t\tYou may create a product spec if you want to ensure that\n'
            '\t\trequired functional features are represented in the product equation\n'
            '\t\t=> Create spec file featuremodel/productline/<container>/product_spec.json'
        )
        return

    spec_validator = validators.ProductSpecValidator(spec_path, product_name, feature_list)
    if not spec_validator.is_valid():
        if spec_validator.get_errors_mandatory():
            print('\t\tERROR: The following feature are missing', spec_validator.get_errors_mandatory())
        if spec_validator.get_errors_never():
            print('\t\tERROR: The following feature are not allowed', spec_validator.get_errors_never())
    else:
        print('\t\tOK')

    if feature_order_validator.has_errors() or spec_validator.has_errors():
        sys.exit(1)
980206
public static <S extends Solution<?>> void productOfObjectives(List<S> solutionsList) {
    for (S solution : solutionsList) {
      double product = solution.getObjective(0);
      for (int i = 1; i < solution.getNumberOfObjectives(); i++) {
        product *= solution.getObjective(i);
      }
      setScalarizationValue(solution, product);
    }
  }
1076989
def _validate_arguments(self):
        
        if self._has_terms():
            [term._validate_arguments() for term in self._terms]
        return self
1226496
def validate(self, instance, value):
        
        if not isinstance(value, (tuple, list, np.ndarray)):
            self.error(instance, value)
        if isinstance(value, (tuple, list)):
            for i, val in enumerate(value):
                if isinstance(val, string_types):
                    if val.upper() not in VECTOR_DIRECTIONS:
                        self.error(
                            instance=instance,
                            value=val,
                            extra='This is an invalid Vector3 representation.',
                        )
                    value[i] = VECTOR_DIRECTIONS[val.upper()]

        return super(Vector3Array, self).validate(instance, value)
1353277
def select_product():
    
    global _product_selected
    if _product_selected:
        # tss already bound ... ignore
        return

    _product_selected = True
    from django_productline import context, template

    featuremonkey.add_import_guard('django.conf')
    featuremonkey.add_import_guard('django.db')
    os.environ['DJANGO_SETTINGS_MODULE'] = 'django_productline.settings'
    contextfile = os.environ['PRODUCT_CONTEXT_FILENAME']
    equationfile = os.environ['PRODUCT_EQUATION_FILENAME']


    #bind context and compose features
    context.bind_context(contextfile)
    get_composer().select_equation(equationfile)

    # after composition we are now able to bind composed template settings
    template.bind_settings()

    featuremonkey.remove_import_guard('django.conf')
    featuremonkey.remove_import_guard('django.db')

    import django
    if compare_version(django.get_version(), '1.7') >= 0:
        django.setup()
    # force import of settings and urls
    # better fail during initialization than on the first request
    from django.conf import settings
    from django.core.urlresolvers import get_resolver
    # eager creation of URLResolver
    get_resolver(None)

    # make sure overextends tag is registered
    from django.template.loader import get_template
    from overextends import models
617490
def _validate_arguments(self):
        
        super(SplineTerm, self)._validate_arguments()

        if self.basis not in self._bases:
            raise ValueError("basis must be one of {}, "\
                             "but found: {}".format(self._bases, self.basis))

        # n_splines
        self.n_splines = check_param(self.n_splines, param_name='n_splines',
                                     dtype='int', constraint='>= 0')

        # spline_order
        self.spline_order = check_param(self.spline_order,
                                        param_name='spline_order',
                                        dtype='int', constraint='>= 0')

        # n_splines + spline_order
        if not self.n_splines > self.spline_order:
            raise ValueError('n_splines must be > spline_order. '\
                             'found: n_splines = {} and spline_order = {}'\
                             .format(self.n_splines, self.spline_order))

        # by
        if self.by is not None:
            self.by = check_param(self.by,
                                  param_name='by',
                                  dtype='int', constraint='>= 0')

        return self
956865
def validate(self, val):
        

        if self.nullable and val is None:
            return
        type_er = self.__type_check(val)
        if type_er:
            return type_er

        spec_err = self._specific_validation(val)
        if spec_err:
            return spec_err
830024
def _validate_order(self, order):
        """"""

        try:
            order = int(order)
        except ValueError as e:
            raise TypeError('MOC order must be convertable to int')

        if not 0 <= order <= MAX_ORDER:
            raise ValueError(
                'MOC order must be in range 0-{0}'.format(MAX_ORDER))

        return order
1265250
private void validateCoefficients() {
        if (coefsValid)
            return;

        if (n >= 2) {
            double xBar = (double) sumX / n;
            double yBar = (double) sumY / n;

            a1 = (double) ((n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX));
            a0 = (double) (yBar - a1 * xBar);
        } else {
            a0 = a1 = Double.NaN;
        }

        coefsValid = true;
    }
694076
def __validate1 (property):
    
    assert isinstance(property, Property)
    msg = None

    if not property.feature.free:
        feature.validate_value_string (property.feature, property.value)
771196
private Point makePointValid(Point point) {
        CoordinateSequence sequence = point.getCoordinateSequence();
        GeometryFactory factory = point.getFactory();
        CoordinateSequenceFactory csFactory = factory.getCoordinateSequenceFactory();
        if (sequence.size() == 0) {
            return point;
        } else if (Double.isNaN(sequence.getOrdinate(0, 0)) || Double.isNaN(sequence.getOrdinate(0, 1))) {
            return factory.createPoint(csFactory.create(0, sequence.getDimension()));
        } else if (sequence.size() == 1) {
            return point;
        } else {
            throw new RuntimeException("JTS cannot create a point from a CoordinateSequence containing several points");
        }
    }
819594
def is_valid(self):
        
        for spec in self.product_specs:

            for feature in spec.get('mandatory', []):
                if feature.replace('__', '.') not in self.feature_list:
                    self.errors_mandatory.append(feature)

            for feature in spec.get('never', []):
                if feature.replace('__', '.') in self.feature_list:
                    self.errors_never.append(feature)

        return not self.has_errors()
1109121
public function validate($order, Constraint $constraint): void
    {
        /** @var OrderInterface $order */
        Assert::isInstanceOf($order, OrderInterface::class);

        /** @var OrderProductEligibility $constraint */
        Assert::isInstanceOf($constraint, OrderProductEligibility::class);

        /** @var OrderItemInterface[] $orderItems */
        $orderItems = $order->getItems();

        foreach ($orderItems as $orderItem) {
            if (!$orderItem->getProduct()->isEnabled()) {
                $this->context->addViolation(
                    $constraint->message,
                    ['%productName%' => $orderItem->getProduct()->getName()]
                );
            }
        }
    }
1150426
@Koan
    public void makeTheProductOfIAndJ(){
        int i = 10;
        int j = 5;
        int product = 0;

        /* (@_@) */
        product = i * j;
        /* (^_^) */

        assertThat(product, is(50));
    }
423602
def error_value
      if poi_cell.cell_type == CELL_TYPE_ERROR
        error_value_from(poi_cell.error_cell_value)
      elsif poi_cell.cell_type == CELL_TYPE_FORMULA && 
            poi_cell.cached_formula_result_type == CELL_TYPE_ERROR
            
        cell_value = formula_evaluator.evaluate(poi_cell)
        cell_value && error_value_from(cell_value.error_value)
      else
        nil
      end
    end
48761
protected function validateAttributeProduct()
    {
        $fields = $this->getSubmitted('product_fields.attribute');

        if (empty($fields)) {
            return null;
        }

        $attributes = $this->getSubmitted('field.attribute');

        $errors = 0;

        foreach ($fields as $field_id => $field) {
            if (!empty($field['required']) && empty($attributes[$field_id])) {
                $this->setErrorRequired("attribute.$field_id", $field['title']);
                $errors++;
            }
        }

        return empty($errors);
    }
1298509
protected boolean validOutcome(String outcome, Sequence sequence) {
    String prevOutcome = null;
    List tagList = sequence.getOutcomes();
    int lti = tagList.size() - 1;
    if (lti >= 0) {
      prevOutcome = (String) tagList.get(lti);
    }
    return validOutcome(outcome,prevOutcome);
  }