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

aima.core.logic.fol.kb.data.ReducedLiteral Maven / Gradle / Ivy

package aima.core.logic.fol.kb.data;

import aima.core.logic.fol.parsing.ast.AtomicSentence;

/**
 * @see Reduced Literal
 * 
 * @author Ciaran O'Reilly
 * 
 */
public class ReducedLiteral extends Literal {
	private String strRep = null;

	public ReducedLiteral(AtomicSentence atom) {
		super(atom);
	}

	public ReducedLiteral(AtomicSentence atom, boolean negated) {
		super(atom, negated);
	}

	@Override
	public Literal newInstance(AtomicSentence atom) {
		return new ReducedLiteral(atom, isNegativeLiteral());
	}

	@Override
	public String toString() {
		if (null == strRep) {
			StringBuilder sb = new StringBuilder();
			sb.append("[");
			if (isNegativeLiteral()) {
				sb.append("~");
			}
			sb.append(getAtomicSentence().toString());
			sb.append("]");
			strRep = sb.toString();
		}

		return strRep;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy