public <T extends Object> XNode createNode( final T nodeObject, final NodeMapping<T> nodeMapping, final InterpreterContext context) { boolean _isApplicable = nodeMapping.isApplicable(nodeObject); if (_isApplicable) { final IMappedElementDescriptor<T> descriptor = this.<T>getDescriptor(nodeObject, nodeMapping); boolean _equals = Objects.equal(descriptor, null); if (_equals) { return null; } boolean _isCreateDuplicateNodes = context.isCreateDuplicateNodes(); boolean _not = (!_isCreateDuplicateNodes); if (_not) { final XNode existingNode = context.getNode(descriptor); boolean _or = false; boolean _notEquals = (!Objects.equal(existingNode, null)); if (_notEquals) { _or = true; } else { boolean _isCreateNodes = context.isCreateNodes(); boolean _not_1 = (!_isCreateNodes); _or = _not_1; } if (_or) { return existingNode; } } final XNode node = nodeMapping.createNode(descriptor); XDiagramConfig _config = nodeMapping.getConfig(); _config.initialize(node); context.addNode(node); boolean _isCreateConnections = context.isCreateConnections(); if (_isCreateConnections) { List<AbstractConnectionMappingCall<?, T>> _incoming = nodeMapping.getIncoming(); final Consumer<AbstractConnectionMappingCall<?, T>> _function = (AbstractConnectionMappingCall<?, T> it) -> { boolean _isOnDemand = it.isOnDemand(); boolean _not_2 = (!_isOnDemand); if (_not_2) { final Procedure1<XConnection> _function_1 = (XConnection it_1) -> { it_1.setTarget(node); }; this.execute(it, nodeObject, _function_1, context); } }; _incoming.forEach(_function); List<AbstractConnectionMappingCall<?, T>> _outgoing = nodeMapping.getOutgoing(); final Consumer<AbstractConnectionMappingCall<?, T>> _function_1 = (AbstractConnectionMappingCall<?, T> it) -> { boolean _isOnDemand = it.isOnDemand(); boolean _not_2 = (!_isOnDemand); if (_not_2) { final Procedure1<XConnection> _function_2 = (XConnection it_1) -> { it_1.setSource(node); }; this.execute(it, nodeObject, _function_2, context); } }; _outgoing.forEach(_function_1); } List<AbstractLabelMappingCall<?, T>> _labels = nodeMapping.getLabels(); final Consumer<AbstractLabelMappingCall<?, T>> _function_2 = (AbstractLabelMappingCall<?, T> it) -> { ObservableList<XLabel> _labels_1 = node.getLabels(); Iterable<? extends XLabel> _execute = this.execute(it, nodeObject); Iterables.<XLabel>addAll(_labels_1, _execute); }; _labels.forEach(_function_2); if ((node instanceof XDiagramContainer)) { DiagramMappingCall<?, T> _nestedDiagram = nodeMapping.getNestedDiagram(); XDiagram _execute = null; if (_nestedDiagram != null) { XDiagram _xDiagram = new XDiagram(); InterpreterContext _interpreterContext = new InterpreterContext(_xDiagram, context); _execute = this.execute(_nestedDiagram, nodeObject, _interpreterContext); } ((XDiagramContainer) node).setInnerDiagram(_execute); } return node; } else { return null; } }
protected <T extends Object> void connectNodesEagerly( final AbstractNodeMappingCall<?, T> it, final T diagramObject, final Set<ConnectionMapping<?>> eagerConnections, final InterpreterContext context) { final Iterable<?> nodeObjects = this.select(it, diagramObject); NodeMapping<?> _nodeMapping = it.getNodeMapping(); final NodeMapping<Object> nodeMappingCasted = ((NodeMapping<Object>) _nodeMapping); for (final Object nodeObject : nodeObjects) { { final IMappedElementDescriptor<Object> descriptor = this.<Object>getDescriptor(nodeObject, nodeMappingCasted); final XNode node = context.getNode(descriptor); boolean _notEquals = (!Objects.equal(node, null)); if (_notEquals) { List<AbstractConnectionMappingCall<?, Object>> _incoming = nodeMappingCasted.getIncoming(); final Function1<AbstractConnectionMappingCall<?, Object>, Boolean> _function = (AbstractConnectionMappingCall<?, Object> it_1) -> { boolean _and = false; boolean _isOnDemand = it_1.isOnDemand(); if (!_isOnDemand) { _and = false; } else { AbstractMapping<?> _mapping = it_1.getMapping(); boolean _contains = eagerConnections.contains(_mapping); _and = _contains; } return Boolean.valueOf(_and); }; Iterable<AbstractConnectionMappingCall<?, Object>> _filter = IterableExtensions.<AbstractConnectionMappingCall<?, Object>>filter( _incoming, _function); final Consumer<AbstractConnectionMappingCall<?, Object>> _function_1 = (AbstractConnectionMappingCall<?, Object> it_1) -> { final Procedure1<XConnection> _function_2 = (XConnection it_2) -> { it_2.setTarget(node); }; this.execute(it_1, nodeObject, _function_2, context); }; _filter.forEach(_function_1); List<AbstractConnectionMappingCall<?, Object>> _outgoing = nodeMappingCasted.getOutgoing(); final Function1<AbstractConnectionMappingCall<?, Object>, Boolean> _function_2 = (AbstractConnectionMappingCall<?, Object> it_1) -> { boolean _and = false; boolean _isOnDemand = it_1.isOnDemand(); if (!_isOnDemand) { _and = false; } else { AbstractMapping<?> _mapping = it_1.getMapping(); boolean _contains = eagerConnections.contains(_mapping); _and = _contains; } return Boolean.valueOf(_and); }; Iterable<AbstractConnectionMappingCall<?, Object>> _filter_1 = IterableExtensions.<AbstractConnectionMappingCall<?, Object>>filter( _outgoing, _function_2); final Consumer<AbstractConnectionMappingCall<?, Object>> _function_3 = (AbstractConnectionMappingCall<?, Object> it_1) -> { final Procedure1<XConnection> _function_4 = (XConnection it_2) -> { it_2.setSource(node); }; this.execute(it_1, nodeObject, _function_4, context); }; _filter_1.forEach(_function_3); } } } }