astra.cartago.CartagoProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of astra-cartago Show documentation
Show all versions of astra-cartago Show documentation
Base project for ASTRA applications
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();
}
}