org.chocosolver.solver.variables.view.AbstractView Maven / Gradle / Ivy
/*
* This file is part of choco-solver, http://choco-solver.org/
*
* Copyright (c) 2022, IMT Atlantique. All rights reserved.
*
* Licensed under the BSD 4-clause license.
*
* See LICENSE file in the project root for full license information.
*/
package org.chocosolver.solver.variables.view;
import org.chocosolver.solver.variables.Variable;
import org.chocosolver.solver.variables.impl.AbstractVariable;
public abstract class AbstractView extends AbstractVariable implements IView {
protected V[] variables;
/**
* Default constructor for views.
*
* @param name name of the view
* @param variables observed variables
*/
@SuppressWarnings("unchecked")
protected AbstractView(String name, V... variables) {
super(name, variables[0].getModel());
this.variables = variables;
for (int i = 0; i < variables.length; i++) {
variables[i].subscribeView(this, i);
}
}
@Override
public V[] getVariables() {
return variables;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy