
/*
 * Copyright (C) 2014 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.jsimpledb.parse.expr;

import org.jsimpledb.parse.ParseSession;

/**
 * A parsed literal value.
 */
public class LiteralNode implements Node {

    private final Object value;

    public LiteralNode(Object value) {
        this.value = value;
    }

    @Override
    public Value evaluate(ParseSession session) {
        return new ConstValue(this.value);
    }

    @Override
    public String toString() {
        return "LiteralNode[" + this.value + "]";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this)
            return true;
        if (obj == null || obj.getClass() != this.getClass())
            return false;
        final LiteralNode that = (LiteralNode)obj;
        return this.value != null ? this.value.equals(that.value) : that.value == null;
    }

    @Override
    public int hashCode() {
        return this.value != null ? this.value.hashCode() : null;
    }
}


@@ -328,32 +328,150 @@
 = value;%0A    %7D%0A%0A
+    /**%0A     * Get the literal value.%0A     */%0A    public Object getLiteralValue() %7B%0A        return this.value;%0A    %7D%0A%0A
     @Override%0A  

Add LiteralNode.getLiteralValue() method.