/* ************************************************************************
#
#  DivConq
#
#  http://divconq.com/
#
#  Copyright:
#    Copyright 2012 eTimeline, LLC. All rights reserved.
#
#  License:
#    See the license.txt file in the project's top-level directory for details.
#
#  Authors:
#    * Andy White
#
************************************************************************ */
package divconq.script.mutator;

import divconq.script.Activity;
import divconq.script.IMutator;
import divconq.script.StackEntry;
import divconq.struct.Struct;
import divconq.struct.scalar.StringStruct;
import divconq.util.StringUtil;
import divconq.xml.XElement;

public class Upper implements IMutator {

	@Override
	public void mutate(Activity activity, StackEntry stack, XElement code, Struct dest) {
		if (dest instanceof StringStruct) {
			StringStruct idest = (StringStruct)dest;
			String val = idest.getValue();
			
			if (StringUtil.isEmpty(val))
				return;

			idest.setValue(val.toUpperCase());
		}
	}
}
