<commit_before>// Copyright (C) 2015 by six42, All rights reserved. Contact the author via http://github.com/six42
package six42.fitnesse.jdbcslim;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Set;


public class SheetCommandBase implements SheetCommandInterface {

	protected String command = ""; 
	protected SheetFixture myFixture;
	protected String rawResult = null;
	protected List<List<String>> resultSheet;
	protected boolean success = true;
	private PropertiesLoader loader = new PropertiesLoader();
	

	
	public SheetCommandBase(String configurationOptions,  String rawCommand, String outputFormatOptions) throws FileNotFoundException, IOException{
		parseConfiguration(configurationOptions);
		parseConfigurationString(outputFormatOptions);
		command = getCommandIfMissing(configurationOptions, rawCommand);
		myFixture = new SheetFixture(command,  this); 
	}

	public SheetCommandBase(String configurationOptions,  String rawCommand) throws FileNotFoundException, IOException{
		parseConfiguration(configurationOptions);
		command = getCommandIfMissing(configurationOptions, rawCommand);
		myFixture = new SheetFixture(command,  this); 
	}
	
	public SheetCommandBase(String configurationOptions) throws FileNotFoundException, IOException{
		parseConfiguration(configurationOptions);
		command = getCommandIfMissing(configurationOptions, null);
		myFixture = new SheetFixture(command,  this); 
		
	}


	private String getCommandIfMissing(String propertiesFile, String rawCommand) {
		if (rawCommand == null || rawCommand.isEmpty()){ 
			rawCommand = loader.getProperty("cmd");
			if (rawCommand == null){
				throw new RuntimeException("Mandatory parameter 'cmd' not found in properties  (" + propertiesFile + ")." );
			}
		}<commit_msg>Use constructor overloading instead of repeating code<commit_after>// Copyright (C) 2015 by six42, All rights reserved. Contact the author via http://github.com/six42
package six42.fitnesse.jdbcslim;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Set;


public class SheetCommandBase implements SheetCommandInterface {

	protected String command = ""; 
	protected SheetFixture myFixture;
	protected String rawResult = null;
	protected List<List<String>> resultSheet;
	protected boolean success = true;
	private PropertiesLoader loader = new PropertiesLoader();
	

	
	public SheetCommandBase(String configurationOptions,  String rawCommand, String outputFormatOptions) throws FileNotFoundException, IOException{
		parseConfiguration(configurationOptions);
		if (outputFormatOptions != null) {
			parseConfigurationString(outputFormatOptions);
		}
		command = getCommandIfMissing(configurationOptions, rawCommand);
		myFixture = new SheetFixture(command,  this); 
	}

	public SheetCommandBase(String configurationOptions,  String rawCommand) throws FileNotFoundException, IOException{
		this(configurationOptions, rawCommand, null);
	}
	
	public SheetCommandBase(String configurationOptions) throws FileNotFoundException, IOException{
		this(configurationOptions, null);
	}


	private String getCommandIfMissing(String propertiesFile, String rawCommand) {
		if (rawCommand == null || rawCommand.isEmpty()){ 
			rawCommand = loader.getProperty("cmd");
			if (rawCommand == null){
				throw new RuntimeException("Mandatory parameter 'cmd' not found in properties  (" + propertiesFile + ")." );
			}
		}
{'fraction_non_alphanumeric': 0.0833573694837035, 'fraction_numerical': 0.005768676088837612, 'mean_word_length': 6.135802469135802, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3953949', 'n_tokens_mistral': 959, 'n_tokens_neox': 858, 'n_words': 248}