// Path: ocamljava-dependency-analyzer/src/main/java/mandelbrot/dependency/analyzer/Analyzer.java
// public class Analyzer {
// 
// 	public static Optional<String> moduleNameOfSource(final String source) {
// 		if (StringUtils.isBlank(source))
// 			return Optional.absent();
// 
// 		final String name = new File(source).getName();
// 		final String extension = org.codehaus.plexus.util.FileUtils
// 				.getExtension(name);
// 
// 		final String rawModuleName = name.substring(0, name.length()
// 				- (extension.length() == 0 ? 0 : extension.length()
// 						+ File.separator.length()));
// 
// 		final String lowerCasedName = rawModuleName.toLowerCase();
// 
// 		if (lowerCasedName.isEmpty())
// 			return Optional.absent();
// 
// 		return Optional.of(lowerCasedName);
// 
// 	}
// }


import java.io.File;
import java.util.Comparator;
import mandelbrot.dependency.analyzer.Analyzer;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonSubTypes;
import org.codehaus.jackson.annotate.JsonTypeName;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;

	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true; 
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ModuleDescriptor other = (ModuleDescriptor) obj;
		if (moduleName == null) {
			if (other.moduleName != null)
				return false;
		} else if (!moduleName.equals(other.moduleName))
			return false;
		if (moduleType != other.moduleType)
			return false;
		return true;
	}

	@Override
	public String toString() {
		try {
			return new ObjectMapper().writeValueAsString(this);
		} catch (final Exception e) {
			throw new RuntimeException(e);
		}
	}

	public static ModuleKey fromFile(final File sourceFile) {
// Path: ocamljava-dependency-analyzer/src/main/java/mandelbrot/dependency/analyzer/Analyzer.java
// public class Analyzer {
// 
// 	public static Optional<String> moduleNameOfSource(final String source) {
// 		if (StringUtils.isBlank(source))
// 			return Optional.absent();
// 
// 		final String name = new File(source).getName();
// 		final String extension = org.codehaus.plexus.util.FileUtils
// 				.getExtension(name);
// 
// 		final String rawModuleName = name.substring(0, name.length()
// 				- (extension.length() == 0 ? 0 : extension.length()
// 						+ File.separator.length()));
// 
// 		final String lowerCasedName = rawModuleName.toLowerCase();
// 
// 		if (lowerCasedName.isEmpty())
// 			return Optional.absent();
// 
// 		return Optional.of(lowerCasedName);
// 
// 	}
// }


// Path: ocamljava-dependency-analyzer/src/main/java/mandelbrot/dependency/data/ModuleKey.java
import java.io.File;
import java.util.Comparator;
import mandelbrot.dependency.analyzer.Analyzer;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonSubTypes;
import org.codehaus.jackson.annotate.JsonTypeName;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;


	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true; 
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ModuleDescriptor other = (ModuleDescriptor) obj;
		if (moduleName == null) {
			if (other.moduleName != null)
				return false;
		} else if (!moduleName.equals(other.moduleName))
			return false;
		if (moduleType != other.moduleType)
			return false;
		return true;
	}

	@Override
	public String toString() {
		try {
			return new ObjectMapper().writeValueAsString(this);
		} catch (final Exception e) {
			throw new RuntimeException(e);
		}
	}

	public static ModuleKey fromFile(final File sourceFile) {
		return new ModuleKey.Builder().setModuleName(Analyzer.moduleNameOfSource(sourceFile.getPath()).get())