Exemplo n.º 1
0
 internal MapletViewer(Term k, Term t, bool isBagEntry)
 {
     this.keyName            = "Entry";
     this.t                  = t;
     this.k                  = k;
     this.argumentViewers    = new TermViewer[2];
     this.argumentViewers[0] = TermViewer.Create((isBagEntry ? "Element" : "Key"), k);
     this.argumentViewers[1] = TermViewer.Create((isBagEntry ? "Multiplicity" : "Value"), t);
 }
Exemplo n.º 2
0
            void CreateVariableWiewers()
            {
                //view also the control mode of the root state if the product has more than one machine in it
                //the id of the composed state is -1
                //if (leafStates.Count > 1)
                //    termViewers.Add(TermViewer.Create("[Control Mode]", rootState.ControlMode), -1);

                for (int stateId = 0; stateId < this.leafStates.Count; stateId++)
                {
                    IState leafState = this.leafStates[stateId];
                    //string modelName = this.modelNames[stateId];

                    //each state has a control mode, create a viewer for it if the controlMode is
                    //not an empty sequence
                    if (!leafState.ControlMode.ToCompactString().Equals("Sequence()"))
                    {
                        termViewers.Add(TermViewer.Create("[Control Mode]", leafState.ControlMode), stateId);
                    }

                    IExtendedState estate = leafState as IExtendedState;
                    if (estate != null)
                    {
                        #region add the domain map viewer, skip this if there are no domains
                        if (estate.DomainMap.Count > 0)
                        {
                            //StringBuilder sb = new StringBuilder();
                            Sequence <Term> args = Sequence <Term> .EmptySequence;
                            foreach (Pair <Symbol, int> si in estate.DomainMap)
                            {
                                args = args.AddLast(new Literal(si.First.FullName));
                                args = args.AddLast(new Literal(si.Second));
                            }
                            Symbol symb   = Symbol.Parse("Map<String, Integer>");
                            Term   domMap = new CompoundTerm(symb, args);

                            termViewers.Add(TermViewer.Create("[Domain Map]", domMap), stateId);
                        }
                        #endregion

                        //add a viewer for each state variable
                        for (int j = 0; j < estate.LocationValuesCount; j++)
                        {
                            termViewers.Add(TermViewer.Create(estate.GetLocationName(j),
                                                              estate.GetLocationValue(j)), stateId);
                        }
                    }
                }
            }