private void MapBorderNode(BorderNode sourceModelBorderNode, NationalInstruments.Dfir.BorderNode dfirBorderNode) { if (dfirBorderNode != null) { _map.AddMapping(sourceModelBorderNode, dfirBorderNode); int i = 0; foreach (var terminal in sourceModelBorderNode.OuterTerminals) { MapTerminalAndType(terminal, dfirBorderNode.GetOuterTerminal(i)); ++i; } i = 0; foreach (var terminal in sourceModelBorderNode.InnerTerminals) { MapTerminalAndType(terminal, dfirBorderNode.GetInnerTerminal(0, i)); ++i; } } }
private void MapBorderNode(BorderNode sourceModelBorderNode, NationalInstruments.Dfir.BorderNode dfirBorderNode) { if (dfirBorderNode != null) { _map.AddMapping(sourceModelBorderNode, dfirBorderNode); int i = 0; foreach (var terminal in sourceModelBorderNode.OuterTerminals) { _map.MapTerminalAndType(terminal, dfirBorderNode.GetOuterTerminal(i)); ++i; } i = 0; foreach (var terminal in sourceModelBorderNode.InnerTerminals) { // TODO: won't work for border nodes with multiple inner terminals per diagram // also assumes that the border node has the same terminals on each diagram, which // won't be true for the pattern selector // Fortunately, for now, the only inner terminal on OptionPatternStructureSelector is on the first diagram _map.MapTerminalAndType(terminal, dfirBorderNode.GetInnerTerminal(i, 0)); ++i; } } }
public void VisitBorderNode(BorderNode borderNode) { throw new NotImplementedException(); }
private NationalInstruments.Dfir.BorderNode TranslateBorderNode(BorderNode sourceModelBorderNode, NationalInstruments.Dfir.Structure dfirParentStructure) { var flatSequenceSimpleTunnel = sourceModelBorderNode as FlatSequenceSimpleTunnel; var loopTunnel = sourceModelBorderNode as LoopTunnel; var borrowTunnel = sourceModelBorderNode as SourceModel.BorrowTunnel; var loopBorrowTunnel = sourceModelBorderNode as LoopBorrowTunnel; var lockTunnel = sourceModelBorderNode as SourceModel.LockTunnel; var loopConditionTunnel = sourceModelBorderNode as SourceModel.LoopConditionTunnel; var loopIterateTunnel = sourceModelBorderNode as SourceModel.LoopIterateTunnel; var flatSequenceTerminateLifetimeTunnel = sourceModelBorderNode as FlatSequenceTerminateLifetimeTunnel; var loopTerminateLifetimeTunnel = sourceModelBorderNode as LoopTerminateLifetimeTunnel; var unwrapOptionTunnel = sourceModelBorderNode as SourceModel.UnwrapOptionTunnel; if (borrowTunnel != null) { var borrowDfir = new Nodes.BorrowTunnel(dfirParentStructure, borrowTunnel.BorrowMode); CreateTerminateLifetimeTunnel(borrowDfir, dfirParentStructure); return(borrowDfir); } else if (loopBorrowTunnel != null) { var borrowDfir = new Nodes.BorrowTunnel(dfirParentStructure, loopBorrowTunnel.BorrowMode); CreateTerminateLifetimeTunnel(borrowDfir, dfirParentStructure); return(borrowDfir); } else if (lockTunnel != null) { var lockDfir = new Nodes.LockTunnel(dfirParentStructure); CreateTerminateLifetimeTunnel(lockDfir, dfirParentStructure); return(lockDfir); } else if (loopConditionTunnel != null) { var loopConditionDfir = new Nodes.LoopConditionTunnel((Nodes.Loop)dfirParentStructure); CreateTerminateLifetimeTunnel(loopConditionDfir, dfirParentStructure); return(loopConditionDfir); } else if (loopIterateTunnel != null) { var loopIterateDfir = new IterateTunnel(dfirParentStructure); CreateTerminateLifetimeTunnel(loopIterateDfir, dfirParentStructure); return(loopIterateDfir); } else if (flatSequenceTerminateLifetimeTunnel != null) { var beginLifetimeDfir = (Nodes.IBeginLifetimeTunnel)_map.GetDfirForModel((Element)flatSequenceTerminateLifetimeTunnel.BeginLifetimeTunnel); return(beginLifetimeDfir.TerminateLifetimeTunnel); } else if (loopTerminateLifetimeTunnel != null) { var beginLifetimeDfir = (Nodes.IBeginLifetimeTunnel)_map.GetDfirForModel((Element)loopTerminateLifetimeTunnel.BeginLifetimeTunnel); return(beginLifetimeDfir.TerminateLifetimeTunnel); } else if (flatSequenceSimpleTunnel != null || loopTunnel != null) { return(dfirParentStructure.CreateTunnel( VIDfirBuilder.TranslateDirection(sourceModelBorderNode.PrimaryOuterTerminal.Direction), NationalInstruments.Dfir.TunnelMode.LastValue, sourceModelBorderNode.PrimaryOuterTerminal.DataType, sourceModelBorderNode.PrimaryInnerTerminals.First().DataType)); } else if (unwrapOptionTunnel != null) { return(new Nodes.UnwrapOptionTunnel(dfirParentStructure)); } throw new NotImplementedException("Unknown BorderNode type: " + sourceModelBorderNode.GetType().Name); }