package pete.metrics.adaptability;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public final class AdaptableElement {

	private final String name;

	private final List<String> adaptions;

	private String locatorExpression = "//*[local-name() = 'definitions']";

	public AdaptableElement(String name) {
		this.name = name;
		adaptions = new ArrayList<>();
	}

	public void addAdaption(String adaption) {
		adaptions.add(adaption);
	}

	public List<String> getAdaptions() {
		return Collections.unmodifiableList(adaptions);
	}

	public int getNumberOfAdaptions() {
		return adaptions.size();
	}

	public String getName() {
		return name;
	}

	public int getAdaptabilityScore() {
		return adaptions.size();
	}

	public String getLocatorExpression() {
		return locatorExpression;
	}

	public void setLocatorExpression(String locatorExpression) {
		this.locatorExpression += locatorExpression;
	}

}

@@ -219,16 +219,48 @@
 tions;%0A%0A
+%09private String documentation;%0A%0A
 %09private
@@ -361,24 +361,115 @@
 ing name) %7B%0A
+%09%09if (name == null) %7B%0A%09%09%09throw new IllegalArgumentException(%22name must not be null%22);%0A%09%09%7D%0A%0A
 %09%09this.name 
@@ -505,24 +505,46 @@
 ayList%3C%3E();%0A
+%09%09documentation = %22%22;%0A
 %09%7D%0A%0A%09public 
@@ -579,16 +579,43 @@
 tion) %7B%0A
+%09%09if (adaption != null) %7B%0A%09
 %09%09adapti
@@ -633,16 +633,20 @@
 ption);%0A
+%09%09%7D%0A
 %09%7D%0A%0A%09pub
@@ -1049,16 +1049,55 @@
 sion) %7B%0A
+%09%09if (!(locatorExpression == null)) %7B%0A%09
 %09%09this.l
@@ -1131,18 +1131,257 @@
 Expression;%0A
+%09%09%7D%0A%09%7D%0A%0A%09public String getDocumentation() %7B%0A%09%09return documentation;%0A%09%7D%0A%0A%09public void setDocumentation(String documentation) %7B%0A%09%09if (documentation == null) %7B%0A%09%09%09this.documentation = %22%22;%0A%09%09%7D else %7B%0A%09%09%09this.documentation = documentation;%0A%09%09%7D%0A
 %09%7D%0A%0A%7D%0A

Add documentation field and parameter validation