org.intocps.maestro.ast.node.AUnloadExp 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 org.intocps.maestro.ast.node.PExpBase;
import org.intocps.maestro.ast.analysis.intf.IAnalysis;
import org.intocps.maestro.ast.analysis.AnalysisException;
import org.intocps.maestro.ast.node.AUnloadExp;
import java.util.HashMap;
import org.intocps.maestro.ast.analysis.intf.IAnswer;
import java.util.stream.Collectors;
import org.intocps.maestro.ast.node.PExp;
import java.util.List;
import org.intocps.maestro.ast.analysis.intf.IQuestionAnswer;
import org.intocps.maestro.ast.node.NodeList;
import java.util.Map;
import java.lang.Boolean;
import org.intocps.maestro.ast.analysis.intf.IQuestion;
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 class AUnloadExp extends PExpBase
{
private static final long serialVersionUID = 1L;
private NodeList _args = new NodeList(this);
/**
* Creates a new complete constructor {@code AUnloadExp} 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 args_ the {@link NodeList} node for the {@code args} child of this {@link AUnloadExp} node
*/
public AUnloadExp(List extends PExp> args_)
{
super();
this.setArgs(args_);
}
/**
* Creates a new default constructor {@link AUnloadExp} node with no children.
*/
public AUnloadExp()
{
}
/**
* Essentially this.toString().equals(o.toString()).
**/
@Override
public boolean equals(Object o)
{
if (o != null && o instanceof AUnloadExp) {
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("_args",this._args);
return fields;
}
/**
* Returns a deep clone of this {@link AUnloadExp} node.
* @return a deep clone of this {@link AUnloadExp} node
*/
public AUnloadExp clone()
{
return new AUnloadExp(
cloneList(_args)
);
}
/**
* Creates a deep clone of this {@link AUnloadExp} 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 AUnloadExp} node
*/
public AUnloadExp clone(Map oldToNewMap)
{
AUnloadExp node = new AUnloadExp(
cloneList(_args, oldToNewMap)
);
oldToNewMap.put(this, node);
return node;
}
public String toString()
{
return "" + "unload("+ _args.stream().map(Object::toString).collect(Collectors.joining(", "))+")";
}
/**
* Forwarding hashCode call to {@link Object#hashCode()}.
**/
@Override
public int hashCode()
{
return super.hashCode();
}
/**
* Removes the {@link INode} {@code child} as a child of this {@link AUnloadExp} 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 AUnloadExp} node
* @throws RuntimeException if {@code child} is not a child of this {@link AUnloadExp} node
*/
public void removeChild(INode child)
{
if (this._args.remove(child)) {
return;
}
throw new RuntimeException("Not a child.");
}
/**
* Sets the {@code _args} child of this {@link AUnloadExp} node.
* @param value the new {@code _args} child of this {@link AUnloadExp} node
*/
public void setArgs(List extends PExp> value)
{
if (this._args.equals(value)) {
return;
}
this._args.clear();
if (value != null) {
this._args.addAll(value);
}
}
/**
* @return the {@link LinkedList} node which is the {@code _args} child of this {@link AUnloadExp} node
*/
public LinkedList getArgs()
{
return this._args;
}
/**
* Calls the {@link IAnalysis#caseAUnloadExp(AUnloadExp)} of the {@link IAnalysis} {@code caller}.
* @param caller the {@link IAnalysis} to which this {@link AUnloadExp} node is applied
*/
@Override
public void apply(IAnalysis caller) throws AnalysisException
{
caller.caseAUnloadExp(this);
}
/**
* Calls the {@link IAnswer#caseAUnloadExp(AUnloadExp)} of the {@link IAnswer} {@code caller}.
* @param caller the {@link IAnswer} to which this {@link AUnloadExp} node is applied
*/
@Override
public A apply(IAnswer caller) throws AnalysisException
{
return caller.caseAUnloadExp(this);
}
/**
* Calls the {@link IQuestion#caseAUnloadExp(AUnloadExp, Object)} of the {@link IQuestion} {@code caller}.
* @param caller the {@link IQuestion} to which this {@link AUnloadExp} node is applied
* @param question the question provided to {@code caller}
*/
@Override
public void apply(IQuestion caller, Q question) throws AnalysisException
{
caller.caseAUnloadExp(this,question);
}
/**
* Calls the {@link IQuestionAnswer#caseAUnloadExp(AUnloadExp, Object)} of the {@link IQuestionAnswer} {@code caller}.
* @param caller the {@link IQuestionAnswer} to which this {@link AUnloadExp} node is applied
* @param question the question provided to {@code caller}
*/
@Override
public A apply(IQuestionAnswer caller, Q question) throws AnalysisException
{
return caller.caseAUnloadExp(this,question);
}
}