Example usage for java.util Collections nCopies

List of usage examples for java.util Collections nCopies

Introduction

In this page you can find the example usage for java.util Collections nCopies.

Prototype

public static <T> List<T> nCopies(int n, T o) 

Source Link

Document

Returns an immutable list consisting of n copies of the specified object.

Usage

From source file:org.um.feri.ears.problems.unconstrained.ProblemSphere.java

public ProblemSphere(int d, double intervalRight) {
    super(d, 0);//from  w ww.j  a va  2  s  . com
    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, intervalRight * -1.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, intervalRight));

    name = "Sphere";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemGriewank.java

public ProblemGriewank(int d, double i) {
    super(d, 0);/*from   w  w  w  . j  a v a  2 s .c  o  m*/

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -i));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, i));

    name = "Griewank";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemRastrigin.java

public ProblemRastrigin(int d, double j) {
    super(d, 0);//from  w ww  .jav  a  2  s .  co  m

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, j * -1.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, j));

    name = "Rastrigin";
}

From source file:io.prestosql.operator.aggregation.AbstractTestApproximateCountDistinct.java

@Test(dataProvider = "provideStandardErrors")
public void testAllPositionsNull(double maxStandardError) {
    assertCount(Collections.nCopies(100, null), maxStandardError, 0);
}

From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction3.java

public TLBOBenchmarkFunction3() {
    super(7, 4);/*w w w .  j a v a  2  s.c o  m*/
    minimum = true;

    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    Collections.fill(lowerLimit, -10.0);
    Collections.fill(upperLimit, 20.0);

    max_constraints = new Double[numberOfConstraints];
    min_constraints = new Double[numberOfConstraints];
    count_constraints = new Double[numberOfConstraints];
    sum_constraints = new Double[numberOfConstraints];
    normalization_constraints_factor = new Double[numberOfConstraints];
    //System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL));
    name = "TLBOBenchmarkFunction3 cec-g09";
}

From source file:ei.ne.ke.cassandra.cql3.template.DeleteStatementBuilder.java

/**
 *
 *
 * @param identifier//from   w  w  w  .  jav a2  s .  co  m
 * @param numVariables
 * @return
 */
public DeleteStatementBuilder where(String identifier, int numVariables) {
    relations.add(new In(new Identifier(identifier), Collections.nCopies(numVariables, Term.VARIABLE)));
    return this;
}

From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction2.java

public TLBOBenchmarkFunction2() {
    super(10, 1);
    minimum = false;/* w  w  w.  java  2 s .  c  o  m*/

    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    Collections.fill(lowerLimit, 0.0);
    Collections.fill(upperLimit, 1.0);

    max_constraints = new Double[numberOfConstraints];
    min_constraints = new Double[numberOfConstraints];
    count_constraints = new Double[numberOfConstraints];
    sum_constraints = new Double[numberOfConstraints];
    normalization_constraints_factor = new Double[numberOfConstraints];
    // System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL));
    name = "TLBOBenchmarkFunction2 cec-g03";

}

From source file:ei.ne.ke.cassandra.cql3.Cql3StatementGenerator.java

/**
 * Constructs a CQL3 DELETE prepared statement for several entities.
 * @param numEntity//from  w  w  w. jav a  2 s . c  om
 * @return a CQL3 statement
 */
public String buildDeleteStatement(int numEntity) {
    List<String> keyColumns = spec.getKeyColumns();
    if (keyColumns.size() == 1) {
        return delete().from(spec.getTable()).where(keyColumns.get(0), numEntity).build();
    } else {
        Mutating statement = delete().from(spec.getTable()).where(spec.getKeyColumns(), "=");
        return batch().statement(Collections.nCopies(numEntity, statement)).build();
    }
}

From source file:eu.stratosphere.util.dag.GraphModule.java

/**
 * Initializes a GraphModule having the given number of inputs and outputs,
 * and {@link ConnectionNavigator}.//from  w ww .  j  av  a 2  s  .c o  m
 * 
 * @param numInputs
 *        the number of inputs
 * @param numOutputs
 *        the number of outputs
 * @param navigator
 *        the navigator used to traverse the graph of nodes
 */
protected GraphModule(final int numInputs, final int numOutputs, final ConnectionNavigator<Node> navigator) {
    this.inputNodes = new ArrayList<InputNode>(Collections.nCopies(numInputs, (InputNode) null));
    this.outputNodes = new ArrayList<OutputNode>(Collections.nCopies(numOutputs, (OutputNode) null));
    this.navigator = navigator;
}

From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction4.java

public TLBOBenchmarkFunction4() {
    super(8, 6);//from w  ww .j  ava2s.c om
    minimum = true;

    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    lowerLimit.set(0, 100.0);
    upperLimit.set(0, 9900.0);
    lowerLimit.set(1, 1000.0);
    upperLimit.set(1, 9000.0);
    lowerLimit.set(2, 1000.0);
    upperLimit.set(2, 9000.0);
    for (int i = 3; i < numberOfDimensions; i++) {
        lowerLimit.set(i, 10.0);
        upperLimit.set(i, 990.0);
    }

    max_constraints = new Double[numberOfConstraints];
    min_constraints = new Double[numberOfConstraints];
    count_constraints = new Double[numberOfConstraints];
    sum_constraints = new Double[numberOfConstraints];
    normalization_constraints_factor = new Double[numberOfConstraints];
    // System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL));
    name = "TLBOBenchmarkFunction4 (G10) cec-g10";

}