/*******************************************************************************
 * Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Distribution License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *******************************************************************************/
/* Generated By:JJTree: Do not edit this line. ASTRDFLiteral.java */

package org.eclipse.rdf4j.query.parser.sparql.ast;

public class ASTRDFLiteral extends ASTRDFValue {

	private String lang;

	public ASTRDFLiteral(int id) {
		super(id);
	}

	public ASTRDFLiteral(SyntaxTreeBuilder p, int id) {
		super(p, id);
	}

	@Override
	public Object jjtAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException {
		return visitor.visit(this, data);
	}

	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public ASTString getLabel() {
		return (ASTString) children.get(0);
	}

	public ASTIRI getDatatype() {
		if (children.size() >= 2) {
			return (ASTIRI) children.get(1);
		}
		return null;
	}

	@Override
	public String toString() {
		String result = super.toString();

		if (lang != null) {
			result += " (lang=" + lang + ")";
		}

		return result;
	}
}
