org.coode.oppl.function.RenderingVariableAttribute Maven / Gradle / Ivy
package org.coode.oppl.function;
import org.coode.oppl.Variable;
import org.coode.oppl.bindingtree.BindingNode;
import org.coode.oppl.rendering.ManchesterSyntaxRenderer;
import org.semanticweb.owlapi.model.OWLObject;
/** @author Luigi Iannone */
public class RenderingVariableAttribute extends VariableAttribute {
/** @param variable
* variable */
public RenderingVariableAttribute(Variable> variable) {
super(variable, AttributeName.RENDERING);
}
@Override
public P accept(OPPLFunctionVisitorEx
visitor) {
return visitor.visitRenderingVariableAttribute(this);
}
@Override
public void accept(OPPLFunctionVisitor visitor) {
visitor.visitRenderingVariableAttribute(this);
}
@Override
public ValueComputation getValueComputation(
final ValueComputationParameters parameters) {
return new ValueComputation() {
@Override
public String compute(OPPLFunction extends String> opplFunction) {
String toReturn = null;
BindingNode bindingNode = parameters.getBindingNode();
OWLObject assignmentValue = bindingNode.getAssignmentValue(
RenderingVariableAttribute.this.getVariable(), parameters);
if (assignmentValue != null) {
ManchesterSyntaxRenderer renderer = parameters
.getConstraintSystem()
.getOPPLFactory()
.getManchesterSyntaxRenderer(parameters.getConstraintSystem());
assignmentValue.accept(renderer);
toReturn = renderer.toString();
}
return toReturn;
}
};
}
}