org.intocps.maestro.ast.node.SBlockStmBase Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2009, 2011 Overture Team and others.
*
* Overture is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Overture 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Overture. If not, see .
*
* The Overture Tool web-site: http://overturetool.org/
*******************************************************************************/
/* This file was generated by ASTcreator (http://www.lausdahl.com/). */
package org.intocps.maestro.ast.node;
import java.util.List;
import org.intocps.maestro.ast.node.PStmBase;
import org.intocps.maestro.ast.node.NodeList;
import java.util.Map;
import org.intocps.maestro.ast.node.PStm;
import java.lang.Boolean;
import java.util.HashMap;
import org.intocps.maestro.ast.node.SBlockStm;
import java.lang.String;
import java.util.LinkedList;
import org.intocps.maestro.ast.node.INode;
/**
* Generated file by AST Creator
* @author Kenneth Lausdahl
*
*/
@SuppressWarnings({"all"})
public abstract class SBlockStmBase extends PStmBase implements SBlockStm
{
private static final long serialVersionUID = 1L;
protected NodeList _body = new NodeList(this);
/**
* Creates a new default constructor {@link SBlockStmBase} node with no children.
*/
public SBlockStmBase()
{
}
/**
* Creates a new complete constructor {@code SBlockStmBase} node with the given nodes as children.
* @deprecated This method should not be used, use AstFactory instead.
* The basic child nodes are removed from their previous parents.
* @param body_ the {@link NodeList} node for the {@code body} child of this {@link SBlockStmBase} node
*/
public SBlockStmBase(List extends PStm> body_)
{
super();
this.setBody(body_);
}
/**
* Removes the {@link INode} {@code child} as a child of this {@link SBlockStmBase} node.
* Do not call this method with any graph fields of this node. This will cause any child's
* with the same reference to be removed unintentionally or {@link RuntimeException}will be thrown.
* @param child the child node to be removed from this {@link SBlockStmBase} node
* @throws RuntimeException if {@code child} is not a child of this {@link SBlockStmBase} node
*/
public void removeChild(INode child)
{
if (this._body.remove(child)) {
return;
}
throw new RuntimeException("Not a child.");
}
/**
* Creates a deep clone of this {@link SBlockStmBase} node while putting all
* old node-new node relations in the map {@code oldToNewMap}.
* @param oldToNewMap the map filled with the old node-new node relation
* @return a deep clone of this {@link SBlockStmBase} node
*/
@Override
public abstract SBlockStm clone(Map oldToNewMap);
/**
* Forwarding hashCode call to {@link Object#hashCode()}.
**/
@Override
public int hashCode()
{
return super.hashCode();
}
/**
* Returns a deep clone of this {@link SBlockStmBase} node.
* @return a deep clone of this {@link SBlockStmBase} node
*/
@Override
public abstract SBlockStm clone();
public String toString()
{
return super.toString();
}
/**
* Essentially this.toString().equals(o.toString()).
**/
@Override
public boolean equals(Object o)
{
if (o != null && o instanceof SBlockStmBase) {
return toString().equals(o.toString());
}
return false;
}
/**
* Creates a map of all field names and their value
* @param includeInheritedFields if true all inherited fields are included
* @return a a map of names to values of all fields
*/
@Override
public Map getChildren(Boolean includeInheritedFields)
{
Map fields = new HashMap();
if(includeInheritedFields)
{
fields.putAll(super.getChildren(includeInheritedFields));
}
fields.put("_body",this._body);
return fields;
}
/**
* Sets the {@code _body} child of this {@link SBlockStmBase} node.
* @param value the new {@code _body} child of this {@link SBlockStmBase} node
*/
public void setBody(List extends PStm> value)
{
if (this._body.equals(value)) {
return;
}
this._body.clear();
if (value != null) {
this._body.addAll(value);
}
}
/**
* @return the {@link LinkedList} node which is the {@code _body} child of this {@link SBlockStmBase} node
*/
public LinkedList getBody()
{
return this._body;
}
}