private static void HandleAddLockTunnel(object parameter, IEnumerable <IViewModel> selection, ICompositionHost host, DocumentEditSite site) { var structureViewModels = selection.OfType <StructureViewModel>().WhereNotNull(); if (structureViewModels.Any()) { using (var transaction = structureViewModels.First().TransactionManager.BeginTransaction("Add Lock Tunnels", TransactionPurpose.User)) { foreach (var structureViewModel in structureViewModels) { SMRect leftRect, rightRect; BorderNodeViewModelHelpers.FindBorderNodePositions(structureViewModel, out leftRect, out rightRect); Structure model = (Structure)structureViewModel.Model; LockTunnel lockTunnel = model.MakeTunnel <LockTunnel>(model.PrimaryNestedDiagram, model.NestedDiagrams.First()); FlatSequenceTerminateLifetimeTunnel flatSequenceTerminateLifetimeTunnel = model.MakeTunnel <FlatSequenceTerminateLifetimeTunnel>(model.AncestorDiagram, model.NestedDiagrams.First()); lockTunnel.TerminateLifetimeTunnel = flatSequenceTerminateLifetimeTunnel; flatSequenceTerminateLifetimeTunnel.BeginLifetimeTunnel = lockTunnel; // Set both as rules were not consistently picking right one to adjust to other. lockTunnel.Top = leftRect.Y; lockTunnel.Left = leftRect.X; flatSequenceTerminateLifetimeTunnel.Top = lockTunnel.Top; flatSequenceTerminateLifetimeTunnel.Left = rightRect.X; } transaction.Commit(); } } }
private static LockTunnel CreateLockTunnel(Structure structure) { var lockTunnel = new LockTunnel(structure); var terminateLifetimeDfir = new TerminateLifetimeTunnel(structure); lockTunnel.TerminateLifetimeTunnel = terminateLifetimeDfir; terminateLifetimeDfir.BeginLifetimeTunnel = lockTunnel; return(lockTunnel); }
bool IDfirNodeVisitor <bool> .VisitLockTunnel(LockTunnel lockTunnel) { Terminal lockInput = lockTunnel.InputTerminals.ElementAt(0), referenceOutput = lockTunnel.OutputTerminals.ElementAt(0); LifetimeTypeVariableGroup lifetimeTypeVariableGroup = LifetimeTypeVariableGroup.CreateFromTerminal(lockInput); TypeVariableReference dataVariableType = _typeVariableSet.CreateReferenceToNewTypeVariable(); TypeVariableReference lockType = _typeVariableSet.CreateReferenceToLockingCellType(dataVariableType); CreateTerminalLifetimeGroup(InputReferenceMutability.AllowImmutable, lifetimeTypeVariableGroup) .AddTerminalFacade(lockInput, lockType, default(TypeVariableReference)); Lifetime innerLifetime = referenceOutput.GetDiagramLifetime(); TypeVariableReference referenceType = _typeVariableSet.CreateReferenceToReferenceType( true, lockType, _typeVariableSet.CreateReferenceToLifetimeType(innerLifetime)); _nodeFacade[referenceOutput] = new SimpleTerminalFacade(referenceOutput, referenceType); return(true); }
public bool VisitLockTunnel(LockTunnel lockTunnel) { ValidateRequiredInputTerminal(lockTunnel.InputTerminals[0]); return(true); }
bool IDfirNodeVisitor <bool> .VisitLockTunnel(LockTunnel lockTunnel) { MarkFacadeVariableOfTerminalInterrupted(lockTunnel.InputTerminals[0]); MarkFacadeVariableOfTerminalLive(lockTunnel.OutputTerminals[0]); return(true); }
bool IDfirNodeVisitor <bool> .VisitLockTunnel(LockTunnel lockTunnel) { UnifyNodeInputTerminalTypes(lockTunnel); OutputLifetimeInterruptsInputVariable(lockTunnel.InputTerminals[0], lockTunnel.OutputTerminals[0]); return(true); }
public bool VisitLockTunnel(LockTunnel lockTunnel) { throw new NotImplementedException(); }
public bool VisitLockTunnel(LockTunnel lockTunnel) { CreateLocalAllocationForVariable(lockTunnel.OutputTerminals[0].GetTrueVariable()); return(true); }