org.kaazing.robot.lang.ast.builder.AstAcceptNodeBuilder Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2014 "Kaazing Corporation," (www.kaazing.com)
*
* This file is part of Robot.
*
* Robot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.kaazing.robot.lang.ast.builder;
import java.net.URI;
import org.kaazing.robot.lang.ast.AstAcceptNode;
import org.kaazing.robot.lang.ast.AstScriptNode;
public final class AstAcceptNodeBuilder extends AbstractAstAcceptNodeBuilder {
private int line;
public AstAcceptNodeBuilder() {
this(new AstAcceptNode());
}
@Override
public AstAcceptNodeBuilder setLocationInfo(int line, int column) {
node.setLocationInfo(line, column);
internalSetLineInfo(line);
return this;
}
@Override
public AstAcceptNodeBuilder setNextLineInfo(int linesToSkip, int column) {
internalSetNextLineInfo(linesToSkip, column);
return this;
}
public AstAcceptNodeBuilder setLocation(URI location) {
node.setLocation(location);
return this;
}
public AstAcceptNodeBuilder setAcceptName(String acceptName) {
node.setAcceptName(acceptName);
return this;
}
@Override
public AstOpenedNodeBuilder.StreamNested addOpenedEvent() {
return new AstOpenedNodeBuilder.StreamNested(this);
}
@Override
public AstBoundNodeBuilder.StreamNested addBoundEvent() {
return new AstBoundNodeBuilder.StreamNested(this);
}
@Override
public AstChildOpenedNodeBuilder.StreamNested addChildOpenedEvent() {
return new AstChildOpenedNodeBuilder.StreamNested(this);
}
@Override
public AstChildClosedNodeBuilder.StreamNested addChildClosedEvent() {
return new AstChildClosedNodeBuilder.StreamNested(this);
}
@Override
public AstUnboundNodeBuilder.StreamNested addUnboundEvent() {
return new AstUnboundNodeBuilder.StreamNested(this);
}
@Override
public AstClosedNodeBuilder.StreamNested addClosedEvent() {
return new AstClosedNodeBuilder.StreamNested(this);
}
@Override
public AstReadAwaitNodeBuilder.StreamNested addReadAwaitBarrier() {
return new AstReadAwaitNodeBuilder.StreamNested(this);
}
@Override
public AstReadNotifyNodeBuilder.StreamNested addReadNotifyBarrier() {
return new AstReadNotifyNodeBuilder.StreamNested(this);
}
@Override
public AstWriteAwaitNodeBuilder.StreamNested addWriteAwaitBarrier() {
return new AstWriteAwaitNodeBuilder.StreamNested(this);
}
@Override
public AstWriteNotifyNodeBuilder.StreamNested addWriteNotifyBarrier() {
return new AstWriteNotifyNodeBuilder.StreamNested(this);
}
@Override
public AstAcceptNode done() {
return result;
}
@Override
protected int line() {
return line;
}
@Override
protected int line(int line) {
this.line = line;
return line;
}
private AstAcceptNodeBuilder(AstAcceptNode node) {
super(node, node);
}
public static final class ScriptNested> extends
AbstractAstAcceptNodeBuilder {
public ScriptNested(R builder) {
super(new AstAcceptNode(), builder);
}
@Override
public int line() {
return result.line();
}
@Override
public int line(int line) {
return result.line(line);
}
@Override
public ScriptNested setLocationInfo(int line, int column) {
node.setLocationInfo(line, column);
internalSetLineInfo(line);
return this;
}
@Override
public ScriptNested setNextLineInfo(int linesToSkip, int column) {
internalSetNextLineInfo(linesToSkip, column);
return this;
}
public ScriptNested setLocation(URI location) {
node.setLocation(location);
return this;
}
public ScriptNested setAcceptName(String acceptName) {
node.setAcceptName(acceptName);
return this;
}
public AstAcceptableNodeBuilder.AcceptNested> addAcceptedStream() {
return new AstAcceptableNodeBuilder.AcceptNested>(this);
}
@Override
public AstOpenedNodeBuilder.StreamNested> addOpenedEvent() {
return new AstOpenedNodeBuilder.StreamNested>(this);
}
@Override
public AstBoundNodeBuilder.StreamNested> addBoundEvent() {
return new AstBoundNodeBuilder.StreamNested>(this);
}
@Override
public AstChildOpenedNodeBuilder.StreamNested> addChildOpenedEvent() {
return new AstChildOpenedNodeBuilder.StreamNested>(this);
}
@Override
public AstChildClosedNodeBuilder.StreamNested> addChildClosedEvent() {
return new AstChildClosedNodeBuilder.StreamNested>(this);
}
@Override
public AstUnboundNodeBuilder.StreamNested> addUnboundEvent() {
return new AstUnboundNodeBuilder.StreamNested>(this);
}
@Override
public AstClosedNodeBuilder.StreamNested> addClosedEvent() {
return new AstClosedNodeBuilder.StreamNested>(this);
}
@Override
public AstReadAwaitNodeBuilder.StreamNested> addReadAwaitBarrier() {
return new AstReadAwaitNodeBuilder.StreamNested>(this);
}
@Override
public AstReadNotifyNodeBuilder.StreamNested> addReadNotifyBarrier() {
return new AstReadNotifyNodeBuilder.StreamNested>(this);
}
@Override
public AstWriteAwaitNodeBuilder.StreamNested> addWriteAwaitBarrier() {
return new AstWriteAwaitNodeBuilder.StreamNested>(this);
}
@Override
public AstWriteNotifyNodeBuilder.StreamNested> addWriteNotifyBarrier() {
return new AstWriteNotifyNodeBuilder.StreamNested>(this);
}
@Override
public R done() {
AstScriptNode scriptNode = result.node;
scriptNode.getStreams().add(node);
return result;
}
}
}