import org.simantics.structural2.modelingRules.IConnectionPoint;
import org.simantics.structural2.modelingRules.IModelingRules;
import org.simantics.structural2.modelingRules.Policy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MappedModelingRules extends AbstractModelingRules {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MappedModelingRules.class);
IModelingRules baseRules;
IMapping mapping;
ModelingResources MOD = ModelingResources.getInstance(g);
if(Policy.DEBUG_STANDARD_MODELING_RULES)
- System.out.println("setConnectionType(" + NameUtils.getSafeName(g, connection) + ", " + NameUtils.getSafeName(g, connectionType) + ")");
+ LOGGER.info("setConnectionType(" + NameUtils.getSafeName(g, connection) + ", " + NameUtils.getSafeName(g, connectionType) + ")");
RelatedDiagramConnections rdc = new RelatedDiagramConnections(g);
rdc.addConnection(connection);
if(cp == null)
throw new IllegalArgumentException("Null connection point encountered.");
if(Policy.DEBUG_STANDARD_MODELING_RULES)
- System.out.println("Mapping CP: " + cp.toString(g));
+ LOGGER.info("Mapping CP: " + cp.toString(g));
int mcps = mapping.mapToConnectionPoints(g, cp, mappedConnectionPoints);
if(mcps > 0) {
if(Policy.DEBUG_STANDARD_MODELING_RULES)
for (IConnectionPoint mcpt : mappedConnectionPoints.subList(mappedConnectionPoints.size()-mcps, mappedConnectionPoints.size()))
- System.out.println("Mapped CP: " + mcpt.toString(g));
+ LOGGER.info("Mapped CP: " + mcpt.toString(g));
} else {
if(cp instanceof CPTerminal) {
// TODO move this logic elsewhere
// This is a lifted flag in a structural configuration.
mappedConnectionPoints.add(new CPTerminal(terminal.component, isLiftedAs));
} else {
- // Do nothing, because the flag is not connected
+ mappedConnectionPoints.add(terminal);
}
}
} else if (cp instanceof CPConnection) {
Resource connection) throws DatabaseException {
Resource mappedConnection = mapping.mapConnection(g, connection);
if(mappedConnection == null)
- System.err.println("Connection mapped from " + NameUtils.getSafeName(g, connection, true) + " is null");
+ LOGGER.warn("Connection mapped from " + NameUtils.getSafeName(g, connection, true) + " is null");
return new MappedAttachmentRelationMap(
baseRules.getAttachmentRelations(g, mappedConnection)
);