コード例 #1
0
        public override Procedure VisitProcedure(Procedure node)
        {
            Debug.Assert(civlTypeChecker.procToYieldingProc.ContainsKey(node));
            if (!procToDuplicate.ContainsKey(node))
            {
                YieldingProc yieldingProc = civlTypeChecker.procToYieldingProc[node];
                Debug.Assert(layerNum <= yieldingProc.upperLayer);

                Procedure proc = (Procedure)node.Clone();
                proc.Name      = $"{node.Name}_{layerNum}";
                proc.InParams  = this.VisitVariableSeq(node.InParams);
                proc.OutParams = this.VisitVariableSeq(node.OutParams);
                proc.Requires  = this.VisitRequiresSeq(node.Requires);
                proc.Ensures   = this.VisitEnsuresSeq(node.Ensures);
                if (yieldingProc is MoverProc moverProc && yieldingProc.upperLayer == layerNum)
                {
                    proc.Modifies = moverProc.modifiedGlobalVars.Select(g => Expr.Ident(g)).ToList();
                }
                else
                {
                    proc.Modifies = civlTypeChecker.GlobalVariables.Select(v => Expr.Ident(v)).ToList();
                    yieldingProcs.Add(proc);
                }

                procToDuplicate[node] = proc;
                absyMap[proc]         = node;
            }
コード例 #2
0
        public override Procedure VisitProcedure(Procedure node)
        {
            if (!civlTypeChecker.procToYieldingProc.ContainsKey(node))
            {
                return(node);
            }
            if (!procMap.ContainsKey(node))
            {
                YieldingProc yieldingProc = civlTypeChecker.procToYieldingProc[node];

                if (layerNum > yieldingProc.upperLayer)
                {
                    if (yieldingProc is ActionProc actionProc)
                    {
                        // yielding procedure already transformed to atomic action
                        var action = actionProc.refinedAction;
                        if (action.layerRange.Contains(layerNum))
                        {
                            return(action.layerToActionCopy[layerNum].proc);
                        }
                        else
                        {
                            return(node);
                        }
                    }
                    else if (yieldingProc is SkipProc)
                    {
                        // (calls to) skip procedures do not completely disappear because of output variables
                        return(procToSkipProcDummy[yieldingProc.proc]);
                    }
                    else if (yieldingProc is MoverProc)
                    {
                        // mover procedure does not exist on this layer any more
                        return(node);
                    }
                }

                Procedure proc = (Procedure)node.Clone();
                proc.Name      = $"{node.Name}_{layerNum}";
                proc.InParams  = this.VisitVariableSeq(node.InParams);
                proc.OutParams = this.VisitVariableSeq(node.OutParams);
                proc.Requires  = this.VisitRequiresSeq(node.Requires);
                proc.Ensures   = this.VisitEnsuresSeq(node.Ensures);
                if (yieldingProc is MoverProc moverProc && yieldingProc.upperLayer == layerNum)
                {
                    proc.Modifies = moverProc.modifiedGlobalVars.Select(g => Expr.Ident(g)).ToList();
                }
                else
                {
                    proc.Modifies = civlTypeChecker.sharedVariableIdentifiers;
                    yieldingProcs.Add(proc);
                }

                procMap[node] = proc;
            }
コード例 #3
0
        public override Procedure VisitProcedure(Procedure node)
        {
            if (!civlTypeChecker.procToYieldingProc.ContainsKey(node))
            {
                return(node);
            }
            if (!procMap.ContainsKey(node))
            {
                YieldingProc yieldingProc = civlTypeChecker.procToYieldingProc[node];

                if (layerNum > yieldingProc.upperLayer)
                {
                    if (yieldingProc is ActionProc actionProc)
                    {
                        // yielding procedure already transformed to atomic action
                        var refinedAction = actionProc.RefinedActionAtLayer(layerNum);
                        if (refinedAction == null)
                        {
                            // TODO: This can only happen because YieldingProcChecker.AddCheckers calls
                            // VisitProcedure on every layer. Do this "call redirection" somewhere else?
                            return(node);
                        }
                        return(refinedAction.proc);
                    }
                    else if (yieldingProc is SkipProc)
                    {
                        // calls to skip procedures are erased
                        return(node);
                    }
                    else if (yieldingProc is MoverProc)
                    {
                        // mover procedure does not exist on this layer any more
                        return(node);
                    }
                }

                Procedure proc = (Procedure)node.Clone();
                proc.Name      = $"{node.Name}_{layerNum}";
                proc.InParams  = this.VisitVariableSeq(node.InParams);
                proc.OutParams = this.VisitVariableSeq(node.OutParams);
                proc.Requires  = this.VisitRequiresSeq(node.Requires);
                proc.Ensures   = this.VisitEnsuresSeq(node.Ensures);
                if (yieldingProc is MoverProc moverProc && yieldingProc.upperLayer == layerNum)
                {
                    proc.Modifies = moverProc.modifiedGlobalVars.Select(g => Expr.Ident(g)).ToList();
                }
                else
                {
                    proc.Modifies = civlTypeChecker.sharedVariableIdentifiers;
                    yieldingProcs.Add(proc);
                }

                procMap[node] = proc;
            }
コード例 #4
0
        public ProcedureWindow(Procedure procedure, PatientManagementView pmv)
        {
            InitializeComponent();

            VM              = pmv;
            Procedure       = (Procedure)procedure.Clone();
            FilesToSave     = new List <Attachment>();
            LocalPathToSave = new List <string>();
            WardsList       = pmv.Patientmanager.AppManager.ApplicationDb.Wards.ToList();
            DataContext     = this;

            // disable UI elements for procedure editing:
            TextBox_Price.IsEnabled         = false;
            ListBox_Ward.IsEnabled          = false;
            ListBox_ProcedureType.IsEnabled = false;
        }
        public ProcedureWindow(Procedure procedure, PatientManagementView pmv)
        {
            InitializeComponent();

            VM = pmv;
            Procedure = (Procedure)procedure.Clone();
            FilesToSave = new List<Attachment>();
            LocalPathToSave = new List<string>();
            WardsList = pmv.Patientmanager.AppManager.ApplicationDb.Wards.ToList();
            DataContext = this;

            // disable UI elements for procedure editing:
            TextBox_Price.IsEnabled = false;
            ListBox_Ward.IsEnabled = false;
            ListBox_ProcedureType.IsEnabled = false;
        }
コード例 #6
0
ファイル: Duplicator.cs プロジェクト: omaragb/tlp182
        public override Procedure VisitProcedure(Procedure node)
        {
            //Contract.Requires(node != null);
            Contract.Ensures(Contract.Result <Procedure>() != null);
            Procedure newProcedure = null;

            if (OldToNewProcedureMap != null && OldToNewProcedureMap.ContainsKey(node))
            {
                newProcedure = OldToNewProcedureMap[node];
            }
            else
            {
                newProcedure = base.VisitProcedure((Procedure)node.Clone());
                if (OldToNewProcedureMap != null)
                {
                    OldToNewProcedureMap[node] = newProcedure;
                }
            }
            return(newProcedure);
        }
コード例 #7
0
 public override Procedure VisitProcedure(Procedure node)
 {
     return(base.VisitProcedure((Procedure)node.Clone()));
 }
コード例 #8
0
ファイル: Duplicator.cs プロジェクト: luckysunda/hice-dt
 public override Procedure VisitProcedure(Procedure node)
 {
     //Contract.Requires(node != null);
     Contract.Ensures(Contract.Result <Procedure>() != null);
     return(base.VisitProcedure((Procedure)node.Clone()));
 }