javax.constraints.extra.VarList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331 Show documentation
Show all versions of jsr331 Show documentation
JCP Standard JSR331 “Java Constraint Programming API”. It is used for Modeling and Solving Constraint Satisfaction and Optimization Problems using Java and off-the-shelf Constraint/Linear Solvers
The newest version!
package javax.constraints.extra;
import java.util.ArrayList;
import javax.constraints.Var;
public class VarList extends ArrayList {
public Var[] toArray() {
Var[] array = new Var[size()];
for (int i = 0; i < array.length; i++) {
array[i] = get(i);
}
return array;
}
public void add(Var[] vars) {
for (int i = 0; i < vars.length; i++) {
Var var = vars[i];
add(var);
}
}
}