Constraint string
431279
def constraint(self):
        """"""
        constraint_arr = []
        if self._not_null:
            constraint_arr.append("PRIMARY KEY" if self._pk else "NOT NULL")
        if self._unique:
            constraint_arr.append("UNIQUE")

        return " ".join(constraint_arr)
627167
def drop_constraints(quiet=True, stdout=None):
    

    results, meta = db.cypher_query("CALL db.constraints()")
    pattern = re.compile(':(.*) \).*\.(\w*)')
    for constraint in results:
        db.cypher_query('DROP ' + constraint[0])
        match = pattern.search(constraint[0])
        stdout.write(''' - Droping unique constraint and index on label {0} with property {1}.\n'''.format(
            match.group(1), match.group(2)))
    stdout.write("\n")
692060
def indicator_constraints(self,x):
        
        x = np.atleast_2d(x)
        I_x = np.ones((x.shape[0],1))
        if self.constraints is not None:
            for d in self.constraints:
                try:
                    exec('constraint = lambda x:' + d['constraint'], globals())
                    ind_x = (constraint(x) <= 0) * 1
                    I_x *= ind_x.reshape(x.shape[0],1)
                except:
                    print('Fail to compile the constraint: ' + str(d))
                    raise
        return I_x
66327
function Constraint(constraintName, constraintPayload) {
	var name = constraintName;
	var payload = constraintPayload;

	/**
	 * The constraint name.
	 * @returns {String} a name
	 */
	this.getName = function () {
		return name;
	};

	/**
	 * Sets the name of the constraint.
	 * @param {String} n name
	 */
	this.setName = function (n) {
		name = n;
	};

	/**
	 * The payload (a map)
	 * @returns {Object} an object
	 */
	this.getPayload = function () {
		return payload;
	};

	/**
	 * Sets the payload.
	 * @param {Object} p the payload object
	 */
	this.setPayload = function (p) {
		payload = p;
	};
}
520689
def _constraint(self, params):
        
        if (params["spin1x"]**2 + params["spin1y"]**2 +
                params["spin1z"]**2)**2 > 1:
            return False
        elif (params["spin2x"]**2 + params["spin2y"]**2 +
                  params["spin2z"]**2)**2 > 1:
            return False
        else:
            return True
1281478
public Constraint regexp(String regexp, String type) {
        RegexpConstraint c = new RegexpConstraint(regexp);
        c.setType(type);
        return c;
    }
303457
def store_constraint(constr)
      # Update the constraint to track the index in the model
      index = LPSolve.get_Nrows(@ptr)
      constr.model = self
      constr.index = index
      constr.freeze
      @constr_count += 1

      # Set constraint properties
      if constr.name
        ret = LPSolve.set_row_name(@ptr, index, constr.name)
        fail if ret != 1
      end

      # Determine the correct constant for the type of constraint
      case constr.sense
      when :==
        type = LPSolve::EQ
      when :>=
        type = LPSolve::GE
      when :<=
        type = LPSolve::LE
      end

      store_constraint_matrix constr, type
      @constraints << constr
    end
135603
def replace_constraint(self,name,**kwargs):
        

        for pop in self.poplist:
            pop.replace_constraint(name,**kwargs)
        if name not in self.constraints:
            self.constraints.append(name)
740525
int getConstraintIndex(String constraintName) {

        for (int i = 0, size = constraintList.length; i < size; i++) {
            if (constraintList[i].getName().name.equals(constraintName)) {
                return i;
            }
        }

        return -1;
    }
301946
def in_constraint(self, node1, node2):
        """"""
        constraint = constraint_table[node2]
        if constraint == 0b0:
            return False

        try:
            value = self.el2bv[node1]
        except KeyError:
            return False

        return constraint & value != 0
1136245
private void positionalConstraints(PatternDescrBuilder<?> pattern) throws RecognitionException {
        constraint(pattern,
                true,
                "");
        if (state.failed)
            return;

        while (input.LA(1) == DRL6Lexer.COMMA) {
            match(input,
                    DRL6Lexer.COMMA,
                    null,
                    null,
                    DroolsEditorType.SYMBOL);
            if (state.failed)
                return;

            constraint(pattern,
                    true,
                    "");
            if (state.failed)
                return;
        }

        match(input,
                DRL6Lexer.SEMICOLON,
                null,
                null,
                DroolsEditorType.SYMBOL);
        if (state.failed)
            return;
    }
1346285
private String buildConstraintExpr(String device_name, String attribute, String event_name, String[] filters) {
        String str =
                "$domain_name == \'" + device_name.toLowerCase() + "/" +
                        attribute.toLowerCase() + "\'" + " and $event_name == \'" +
                        event_name + "\'";
        if (filters != null && filters.length != 0) {
            str += " and ((";
            for (String filter : filters)
                str += filter;
            str += " ) and $forced_event > 0.5 )";
        }
        return str;
    }
4443
function constrain(value, max, size) {
          if (value < 0) {
            return 0;
          }

          if (value + size > max) {
            value = max - size;
            return value < 0 ? 0 : value;
          }

          return value;
        }
991728
public function toString()
    {
        $constraints = [];
        foreach ($this->constraints as $name=>$constraint) {
            $constraints[] = "$constraint";
        }
        return implode($this->toStringSeparator, $constraints);
    }
1164060
def add_constraints(constrs)
      ret = LPSolve.resize_lp(@ptr, @constraints.length + constrs.length,
                              @variables.length)
      fail if ret != 1

      constrs.each { |constr| store_constraint constr }
    end
860364
def store_constraint(constr)
      # Update the constraint to track the index in the model
      constr.model = self

      # Set constraint properties
      Cbc.Cbc_setRowName(@ptr, constr.index, constr.name) unless constr.name.nil?
      store_constraint_bounds constr.index, constr.sense, constr.rhs
    end
1047546
def add_constraints(constrs)
      start, index, value = build_constraint_matrix constrs
      start_buffer = build_pointer_array start, :int
      index_buffer = build_pointer_array index, :int
      value_buffer = build_pointer_array value, :double

      Cbc.Cbc_loadProblem @ptr, @variables.length, constrs.length,
                          start_buffer, index_buffer, value_buffer,
                          nil, nil, nil, nil, nil

      store_model constrs, @variables
    end