Adds a collection of literals to the solver.
@param literals the literals
540785
private void addClause(final Collection<Literal> literals) {
        for (final Literal lit : literals) {
            Integer index = this.name2idx.get(lit.variable().name());
            if (index == null) {
                index = this.name2idx.size() + 1;
                this.name2idx.put(lit.variable().name(), index);
                this.idx2name.put(index, lit.variable().name());
            }
            this.solver.addlit(lit.phase() ? index : -index);
        }
        this.solver.addlit(CLAUSE_TERMINATOR);
    }
923105
public void addWords(Collection<String> words){
		if(false == (words instanceof Set)){
			words = new HashSet<>(words);
		}
		for (String word : words) {
			addWord(word);
		}
	}
900311
public void setCiphers(java.util.Collection<Cipher> ciphers) {
        if (ciphers == null) {
            this.ciphers = null;
            return;
        }

        this.ciphers = new java.util.ArrayList<Cipher>(ciphers);
    }
987173
public void setValues(java.util.Collection<Value> values) {
        if (values == null) {
            this.values = null;
            return;
        }

        this.values = new java.util.ArrayList<Value>(values);
    }
345571
public void add(String name, String... values) {
    if (containsKey(name)) {
      List<String> list = get(name);
      for (String value: values) {
        list.add(value);
      }
    } else {
      put(name, values);
    }
  }
50862
public void add(Bounds bounds) {
        if (bounds.minX < minX) minX = bounds.minX;
        if (bounds.minY < minY) minY = bounds.minY;
        if (bounds.maxX > maxX) maxX = bounds.maxX;
        if (bounds.maxY > maxY) maxY = bounds.maxY;
    }
1148844
void updateAssumptions(final LNGIntVector assumptions) {
    assumptions.push(not(this.currentLitBlocking));
    for (int i = 0; i < this.unitLits.size(); i++)
      assumptions.push(not(this.unitLits.get(i)));
  }

  /**
   * Returns {@code true} if an encoding was created, {@code false} otherwise.
   * @return {@code true} if an encoding was created
   */
  boolean hasCreatedEncoding() {
    return this.hasEncoding;
  }

  /**
   * Encodes the pseudo-Boolean constraint
   * @param s      the solver
   * @param lits   the literals of the constraint
   * @param coeffs the coefficients of the constraints
   * @param rhs    the right hand side of the constraint
   */
  public void encode(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) {
    if (rhs == Integer.MAX_VALUE)
      throw new IllegalArgumentException("Overflow in the Encoding");
    hasEncoding = false;
    final LNGIntVector simpLits = new LNGIntVector(lits);
    final LNGIntVector simpCoeffs = new LNGIntVector(coeffs);
    lits.clear();
    coeffs.clear();
    for (int i = 0; i < simpLits.size(); i++) {
      if (simpCoeffs.get(i) <= rhs) {
        lits.push(simpLits.get(i));
        coeffs.push(simpCoeffs.get(i));
      } else
        addUnitClause(s, not(simpLits.get(i)));
    }
    if (lits.size() == 1) {
      addUnitClause(s, not(lits.get(0)));
      return;
    }
    if (lits.size() == 0)
      return;
    int n = lits.size();
    final LNGIntVector[] seqAuxiliary = new LNGIntVector[n + 1];
    for (int i = 0; i < n + 1; i++) {
      seqAuxiliary[i] = new LNGIntVector();
      seqAuxiliary[i].growTo(rhs + 1, -1);
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= rhs; ++j) {
        seqAuxiliary[i].set(j, mkLit(s.nVars(), false));
        newSATVariable(s);
      }
    }
    for (int i = 1; i <= rhs; ++i)
      this.pbOutlits.push(seqAuxiliary[n].get(i));
    for (int i = 1; i <= n; i++) {
      int wi = coeffs.get(i - 1);
      assert wi <= rhs;
      for (int j = 1; j <= rhs; j++) {
        if (i >= 2 && i <= n && j <= rhs)
          addBinaryClause(s, not(seqAuxiliary[i - 1].get(j)), seqAuxiliary[i].get(j));
        if (i <= n && j <= wi)
          addBinaryClause(s, not(lits.get(i - 1)), seqAuxiliary[i].get(j));
        if (i >= 2 && i <= n && j <= rhs - wi)
          addTernaryClause(s, not(seqAuxiliary[i - 1].get(j)), not(lits.get(i - 1)), seqAuxiliary[i].get(j + wi));
      }
      if (i >= 2)
        addBinaryClause(s, not(seqAuxiliary[i - 1].get(rhs + 1 - wi)), not(lits.get(i - 1)));
    }
    this.currentPbRhs = rhs;
    hasEncoding = true;
  }

  /**
   * Incremental construction of the SWC encoding.
   * @param s           the solver
   * @param lits        the literals of the constraint
   * @param coeffs      the coefficients of the constraint
   * @param rhs         the right hand size of the constraint
   * @param assumptions the current assumptions
   * @param size        the size
   */
  public void encode(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs,
                     int rhs, final LNGIntVector assumptions, int size) {
    if (rhs == Integer.MAX_VALUE)
      throw new IllegalArgumentException("Overflow in the Encoding");
    hasEncoding = false;
    final LNGIntVector simpLits = new LNGIntVector(lits);
    final LNGIntVector simpCoeffs = new LNGIntVector(coeffs);
    lits.clear();
    coeffs.clear();
    final LNGIntVector simpUnitLits = new LNGIntVector(this.unitLits);
    final LNGIntVector simpUnitCoeffs = new LNGIntVector(this.unitCoeffs);
    this.unitLits.clear();
    this.unitCoeffs.clear();
    for (int i = 0; i < simpUnitLits.size(); i++) {
      if (simpUnitCoeffs.get(i) <= rhs) {
        lits.push(simpUnitLits.get(i));
        coeffs.push(simpUnitCoeffs.get(i));
      } else {
        this.unitLits.push(simpUnitLits.get(i));
        this.unitCoeffs.push(simpUnitCoeffs.get(i));
      }
    }
    for (int i = 0; i < simpLits.size(); i++) {
      if (simpCoeffs.get(i) <= rhs) {
        lits.push(simpLits.get(i));
        coeffs.push(simpCoeffs.get(i));
      } else {
        this.unitLits.push(simpLits.get(i));
        this.unitCoeffs.push(simpCoeffs.get(i));
      }
    }
    if (lits.size() == 1) {
      for (int i = 0; i < this.unitLits.size(); i++)
        assumptions.push(not(this.unitLits.get(i)));
      this.unitLits.push(lits.get(0));
      this.unitCoeffs.push(coeffs.get(0));
      return;
    }
    if (lits.size() == 0) {
      for (int i = 0; i < this.unitLits.size(); i++)
        assumptions.push(not(this.unitLits.get(i)));
      return;
    }
    int n = lits.size();
    this.seqAuxiliaryInc = new LNGVector<>(size + 1);
    for (int i = 0; i <= n; i++) {
      this.seqAuxiliaryInc.set(i, new LNGIntVector());
      this.seqAuxiliaryInc.get(i).growTo(rhs + 1, -1);
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= rhs; ++j) {
        this.seqAuxiliaryInc.get(i).set(j, mkLit(s.nVars(), false));
        newSATVariable(s);
      }
    }
    int blocking = mkLit(s.nVars(), false);
    newSATVariable(s);
    this.currentLitBlocking = blocking;
    assumptions.push(not(blocking));
    for (int i = 1; i <= n; i++) {
      int wi = coeffs.get(i - 1);
      assert rhs >= wi;
      for (int j = 1; j <= rhs; j++) {
        if (i >= 2 && i <= n && j <= rhs)
          addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), this.seqAuxiliaryInc.get(i).get(j));
        if (i <= n && j <= wi)
          addBinaryClause(s, not(lits.get(i - 1)), this.seqAuxiliaryInc.get(i).get(j));
        if (i >= 2 && i <= n && j <= rhs - wi)
          addTernaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), not(lits.get(i - 1)), this.seqAuxiliaryInc.get(i).get(j + wi));
      }
      if (i >= 2)
        addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(rhs + 1 - wi)), not(lits.get(i - 1)), blocking);
    }
    for (int i = 0; i < this.unitLits.size(); i++)
      assumptions.push(not(this.unitLits.get(i)));
    this.currentPbRhs = rhs;
    hasEncoding = true;
    this.litsInc = new LNGIntVector(lits);
    this.coeffsInc = new LNGIntVector(coeffs);
  }

  /**
   * Updates the 'rhs' of an already existent pseudo-Boolean encoding.  This method allows for all learned clauses
   * from previous iterations to be kept in the next iteration.
   * @param s   the solver
   * @param rhs the new right hand side
   */
  public void update(final MiniSatStyleSolver s, int rhs) {
    assert this.currentPbRhs != -1;
    for (int i = rhs; i < this.currentPbRhs; i++)
      addUnitClause(s, not(this.pbOutlits.get(i)));
    this.currentPbRhs = rhs;
  }

  /**
   * Incremental update of the SWC encoding.
   * @param s   the solver
   * @param rhs the new right hand side
   */
  public void updateInc(final MiniSatStyleSolver s, int rhs) {
    if (this.currentLitBlocking != LIT_UNDEF)
      addUnitClause(s, this.currentLitBlocking);
    int n = this.litsInc.size();
    int offset = this.currentPbRhs + 1;
    assert this.currentPbRhs < rhs;
    for (int i = 1; i <= n; i++) {
      for (int j = offset; j <= rhs; j++)
        this.seqAuxiliaryInc.get(i).push(LIT_UNDEF);
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = offset; j <= rhs; ++j) {
        assert this.seqAuxiliaryInc.get(i).size() > j;
        this.seqAuxiliaryInc.get(i).set(j, mkLit(s.nVars(), false));
        newSATVariable(s);
      }
    }
    for (int i = 1; i < this.litsInc.size(); i++)
      assert this.seqAuxiliaryInc.get(i).size() == rhs + 1;
    this.currentLitBlocking = mkLit(s.nVars(), false);
    newSATVariable(s);
    for (int i = 1; i <= n; i++) {
      int wi = this.coeffsInc.get(i - 1);
      assert wi > 0;
      assert rhs >= wi;
      for (int j = 1; j <= rhs; j++) {
        if (i >= 2 && i <= n && j <= rhs && j >= offset) {
          assert this.seqAuxiliaryInc.get(i).size() > j;
          addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), this.seqAuxiliaryInc.get(i).get(j));
        }
        if (i >= 2 && i <= n && j <= rhs - wi && j >= offset - wi)
          addTernaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), not(this.litsInc.get(i - 1)), this.seqAuxiliaryInc.get(i).get(j + wi));
      }
      if (i >= 2) {
        assert i - 1 > 0 && this.seqAuxiliaryInc.get(i - 1).size() > rhs + 1 - wi;
        assert rhs + 1 - wi > 0;
        assert i - 1 > 0 && i - 1 < this.litsInc.size();
        addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(rhs + 1 - wi)), not(this.litsInc.get(i - 1)), this.currentLitBlocking);
      }
    }
    this.currentPbRhs = rhs;
  }

  /**
   * Joins two pseudo boolean constraints.  The given constraint is added to the current one.
   * @param s      the solver
   * @param lits   the literals of the constraint
   * @param coeffs the coefficients of the constraint
   */
  void join(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs) {
    assert this.currentLitBlocking != LIT_UNDEF;
    int rhs = this.currentPbRhs;
    if (rhs == Integer.MAX_VALUE)
      throw new IllegalArgumentException("Overflow in the Encoding");
    final LNGIntVector simpUnitLits = new LNGIntVector(this.unitLits);
    final LNGIntVector simpUnitCoeffs = new LNGIntVector(this.unitCoeffs);
    this.unitLits.clear();
    this.unitCoeffs.clear();
    int lhsJoin = this.litsInc.size();
    for (int i = 0; i < simpUnitLits.size(); i++) {
      if (simpUnitCoeffs.get(i) <= rhs) {
        this.litsInc.push(simpUnitLits.get(i));
        this.coeffsInc.push(simpUnitCoeffs.get(i));
      } else {
        this.unitLits.push(simpUnitLits.get(i));
        this.unitCoeffs.push(simpUnitCoeffs.get(i));
      }
    }
    for (int i = 0; i < lits.size(); i++) {
      if (coeffs.get(i) <= rhs) {
        this.litsInc.push(lits.get(i));
        this.coeffsInc.push(coeffs.get(i));
      } else {
        this.unitLits.push(lits.get(i));
        this.unitCoeffs.push(coeffs.get(i));
      }
    }
    if (this.litsInc.size() == lhsJoin)
      return;
    int n = this.litsInc.size();
    assert this.seqAuxiliaryInc.get(lhsJoin).size() > 0;
    for (int i = lhsJoin + 1; i <= n; i++) {
      this.seqAuxiliaryInc.set(i, new LNGIntVector());
      this.seqAuxiliaryInc.get(i).growTo(rhs + 1, -1);
    }
    for (int i = lhsJoin + 1; i <= n; ++i) {
      for (int j = 1; j <= rhs; ++j) {
        this.seqAuxiliaryInc.get(i).set(j, mkLit(s.nVars(), false));
        newSATVariable(s);
      }
    }
    for (int i = 1; i <= n; i++)
      assert this.seqAuxiliaryInc.get(i).size() == rhs + 1;
    for (int i = lhsJoin; i <= n; i++) {
      int wi = this.coeffsInc.get(i - 1);
      assert wi > 0;
      assert wi <= rhs;
      for (int j = 1; j <= rhs; j++) {
        assert this.seqAuxiliaryInc.get(i).size() > j;
        assert this.seqAuxiliaryInc.get(i - 1).size() > j;
        addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), this.seqAuxiliaryInc.get(i).get(j));
        if (j <= wi) {
          assert this.seqAuxiliaryInc.get(i).size() > j;
          assert i - 1 < this.litsInc.size() && i - 1 >= 0;
          addBinaryClause(s, not(this.litsInc.get(i - 1)), this.seqAuxiliaryInc.get(i).get(j));
        }
        if (j <= rhs - wi)
          addTernaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(j)), not(this.litsInc.get(i - 1)), this.seqAuxiliaryInc.get(i).get(j + wi));
      }
      if (i > lhsJoin) {
        assert rhs + 1 - wi >= 0;
        assert this.seqAuxiliaryInc.get(i - 1).size() > rhs + 1 - wi;
        assert i - 1 < this.litsInc.size() && i - 1 >= 0;
        addBinaryClause(s, not(this.seqAuxiliaryInc.get(i - 1).get(rhs + 1 - wi)), not(this.litsInc.get(i - 1)), this.currentLitBlocking);
      }
    }
  }

  @Override
  public String toString() {
    return this.getClass().getSimpleName();
  }
}
1033053
public void setPredicates(Expression[] predicates)
  {

    m_predicates = predicates;
    if(null != predicates)
    {
    	for(int i = 0; i < predicates.length; i++)
    	{
    		predicates[i].exprSetParent(this);
    	}
    }

    calcScore();
  }
1364174
public void setValues(
                    final Collection<?> values
                    )
    {
        if (values != _values) {
            clear();
            if (values == null  ||  values.size() == 0) {
                return;
            }

            for (Object  value : values) {
                addValue( value );
            }
        }
    }
575480
public void put(ContextPair... pairs) {
        if (pairs != null) {
            for (int i = 0; i < pairs.length; i++) {
                ContextPair pair = pairs[i];
                this.put(pair.getKey(), pair.getValue());
            }
        }
    }
861345
private void addDefines(final String[] defs, final boolean isDefine) {
    for (final String def2 : defs) {
      UndefineArgument def;
      if (isDefine) {
        def = new DefineArgument();
      } else {
        def = new UndefineArgument();
      }
      def.setName(def2);
      this.defineList.addElement(def);
    }
  }
735400
public void addEdge(final Collection<HypergraphNode<T>> nodes) {
    final HypergraphEdge<T> edge = new HypergraphEdge<>(nodes);
    this.nodes.addAll(nodes);
    this.edges.add(edge);
  }
686170
@SuppressWarnings("unchecked")
	public static <T> void fill(Collection<T> collection,T...args)
	{
		if(collection == null || args == null)
			return;
		
		for (T t : args)
		{
			collection.add(t);
		}
	}
412880
public void setFindingTypes(java.util.Collection<String> findingTypes) {
        if (findingTypes == null) {
            this.findingTypes = null;
            return;
        }

        this.findingTypes = new java.util.ArrayList<String>(findingTypes);
    }
455113
private void addTokens(final Token curToken, final List<Token> tokens) {
    if (curToken.tokenLength() != 0) {
      if (this.unTokenizable) {
        tokens.add(curToken);
      } else if (!this.unTokenizable) {
        if (!replacement.matcher(curToken.getTokenValue()).matches()) {
          tokens.add(curToken);
        }
      }
    }
  }
369509
public static void add(Map<String, Class<? extends ICustomFunction>> moreCustomFunctions) {
        fs.putAll(moreCustomFunctions);
        poifs = loadPoiCustomFunctions(fs);
    }
1034909
public void addValues(Collection<Long> values) {
		synchronized (buckets) {
			for (Long value : values) {
				addValue(value);
			}
		}
	}