001package org.cpsolver.ifs.example.csp;
002
003import org.cpsolver.ifs.model.Value;
004
005/**
006 * CSP value.
007 * 
008 * @author  Tomáš Müller
009 * @version IFS 1.3 (Iterative Forward Search)<br>
010 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
011 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
012 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
013 * <br>
014 *          This library is free software; you can redistribute it and/or modify
015 *          it under the terms of the GNU Lesser General Public License as
016 *          published by the Free Software Foundation; either version 3 of the
017 *          License, or (at your option) any later version. <br>
018 * <br>
019 *          This library is distributed in the hope that it will be useful, but
020 *          WITHOUT ANY WARRANTY; without even the implied warranty of
021 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
022 *          Lesser General Public License for more details. <br>
023 * <br>
024 *          You should have received a copy of the GNU Lesser General Public
025 *          License along with this library; if not see
026 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
027 */
028public class CSPValue extends Value<CSPVariable, CSPValue> {
029    /**
030     * Constructor
031     * 
032     * @param variable
033     *            parent variable
034     * @param value
035     *            value (an integer between 0 .. number of values - 1 )
036     */
037    public CSPValue(CSPVariable variable, int value) {
038        super(variable, Double.valueOf(value));
039    }
040    
041    @Override
042    public double toDouble() {
043        return iValue;
044    }
045
046    @Override
047    public String getName() {
048        return String.valueOf(toDouble());
049    }
050}