/*
 *
 * Copyright 2016 Big Data Curation Lab, University of Toronto,
 * 		   	  	  	   				 Patricia Arocena,
 *   								 Boris Glavic,
 *  								 Renee J. Miller
 *
 * This software also contains code derived from STBenchmark as described in
 * with the permission of the authors:
 *
 * Bogdan Alexe, Wang-Chiew Tan, Yannis Velegrakis
 *
 * This code was originally described in:
 *
 * STBenchmark: Towards a Benchmark for Mapping Systems
 * Alexe, Bogdan and Tan, Wang-Chiew and Velegrakis, Yannis
 * PVLDB: Proceedings of the VLDB Endowment archive
 * 2008, vol. 1, no. 1, pp. 230-244
 *
 * The copyright of the ToxGene (included as a jar file: toxgene.jar) belongs to
 * Denilson Barbosa. The iBench distribution contains this jar file with the
 * permission of the author of ToxGene
 * (http://www.cs.toronto.edu/tox/toxgene/index.html)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package vtools.dataModel.expression;

import vtools.dataModel.values.AtomicValue;
import vtools.visitor.Visitable;
import vtools.visitor.Visitor;

public class ConstantAtomicValue extends ValueExpression implements Visitable, Cloneable
{
    private AtomicValue _value;

    public ConstantAtomicValue(AtomicValue value)
    {
        if (value == null)
            throw new RuntimeException("Need a real atomic value");
        _value = value;
    }

    public AtomicValue getValue()
    {
        return _value;
    }

    public void setValue(AtomicValue value)
    {
        _value = value;
    }

    public boolean equals(Object o)
    {
        if (!(o instanceof ConstantAtomicValue))
            return false;
        if (!super.equals(o))
            return false;
        ConstantAtomicValue cat = (ConstantAtomicValue) o;
        if (!_value.equals(cat._value))
            return false;
        return true;
    }

    public ConstantAtomicValue clone()
    {
        ConstantAtomicValue catValue = (ConstantAtomicValue) super.clone();
        catValue._value = _value.clone();
        return catValue;
    }

    public Visitor getPrintVisitor()
    {
        return StringPrinter.StringPrinter;
    }
}
