package matlab.syntax;

import java.util.*;

import dl.syntax.*;

public class MatlabAssignment extends MatlabProgram {
	private final RealVariable lhs;
	private final Term rhs;
	
	public MatlabAssignment( RealVariable lhs, Term rhs ) {
		this.lhs = lhs;
		this.rhs = rhs;
	}
	
	public RealVariable getLHS() {
		return lhs;
	}
	
	public Term getRHS() {
		return rhs;
	}
	
	public Set<RealVariable> getModifiedVariables() {
		Set<RealVariable> variables = new HashSet<>();
		variables.add(getLHS());
		return variables;
	}
	
	public MatlabAssignment replace( Replacement replacement ) {
		return new MatlabAssignment( lhs, rhs.replace( replacement ));
	}
	
	public String toString() {
		return lhs.toString() + " = " + rhs.toString() + ";\n";
	}
	
}

@@ -511,25 +511,24 @@
 riables;%0A%09%7D%0A
-%09
 %0A%09public Mat
@@ -609,19 +609,55 @@
 gnment( 
-lhs
+(RealVariable) lhs.replace(replacement)
 , rhs.re

Replace LHS with replacement values