public <T extends Object> XConnection createConnection( final T connectionObject, final ConnectionMapping<T> connectionMapping, final Procedure1<? super XConnection> initializer, final InterpreterContext context) { boolean _isApplicable = connectionMapping.isApplicable(connectionObject); if (_isApplicable) { final ConnectionMapping<T> connectionMappingCasted = ((ConnectionMapping<T>) connectionMapping); final IMappedElementDescriptor<T> descriptor = this.<T>getDescriptor(connectionObject, connectionMappingCasted); boolean _equals = Objects.equal(descriptor, null); if (_equals) { return null; } final XConnection existingConnection = context.getConnection(descriptor); boolean _or = false; boolean _notEquals = (!Objects.equal(existingConnection, null)); if (_notEquals) { _or = true; } else { boolean _isCreateConnections = context.isCreateConnections(); boolean _not = (!_isCreateConnections); _or = _not; } if (_or) { return existingConnection; } final XConnection connection = connectionMappingCasted.createConnection(descriptor); XDiagramConfig _config = connectionMappingCasted.getConfig(); _config.initialize(connection); List<AbstractLabelMappingCall<?, T>> _labels = connectionMapping.getLabels(); final Consumer<AbstractLabelMappingCall<?, T>> _function = (AbstractLabelMappingCall<?, T> it) -> { ObservableList<XConnectionLabel> _labels_1 = connection.getLabels(); Iterable<? extends XLabel> _execute = this.execute(it, connectionObject); Iterable<XConnectionLabel> _filter = Iterables.<XConnectionLabel>filter(_execute, XConnectionLabel.class); Iterables.<XConnectionLabel>addAll(_labels_1, _filter); }; _labels.forEach(_function); initializer.apply(connection); this.<T>createEndpoints(connectionMapping, connectionObject, connection, context); boolean _and = false; XNode _source = connection.getSource(); boolean _notEquals_1 = (!Objects.equal(_source, null)); if (!_notEquals_1) { _and = false; } else { XNode _target = connection.getTarget(); boolean _notEquals_2 = (!Objects.equal(_target, null)); _and = _notEquals_2; } if (_and) { context.addConnection(connection); return connection; } } return null; }
protected <T extends Object> void createEndpoints( final ConnectionMapping<T> connectionMapping, final T connectionObject, final XConnection connection, final InterpreterContext context) { boolean _and = false; XNode _source = connection.getSource(); boolean _equals = Objects.equal(_source, null); if (!_equals) { _and = false; } else { NodeMappingCall<?, T> _source_1 = connectionMapping.getSource(); boolean _notEquals = (!Objects.equal(_source_1, null)); _and = _notEquals; } if (_and) { NodeMappingCall<?, T> _source_2 = connectionMapping.getSource(); Iterable<XNode> _execute = null; if (_source_2 != null) { _execute = this.execute(_source_2, connectionObject, context); } XNode _head = IterableExtensions.<XNode>head(_execute); connection.setSource(_head); } boolean _and_1 = false; XNode _target = connection.getTarget(); boolean _equals_1 = Objects.equal(_target, null); if (!_equals_1) { _and_1 = false; } else { NodeMappingCall<?, T> _target_1 = connectionMapping.getTarget(); boolean _notEquals_1 = (!Objects.equal(_target_1, null)); _and_1 = _notEquals_1; } if (_and_1) { NodeMappingCall<?, T> _target_2 = connectionMapping.getTarget(); Iterable<XNode> _execute_1 = null; if (_target_2 != null) { _execute_1 = this.execute(_target_2, connectionObject, context); } XNode _head_1 = IterableExtensions.<XNode>head(_execute_1); connection.setTarget(_head_1); } }