package background.commands;

import background.CommandManager;
import background.expressions.LogicalTree;

public class IfSegment extends Command {	
	public IfSegment(Boolean viz, CommandManager cm) { super(viz, cm);}
	public IfSegment(CommandManager cm) { super(cm);}
	public LogicalTree condition;

	@Override
	public String getType() {
		return "If";
	}

	
	public void setCondition(String s) {				
		condition = expressionInterpreter.getLogic(s);  		
	}
	
	public void applyInnerCommands() {
		addInnerCommands();
	}
	
	@Override
	public void applyCommand() {
		if (condition.getTreeValue()) {
			addInnerCommands();
		}		
	}

	

}
