public MergeInputPort createMergeInputPort(Merge merge, String name, int depth) { if (merge instanceof MergeImpl) { return new MergeInputPortImpl((MergeImpl) merge, name, depth); } else { return null; } }
sink.addContent(portElement); } else if (dataLinkSinkType == DATALINK_TYPES.MERGE) { Merge m = ((MergeInputPortImpl) link.getSink()).getMergeInstance(); ProcessorPort processorPort = (ProcessorPort) ((Datalink) m .getOutputPort().getOutgoingLinks().toArray()[0]).getSink();
public boolean doTypeCheck() throws IterationTypeMismatchException { if (inputs.size() == 0) { // Arguable, but technically a merge with no inputs is valid, it may // make more sense to throw an exception here though as it has no // actual meaning. return true; } // Return false if we have unbound input ports or bound ports where the // resolved depth hasn't been calculated yet for (MergeInputPort ip : inputs) { if (ip.getIncomingLink() == null || ip.getIncomingLink().getResolvedDepth() == -1) { return false; } } // Got all input ports, now scan for input depths int inputDepth = inputs.get(0).getIncomingLink().getResolvedDepth(); for (MergeInputPort ip : inputs) { if (ip.getIncomingLink().getResolvedDepth() != inputDepth) { throw new IterationTypeMismatchException(); } } // Got to here so all the input resolved depths match, push depth+1 to // all outgoing links and return true for (DatalinkImpl dli : output.outgoingLinks) { dli.setResolvedDepth(inputDepth+1); } return true; } }
@Override protected void doEditAction(DatalinkImpl datalink) throws EditException { EventForwardingOutputPort source = datalink.getSource(); EventHandlingInputPort sink = datalink.getSink(); if (source instanceof BasicEventForwardingOutputPort) { ((BasicEventForwardingOutputPort) source).removeOutgoingLink(datalink); } if (sink instanceof AbstractEventHandlingInputPort) { ((AbstractEventHandlingInputPort) sink).setIncomingLink(null); if (sink instanceof MergeInputPortImpl) { MergeInputPortImpl mip = (MergeInputPortImpl) sink; MergeImpl parent = (MergeImpl) mip.getMerge(); parent.removeInputPort(mip); } } }
.getIncomingLink().getSource(); Merge merge = mergeInput1.getMergeInstance(); assertSame(merge, mergeInput2.getMergeInstance()); assertSame(merge, mergeOutput.getMerge());
public boolean doTypeCheck() throws IterationTypeMismatchException { if (inputs.size() == 0) { // Arguable, but technically a merge with no inputs is valid, it may // make more sense to throw an exception here though as it has no // actual meaning. return true; } // Return false if we have unbound input ports or bound ports where the // resolved depth hasn't been calculated yet for (MergeInputPort ip : inputs) { if (ip.getIncomingLink() == null || ip.getIncomingLink().getResolvedDepth() == -1) { return false; } } // Got all input ports, now scan for input depths int inputDepth = inputs.get(0).getIncomingLink().getResolvedDepth(); for (MergeInputPort ip : inputs) { if (ip.getIncomingLink().getResolvedDepth() != inputDepth) { throw new IterationTypeMismatchException(); } } // Got to here so all the input resolved depths match, push depth+1 to // all outgoing links and return true for (DatalinkImpl dli : output.outgoingLinks) { dli.setResolvedDepth(inputDepth+1); } return true; } }
@Override protected void undoEditAction(DatalinkImpl datalink) { EventForwardingOutputPort source = datalink.getSource(); EventHandlingInputPort sink = datalink.getSink(); if (source instanceof BasicEventForwardingOutputPort) { ((BasicEventForwardingOutputPort) source).addOutgoingLink(datalink); } if (sink instanceof AbstractEventHandlingInputPort) { ((AbstractEventHandlingInputPort) sink).setIncomingLink(datalink); if (sink instanceof MergeInputPortImpl) { MergeInputPortImpl mip = (MergeInputPortImpl) sink; MergeImpl parent = (MergeImpl) mip.getMerge(); parent.addInputPort(mip); } } }
.getIncomingLink().getSource(); Merge merge = mergeInput1.getMergeInstance(); assertSame(merge, mergeInput2.getMergeInstance()); assertSame(merge, mergeOutput.getMerge());
public MergeInputPort createMergeInputPort(Merge merge, String name, int depth) { if (merge instanceof MergeImpl) { return new MergeInputPortImpl((MergeImpl) merge, name, depth); } else { return null; } }
int inputDepth = inputs.get(0).getIncomingLink().getResolvedDepth(); for (MergeInputPort ip : inputs) { if (ip.getIncomingLink().getResolvedDepth() != inputDepth) {
Merge m = ((MergeInputPortImpl) link.getSink()).getMerge(); effectiveLink = (Datalink) m .getOutputPort().getOutgoingLinks().toArray()[0];
.getIncomingLink().getSource(); Merge merge = mergeInput1.getMergeInstance(); assertSame(merge, mergeInput2.getMergeInstance()); assertSame(merge, mergeOutput.getMerge());
@Override protected void doEditAction(MergeImpl mergeImpl) throws EditException { Edits edits = new EditsImpl(); mergeInputPort = new MergeInputPortImpl(mergeImpl,sourcePort.getName()+"_tomerge",sinkPort.getDepth()); inLink = edits.createDatalink(sourcePort, mergeInputPort); connectInLinkEdit=edits.getConnectDatalinkEdit(inLink); if (mergeImpl.getOutputPort().getOutgoingLinks().size()==0) { outLink = edits.createDatalink(mergeImpl.getOutputPort(), sinkPort); connectOutLinkEdit=edits.getConnectDatalinkEdit(outLink); } else if (mergeImpl.getOutputPort().getOutgoingLinks().size()==1){ if (mergeImpl.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() != sinkPort) { throw new EditException("Cannot add a different sinkPort to a Merge that already has one defined"); } } else { throw new EditException("The merge instance cannot have more that 1 outgoing Datalink"); } mergeImpl.addInputPort(mergeInputPort); connectInLinkEdit.doEdit(); if (connectOutLinkEdit!=null) connectOutLinkEdit.doEdit(); }
@Override protected void doEditAction(MergeImpl mergeImpl) throws EditException { Edits edits = new EditsImpl(); String name = Tools.getUniqueMergeInputPortName(mergeImpl, sourcePort.getName()+"To" + merge.getLocalName() + "_input", 0); mergeInputPort = new MergeInputPortImpl(mergeImpl,name,sinkPort.getDepth()); inLink = edits.createDatalink(sourcePort, mergeInputPort); connectInLinkEdit=edits.getConnectDatalinkEdit(inLink); if (mergeImpl.getOutputPort().getOutgoingLinks().size()==0) { outLink = edits.createDatalink(mergeImpl.getOutputPort(), sinkPort); connectOutLinkEdit=edits.getConnectDatalinkEdit(outLink); } else if (mergeImpl.getOutputPort().getOutgoingLinks().size()==1){ if (mergeImpl.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() != sinkPort) { throw new EditException("Cannot add a different sinkPort to a Merge that already has one defined"); } } else { throw new EditException("The merge instance cannot have more that 1 outgoing Datalink"); } mergeImpl.addInputPort(mergeInputPort); connectInLinkEdit.doEdit(); if (connectOutLinkEdit!=null) connectOutLinkEdit.doEdit(); }
@Override protected void doEditAction(MergeImpl mergeImpl) throws EditException { Edits edits = new EditsImpl(); String name = Tools.getUniqueMergeInputPortName(mergeImpl, sourcePort.getName()+"To" + merge.getLocalName() + "_input", 0); mergeInputPort = new MergeInputPortImpl(mergeImpl,name,sinkPort.getDepth()); inLink = edits.createDatalink(sourcePort, mergeInputPort); connectInLinkEdit=edits.getConnectDatalinkEdit(inLink); if (mergeImpl.getOutputPort().getOutgoingLinks().size()==0) { outLink = edits.createDatalink(mergeImpl.getOutputPort(), sinkPort); connectOutLinkEdit=edits.getConnectDatalinkEdit(outLink); } else if (mergeImpl.getOutputPort().getOutgoingLinks().size()==1){ if (mergeImpl.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() != sinkPort) { throw new EditException("Cannot add a different sinkPort to a Merge that already has one defined"); } } else { throw new EditException("The merge instance cannot have more that 1 outgoing Datalink"); } mergeImpl.addInputPort(mergeInputPort); connectInLinkEdit.doEdit(); if (connectOutLinkEdit!=null) connectOutLinkEdit.doEdit(); }