// -- FUNCTIONS -- // finishes creating connection/adds connection to both involved nodes // returns true on success, false on failure public bool completeConnection(Node other) { m_end = other; if (m_outNode == null) { m_outNode = other; } else { m_inNode = other; } // make sure the nodes aren't the same and are not both inputs or outputs if (m_origin.Equals(m_end) || m_origin.isInput() == m_end.isInput() || m_origin.getParent() == m_end.getParent() || !m_origin.getDatatype().fits(m_end.getDatatype())) { m_graphic.removeGraphic(); return false; } if(!m_origin.getDatatype().equals(m_end.getDatatype())) { m_graphic.setStrokeColor(Colors.Red); } // set end point to end node center m_graphic.finishVisualConnection(m_end); m_completed = true; int inputRepID = m_inNode.getParent().getID(); int inputNodeID = m_inNode.getGroupNum(); int outputRepID = m_outNode.getParent().getID(); int outputNodeID = m_outNode.getGroupNum(); Master.log("Connection created - OutputID: " + outputRepID + " (out-node " + outputNodeID + ") InputID: " + inputRepID + " (in-node " + inputNodeID + ")"); return true; }