org.chocosolver.parser.flatzinc.ast.expression.Expression Maven / Gradle / Ivy
/**
* Copyright (c) 1999-2011, Ecole des Mines de Nantes
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Ecole des Mines de Nantes nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.chocosolver.parser.flatzinc.ast.expression;
import org.chocosolver.parser.Exit;
import org.chocosolver.solver.Solver;
import org.chocosolver.solver.variables.BoolVar;
import org.chocosolver.solver.variables.IntVar;
import org.chocosolver.solver.variables.SetVar;
import org.chocosolver.solver.variables.Variable;
/*
* User : CPRUDHOM
* Mail : cprudhom(a)emn.fr
* Date : 8 janv. 2010
* Since : Choco 2.1.1
*
* Class for expression definition based on flatzinc-like objects.
*/
public abstract class Expression {
public enum EType {
ANN, ARR, BOO, IDA, IDE, INT, SET_B, SET_L, STR
}
@SuppressWarnings({"InstantiatingObjectToGetClassObject"})
protected static final Class int_arr = new int[0].getClass();
@SuppressWarnings({"InstantiatingObjectToGetClassObject"})
protected static final Class bool_arr = new boolean[0].getClass();
final EType typeOf;
protected Expression(EType typeOf) {
this.typeOf = typeOf;
}
public final EType getTypeOf() {
return typeOf;
}
/**
* Get the int value of the {@link Expression}
*
* @return int
*/
public int intValue() {
Exit.log();
return 0;
}
/**
* Get array of int of the {@link Expression}
*
* @return int[]
*/
public int[] toIntArray() {
Exit.log();
return null;
}
/**
* Get array of int of the {@link Expression}
*
* @return int[]
*/
public int[][] toIntMatrix() {
Exit.log();
return null;
}
/**
* Get the boolean value of the {@link Expression}
*
* @return boolean
*/
public boolean boolValue() {
Exit.log();
return true;
}
/**
* Get array of int of the {@link Expression}
*
* @return int[]
*/
public boolean[] toBoolArray() {
Exit.log();
return null;
}
/**
* Get the {@link BoolVar} of the {@link Expression}
*
* @param solver the Solver
* @return {@link BoolVar}
*/
public BoolVar boolVarValue(Solver solver) {
Exit.log();
return null;
}
/**
* Get an array of {@link BoolVar}[] of the {@link Expression}
*
* @param solver the Solver
* @return {@link BoolVar}[]
*/
public BoolVar[] toBoolVarArray(Solver solver) {
Exit.log();
return null;
}
/**
* Get the {@link IntVar} of the {@link Expression}
*
* @param solver the Solver
* @return {@link IntVar}
*/
public IntVar intVarValue(Solver solver) {
Exit.log();
return null;
}
/**
* Get an array of {@link IntVar}[] of the {@link Expression}
*
* @param solver the Solver
* @return {@link IntVar}[]
*/
public IntVar[] toIntVarArray(Solver solver) {
Exit.log();
return null;
}
/**
* Get the {@link SetVar} of the {@link Expression}
*
* @param solver the Solver
* @return {@link Variable} or {@link Variable}
*/
public SetVar setVarValue(Solver solver) {
Exit.log();
return null;
}
/**
* Get an array of {@link SetVar}[] of the {@link Expression}
*
* @param solver the Solver
* @return {@link SetVar}[]
*/
public SetVar[] toSetVarArray(Solver solver) {
Exit.log();
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy