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

fr.boreal.model.kb.impl.KnowledgeBaseImpl Maven / Gradle / Ivy

The newest version!
package fr.boreal.model.kb.impl;

import fr.boreal.model.kb.api.FactBase;
import fr.boreal.model.kb.api.KnowledgeBase;
import fr.boreal.model.kb.api.RuleBase;

/**
 * Default implementation of a KnowledgeBase
 * 
 * @author Florent Tornil
 *
 */
public class KnowledgeBaseImpl implements KnowledgeBase {

	private final FactBase factbase;
	private final RuleBase rulebase;

	/////////////////////////////////////////////////
	// Constructors
	/////////////////////////////////////////////////

	/**
	 * Default constructor
	 * @param factbase the facts
	 * @param rulebase the rules
	 */
	public KnowledgeBaseImpl(FactBase factbase, RuleBase rulebase) {
		this.factbase = factbase;
		this.rulebase = rulebase;
	}

	/////////////////////////////////////////////////
	// Public methods
	/////////////////////////////////////////////////

	/////////////////////////////////////////////////
	// Getters
	/////////////////////////////////////////////////

	@Override
	public FactBase getFactBase() {
		return this.factbase;
	}

	@Override
	public RuleBase getRuleBase() {
		return this.rulebase;
	}

	/////////////////////////////////////////////////
	// Object methods
	/////////////////////////////////////////////////

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + this.getFactBase().hashCode();
		result = prime * result + this.getRuleBase().hashCode();
		return result;
	}

    @Override
	public String toString() {
        return this.factbase.toString() +
                "\n" +
                this.rulebase.toString();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy