/*******************************************************************************
* Copyright (c) 2009 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xored software, Inc. - initial API and Implementation (Vladimir Belov)
*******************************************************************************/
package org.eclipse.dltk.javascript.ast;
import org.eclipse.dltk.ast.ASTVisitor;
public class BooleanLiteral extends Literal {
private final boolean value;
public BooleanLiteral(JSNode parent, boolean value) {
super(parent);
this.value = value;
}
/**
* @see org.eclipse.dltk.ast.ASTNode#traverse(org.eclipse.dltk.ast.ASTVisitor)
*/
@Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
visitor.endvisit(this);
}
}
@Override
public String getText() {
return value ? Keywords.TRUE : Keywords.FALSE;
}
public boolean booleanValue() {
return value;
}
@Override
public String toSourceString(String indentionString) {
return getText();
}
}