/*******************************************************************************
 * Copyright (c) 2001, 2008 Mathew A. Nelson and Robocode contributors
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://robocode.sourceforge.net/license/cpl-v10.html
 * 
 * Contributors:
 *     Mathew A. Nelson
 *     - Initial API and implementation
 *******************************************************************************/

private java.lang.String fullClassName = null;
private java.lang.String fullClassNameWithVersion = null;
private java.lang.String uniqueFullClassNameWithVersion = null;
private java.lang.String version = null;
private java.lang.String fullPackage = null;
private java.lang.String rootPackage = null;
private java.lang.String shortClassName = null;
private java.lang.String veryShortClassName = null;
private java.lang.String shortClassNameWithVersion = null;
private java.lang.String veryShortClassNameWithVersion = null;
private java.lang.String uniqueVeryShortClassNameWithVersion = null;
private java.lang.String uniqueShortClassNameWithVersion = null;


public java.lang.String getRootPackage() {
	if (rootPackage == null) {
		if (getFullClassName().indexOf(".") > 0)
			rootPackage=getFullClassName().substring(0,getFullClassName().indexOf("."));
		else
			rootPackage = null;
	}
	return rootPackage;
}

public java.lang.String getShortClassName() {
	if (shortClassName == null) {
		if (getFullClassName().lastIndexOf(".") > 0)
			shortClassName = getFullClassName().substring(getFullClassName().lastIndexOf(".") + 1);
		else
			shortClassName = getFullClassName();
	}
	return shortClassName;
}

public java.lang.String getShortClassNameWithVersion() {
	if (shortClassNameWithVersion == null) {
		if (getVersion().equals("")) {
			shortClassNameWithVersion = getShortClassName();
		}
		else {
			shortClassNameWithVersion = getShortClassName() + " " + getVersion();
		}
	}
	return shortClassNameWithVersion;
}

public java.lang.String getUniqueFullClassNameWithVersion() {
	if (uniqueFullClassNameWithVersion == null) {
		if (getFullClassNameWithVersion().equals(getFullClassName())) {
			uniqueFullClassNameWithVersion = getFullClassName();
		}
		else {
			if (robotSpecification.getFileFromCache() == true)
				uniqueFullClassNameWithVersion = getFullClassNameWithVersion();
			else
				uniqueFullClassNameWithVersion = getFullClassNameWithVersion() + "*";
		}
	}
	return uniqueFullClassNameWithVersion;
}

public java.lang.String getUniqueShortClassNameWithVersion() {
	if (uniqueShortClassNameWithVersion == null) {
		if (getShortClassName().equals(getShortClassNameWithVersion())) {
			uniqueShortClassNameWithVersion = getShortClassName();
		}
		else {
			if (robotSpecification.getFileFromCache() == true)
				uniqueShortClassNameWithVersion = getShortClassNameWithVersion();
			else
				uniqueShortClassNameWithVersion = getShortClassNameWithVersion() + "*";
		}
	}
	return uniqueShortClassNameWithVersion;
}

public java.lang.String getUniqueVeryShortClassNameWithVersion() {
	if (uniqueVeryShortClassNameWithVersion == null) {
		if (getVeryShortClassName().equals(getVeryShortClassNameWithVersion())) {
			uniqueVeryShortClassNameWithVersion = getVeryShortClassName();
		}
		else {
			if (robotSpecification.getFileFromCache() == true)
				uniqueVeryShortClassNameWithVersion = getVeryShortClassNameWithVersion();
			else
				uniqueVeryShortClassNameWithVersion = getVeryShortClassNameWithVersion() + "*";
		}
	}
	return uniqueVeryShortClassNameWithVersion;
}

public java.lang.String getVersion() {
	if (version == null) {
		version = robotSpecification.getRobotVersion();
		if (version == null)
			version = "";
		if (version.length() > 10)
			version = version.substring(0,10);
	}
	return version;
}

public java.lang.String getVeryShortClassName() {
	if (veryShortClassName == null) {
		veryShortClassName = getShortClassName();
		if (veryShortClassName.length() > 12)
			veryShortClassName = veryShortClassName.substring(0,12) + "...";
	}
	return veryShortClassName;
}

public java.lang.String getVeryShortClassNameWithVersion() {
	if (veryShortClassNameWithVersion == null) {
		if (getVersion().equals("")) {
			veryShortClassNameWithVersion = getVeryShortClassName();
		}
		else {
			veryShortClassNameWithVersion = getVeryShortClassName() + " " + getVersion();
		}
	}
	return veryShortClassNameWithVersion;
}

public java.lang.String getFullClassNameWithVersion() {
	if (fullClassNameWithVersion == null) {
		if (getVersion().equals("")) {
			fullClassNameWithVersion = getFullClassName();
		}
		else {
			fullClassNameWithVersion = getFullClassName() + " " + getVersion();
		}
	}
	return fullClassNameWithVersion;
}

public java.lang.String getFullPackage() {
	if (fullPackage == null) {
		if (getFullClassName().lastIndexOf(".") > 0)
			fullPackage=getFullClassName().substring(0,getFullClassName().lastIndexOf("."));
		else
			fullPackage = null;
	}
	return fullPackage;
}