gt: 						   List<Object> toConvert = info.getValues();
context: /*******************************************************************************
   * Copyright (C) 2006-2013 AITIA International, Inc.
   * 
   * This program 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.
   * 
   * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
   ******************************************************************************/
  package ai.aitia.meme.paramsweep.internal.platform;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.swing.tree.DefaultMutableTreeNode;
  import javax.swing.tree.DefaultTreeModel;
  import javax.swing.tree.TreeNode;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.NodeList;
  import org.w3c.dom.Text;
  
  import ai.aitia.meme.paramsweep.batch.output.BreedNonRecordableInfo;
  import ai.aitia.meme.paramsweep.batch.output.NonRecordableFunctionInfo;
  import ai.aitia.meme.paramsweep.batch.output.NonRecordableInfo;
  import ai.aitia.meme.paramsweep.batch.output.RecordableInfo;
  import ai.aitia.meme.paramsweep.batch.output.RecorderInfo;
  import ai.aitia.meme.paramsweep.batch.param.AbstractParameterInfo;
  import ai.aitia.meme.paramsweep.batch.param.AbstractParameterInfo.ValueType;
  import ai.aitia.meme.paramsweep.batch.param.ISubmodelParameterInfo;
  import ai.aitia.meme.paramsweep.batch.param.IncrementalParameterInfo;
  import ai.aitia.meme.paramsweep.batch.param.ParameterNode;
  import ai.aitia.meme.paramsweep.batch.param.ParameterTree;
  import ai.aitia.meme.paramsweep.batch.param.SubmodelIncrementalParameterInfo;
  import ai.aitia.meme.paramsweep.batch.param.SubmodelInfo;
  import ai.aitia.meme.paramsweep.batch.param.SubmodelParameterInfo;
  import ai.aitia.meme.paramsweep.generator.WizardSettingsManager;
  import ai.aitia.meme.paramsweep.gui.info.ArgsFunctionMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.ChooserParameterInfo;
  import ai.aitia.meme.paramsweep.gui.info.ExtendedOperatorGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.GeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.ISubmodelGUIInfo;
  import ai.aitia.meme.paramsweep.gui.info.MemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.MultiColumnOperatorGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.NLBreedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.NLSimpleGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.OneArgFunctionMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.OperatorGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.ParameterInfo;
  import ai.aitia.meme.paramsweep.gui.info.RecordableElement;
  import ai.aitia.meme.paramsweep.gui.info.RepastSMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.RepastSRecordableElement;
  import ai.aitia.meme.paramsweep.gui.info.ResultInfo;
  import ai.aitia.meme.paramsweep.gui.info.ScriptGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.SimpleGeneratedMemberInfo;
  import ai.aitia.meme.paramsweep.gui.info.TimeInfo;
  import ai.aitia.meme.paramsweep.gui.info.TimeInfo.WriteMode;
  import ai.aitia.meme.paramsweep.internal.platform.PlatformSettings.UnsupportedPlatformException;
  import ai.aitia.meme.paramsweep.platform.PlatformManager.PlatformType;
  import ai.aitia.meme.paramsweep.platform.mason.info.MasonChooserParameterInfo;
  import ai.aitia.meme.paramsweep.platform.mason.info.MasonChooserSubmodelParameterInfo;
  import ai.aitia.meme.paramsweep.platform.mason.info.MasonIntervalParameterInfo;
  import ai.aitia.meme.paramsweep.platform.mason.info.MasonIntervalSubmodelParameterInfo;
  import ai.aitia.meme.paramsweep.platform.netlogo.impl.NetLogoChooserParameterInfo;
  import ai.aitia.meme.paramsweep.platform.netlogo.info.NLStatisticGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.impl.ModelGenerator;
  import ai.aitia.meme.paramsweep.platform.repast.info.ExtendedOperatorGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.info.GeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.info.MultiColumnOperatorGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.info.OperatorGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.info.ScriptGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.repast.info.StatisticGeneratedRecordableInfo;
  import ai.aitia.meme.paramsweep.platform.simphony.impl.info.RepastSRecordableInfo;
  import ai.aitia.meme.paramsweep.utils.AssistantMethod;
  import ai.aitia.meme.paramsweep.utils.PlatformConstants;
  import ai.aitia.meme.paramsweep.utils.UserDefinedVariable;
  import ai.aitia.meme.paramsweep.utils.Util;
  import ai.aitia.meme.paramsweep.utils.Utilities;
  import ai.aitia.meme.paramsweep.utils.WizardLoadingException;
  
  public class InfoConverter {
  	
  	protected static final int UNKNOWN_TYPE 	= -1;
  	protected static final int BOOLEAN_TYPE 	= 0;
  	protected static final int INTEGER_TYPE 	= 1;
  	protected static final int DOUBLE_TYPE 		= 2;
  	protected static final int FLOAT_TYPE 		= 3;
  	protected static final int LONG_TYPE 		= 4;
  	protected static final int BYTE_TYPE 		= 5;
  	protected static final int SHORT_TYPE 		= 6;
  	protected static final int STRING_TYPE 		= 7;
  	protected static final int FILE_TYPE		= 8;
  	
  	private static final String STOP_CODE 		= "STOP=";
  	private static final String REC_CODE		= "REC=";
  	private static final String END_CONSTANT	= "END";
  	private static final String WRITE_CODE		= "WRITE="; 
  	
  	//====================================================================================================
  	// methods
  	
  	//----------------------------------------------------------------------------------------------------
  	public static RecordableElement recordableInfo2RecordableElement(RecordableInfo info) {
  		switch (PlatformSettings.getPlatformType()) { // TODO: finish
  		case REPAST 	: return _RepastJRecordableInfo2RecordableElement(info);
  		case SIMPHONY 	: return _RepastSRecordableInfo2RecordableElement(info);
  		case TRASS		:
  		case EMIL		: return _EMILRecordableInfo2RecordableElement(info);
  		case MASON		:
  		case SIMPHONY2	:
  		case CUSTOM		: return _CustomJavaRecordableInfo2RecordableElement(info);
  		case NETLOGO5	:
  		case NETLOGO	: return _NetLogoRecordableInfo2RecordableElement(info);
  		default			: throw new UnsupportedPlatformException(PlatformSettings.getPlatformType().toString());
  
  		}
  	}
  	
  	//----------------------------------------------------------------------------------------------------
  	@SuppressWarnings({ "unchecked", "rawtypes" })
  	public static AbstractParameterInfo<?> parameterInfo2ParameterInfo(ParameterInfo info) {
  		AbstractParameterInfo<?> convertedInfo = null;
  		switch (getTypeNo(info.getType())) {
  		case BOOLEAN_TYPE : // Boolean
  							convertedInfo =	info.isSubmodelParameter() ?
  											  new SubmodelParameterInfo<Boolean>(info.getName(),"",false,
  													  							 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  											: new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Boolean>(info.getName(),"",false);
  							if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  								((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Boolean>)convertedInfo).setValue((Boolean)info.getValue());
  							else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  								ArrayList<Boolean> values = new ArrayList<Boolean>();
  								List<Object> toConvert = info.getValues();
  								for (int i = 0;i < toConvert.size();++i ) 
  									values.add((Boolean)toConvert.get(i));
  								((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Boolean>)convertedInfo).setValues(values);
  							}
  							break;
  		case INTEGER_TYPE : // Integer
  							if (info.isSubmodelParameter()) {
  								convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  										new SubmodelIncrementalParameterInfo<Integer>(info.getName(),"",0,
  																					 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  									 :  new SubmodelParameterInfo<Integer>(info.getName(),"",0,
  											 							   submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  							} else {
  								convertedInfo =	info.getDefinitionType() == ParameterInfo.INCR_DEF ? 
  										new IncrementalParameterInfo<Integer>(info.getName(),"",0) :
  										new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Integer>(info.getName(),"",0);
  							}
  							if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  								((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Integer>)convertedInfo).setValue((Integer)info.getValue());
  							else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  								ArrayList<Integer> values = new ArrayList<Integer>();
  								List<Object> toConvert = info.getValues();
  								for (int i = 0;i < toConvert.size();++i )
  									values.add((Integer)toConvert.get(i));
  								((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Integer>)convertedInfo).setValues(values);
  							} else if (info.getDefinitionType()	== ParameterInfo.INCR_DEF) 
  								((IncrementalParameterInfo<Integer>)convertedInfo).setValues((Integer)info.getStartValue(),
  																							 (Integer)info.getEndValue(),(Integer)info.getStep());
  							break;
  		case DOUBLE_TYPE : // Double
  						   if (info.isSubmodelParameter()) {
  							   convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									   new SubmodelIncrementalParameterInfo<Double>(info.getName(),"",0.0,
  											   										submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent())) 
  									 : new SubmodelParameterInfo<Double>(info.getName(),"",0.0,
  											 							 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  						   } else {
  							   convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ? 
  									   new IncrementalParameterInfo<Double>(info.getName(),"",0.0) :
  									   new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Double>(info.getName(),"",0.0);
  						   }
  						   if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  							   ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Double>)convertedInfo).setValue((Double)info.getValue());
  						   else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  							   ArrayList<Double> values = new ArrayList<Double>();
  							   List<Object> toConvert = info.getValues();
  							   for (int i = 0;i < toConvert.size();++i) 
  								   values.add((Double)toConvert.get(i));
  							   ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Double>)convertedInfo).setValues(values);
  						   } else if (info.getDefinitionType() == ParameterInfo.INCR_DEF) 
  							   ((IncrementalParameterInfo<Double>)convertedInfo).setValues((Double)info.getStartValue(),(Double)info.getEndValue(),
  													  									   (Double)info.getStep());
  						   break;
  		case FLOAT_TYPE : // Float
  						  if (info.isSubmodelParameter()) {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new SubmodelIncrementalParameterInfo<Float>(info.getName(),"",0f,
  											 									  submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  							       : new SubmodelParameterInfo<Float>(info.getName(),"",0f,
  							    		   							  submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  						  } else {
  							  convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									  new IncrementalParameterInfo<Float>(info.getName(),"",0f) :
  									  new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Float>(info.getName(),"",0f);
  						  }
  						  if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  							  ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Float>)convertedInfo).setValue((Float)info.getValue());
  						  else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  							  ArrayList<Float> values = new ArrayList<Float>();
  							  List<Object> toConvert = info.getValues();
  							  for (int i = 0;i < toConvert.size();++i) 
  								  values.add((Float)toConvert.get(i));
  							  ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Float>)convertedInfo).setValues(values);
  						  } else if (info.getDefinitionType() == ParameterInfo.INCR_DEF) 
  							  ((IncrementalParameterInfo<Float>)convertedInfo).setValues((Float)info.getStartValue(),(Float)info.getEndValue(),
  													  									 (Float)info.getStep());
  						  break;
  		case LONG_TYPE : // Long
  						 if (info.isSubmodelParameter()) {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new SubmodelIncrementalParameterInfo<Long>(info.getName(),"",0L,
  											 									submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  								   : new SubmodelParameterInfo<Long>(info.getName(),"",0L,
  										   							 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  						 } else {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new IncrementalParameterInfo<Long>(info.getName(),"",0L) :
  									 new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Long>(info.getName(),"",0L);
  							 
  						 }
  						 if (info.getDefinitionType() == ParameterInfo.CONST_DEF)
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Long>)convertedInfo).setValue((Long)info.getValue());
  						 else if (info.getDefinitionType() == ParameterInfo.LIST_DEF ){
  							 ArrayList<Long> values = new ArrayList<Long>();
  							 List<Object> toConvert = info.getValues();
  							 for (int i = 0;i < toConvert.size();++i)
  								 values.add((Long)toConvert.get(i));
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Long>)convertedInfo).setValues(values);
  						 } else if (info.getDefinitionType() == ParameterInfo.INCR_DEF) 
  							 ((IncrementalParameterInfo<Long>)convertedInfo).setValues((Long)info.getStartValue(),(Long)info.getEndValue(),
  													  								   (Long)info.getStep());
  						 break;
  		case BYTE_TYPE : // Byte
  						 if (info.isSubmodelParameter()) {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new SubmodelIncrementalParameterInfo<Byte>(info.getName(),"",new Byte("0"),
  											 									submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  								   : new SubmodelParameterInfo<Byte>(info.getName(),"",new Byte("0"),
  										   							 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  						 } else {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new IncrementalParameterInfo<Byte>(info.getName(),"",new Byte("0")) :
  									 new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Byte>(info.getName(),"",new Byte("0"));
  						 }
  						 if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Byte>)convertedInfo).setValue((Byte)info.getValue());
  						 else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  							 ArrayList<Byte> values = new ArrayList<Byte>();
  							 List<Object> toConvert = info.getValues();
  							 for (int i = 0;i < toConvert.size();++i) 
  								 values.add((Byte)toConvert.get(i));
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Byte>)convertedInfo).setValues(values);
  						 } else if (info.getDefinitionType() == ParameterInfo.INCR_DEF) 
  							 ((IncrementalParameterInfo<Byte>)convertedInfo).setValues((Byte)info.getStartValue(),(Byte)info.getEndValue(),
  													  								   (Byte)info.getStep());
  						 break;
  		case SHORT_TYPE : // Short
  						 if (info.isSubmodelParameter()) {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new SubmodelIncrementalParameterInfo<Short>(info.getName(),"",(short)0,
  											 									 submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  								   : new SubmodelParameterInfo<Short>(info.getName(),"",(short)0,
  										   							  submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()));
  						 } else {
  							 convertedInfo = info.getDefinitionType() == ParameterInfo.INCR_DEF ?
  									 new IncrementalParameterInfo<Short>(info.getName(),"",(short)0) :
  									 new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Short>(info.getName(),"",(short)0);
  						 }
  						 if (info.getDefinitionType() == ParameterInfo.CONST_DEF) 
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Short>)convertedInfo).setValue((Short)info.getValue());
  						 else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  							 ArrayList<Short> values = new ArrayList<Short>();
  							 List<Object> toConvert = info.getValues();
  							 for (int i = 0;i < toConvert.size();++i)
  								 values.add((Short)toConvert.get(i));
  							 ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<Short>)convertedInfo).setValues(values);
  						 } else if (info.getDefinitionType() == ParameterInfo.INCR_DEF) 
  							 ((IncrementalParameterInfo<Short>)convertedInfo).setValues((Short)info.getStartValue(),(Short)info.getEndValue(),
  													  									(Short)info.getStep());
  						 break;
  		case STRING_TYPE : // String
  						  convertedInfo = info.isSubmodelParameter() ?
  								  	new SubmodelParameterInfo<String>(info.getName(),"","",submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  								  : new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<String>(info.getName(),"","");
  						   if (info.getDefinitionType() == ParameterInfo.CONST_DEF)
  							   ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<String>)convertedInfo).setValue((String)info.getValue());
  						   else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  							   ArrayList<String> values = new ArrayList<String>();
  							   List<Object> toConvert = info.getValues();
  							   for (int i = 0;i < toConvert.size();++i)
  								   values.add((String)toConvert.get(i));
  							   ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<String>)convertedInfo).setValues(values);
  						   }
  						   break;
  		case FILE_TYPE: // File
  					    convertedInfo = info.isSubmodelParameter() ?
  					    		  new SubmodelParameterInfo<File>(info.getName(),"",new File(""),submodelInfo2submodelInfo(((ISubmodelGUIInfo)info).getParent()))
  					    		: new ai.aitia.meme.paramsweep.batch.param.ParameterInfo<File>(info.getName(),"", new File(""));
  					   if (info.getDefinitionType() == ParameterInfo.CONST_DEF)
  						   ((ai.aitia.meme.paramsweep.batch.param.ParameterInfo<File>)convertedInfo).setValue((File)info.getValue());
  					   else if (info.getDefinitionType() == ParameterInfo.LIST_DEF) {
  						   ArrayList<File> values = new ArrayList<File>();
  