/*
* Copyright 2010 Jan Schmidt-Reinisch
*
* SoundComp - a sound processing library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; in version 2.1
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.maramuse.soundcomp.parser;
import de.maramuse.soundcomp.parser.SCParser.ParserVal;
import de.maramuse.soundcomp.parser.math.Ident;
/**
* This class represents an assignment of a formula to an input of a process reference
*/
public class InputAssignment extends ParserVal {
InputAssignment(ParserVal val){
super(SCParser.INPUTASSIGNMENT, "~inputas");
this.line=val.line;
this.filename=val.filename;
append(val);
}
/* the name of the input that is assigned */
private String inputName;
/* the formula of this assignment */
private ParserVal formula;
/**
* sets the name of the assigned input
* @param name the name of the assigned input
*/
public InputAssignment setInputName(String name){
this.inputName=name;
return this;
}
/**
* returns the name of the assigned input
* @return the name of the assigned input
*/
public String getInputName(){
return inputName;
}
/**
* set the formula of this assignment
* @param formula the formula of this assignment
*/
public InputAssignment setFormula(ParserVal formula){
this.formula=formula;
return this;
}
/**
* set the formula of this assignment to an input or variable name
* @param element the input or variable name
*/
public InputAssignment setFormula(Element element){
this.formula=new Ident("ident");
((Ident)this.formula).setIdentity(element);
return this;
}
/**
* returns the formula of this assignment
* @return the formula of this assignment
*/
public ParserVal getFormula(){
return formula;
}
}