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

astra.cartago.CartagoProperty Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package astra.cartago;

import astra.formula.Formula;
import astra.formula.Predicate;
import astra.reasoner.util.LogicVisitor;
import cartago.ArtifactId;

public class CartagoProperty implements Formula {
	/**
	 *
	 */
	private static final long serialVersionUID = 6586114441811064259L;
	
	ArtifactId aid;
	Predicate content;
	
	public CartagoProperty(ArtifactId aid, Predicate content) {
		this.aid = aid;
		this.content = content;
	}

	public CartagoProperty(Predicate content) {
		this.content = content;
	}

	@Override
	public Object accept(LogicVisitor visitor) {
		return visitor.visit(this);
	}

	public Predicate content() {
		return content;
	}

	public ArtifactId target() {
		return aid;
	}

	@Override
	public boolean matches(Formula formula) {
		if (formula instanceof CartagoProperty) {
			CartagoProperty p = (CartagoProperty) formula;
			return aid.equals(p.aid) && content.matches(p.content);
		}
		return false;
	}
	
	public String toString() {
		return "CARTAGO."+content.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy