All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.learning.framework.NumericAttributeSpecification Maven / Gradle / Ivy

Go to download

AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.

The newest version!
package aima.core.learning.framework;

/**
 * @author Ravi Mohan
 * 
 */
public class NumericAttributeSpecification implements AttributeSpecification {

	// a simple attribute representing a number represented as a double .
	private String name;

	public NumericAttributeSpecification(String name) {
		this.name = name;
	}

	public boolean isValid(String string) {
		try {
			Double.parseDouble(string);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	public String getAttributeName() {
		return name;
	}

	public Attribute createAttribute(String rawValue) {
		return new NumericAttribute(Double.parseDouble(rawValue), this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy