Esempio n. 1
0
        public void DeserializeJSON(object obj, EmraldModel lists, bool useGivenIDs)
        {
            var    dynamicObj = (dynamic)obj;
            string curName    = "";

            try
            {
                foreach (var wrapper in dynamicObj)
                {
                    var       item    = wrapper.LogicNode;
                    LogicNode curItem = null;
                    curName = (string)item.name;

                    if (loaded && (item.id != null) && ((int)item.id > 0))
                    {
                        curItem = this[(int)item.id];
                        if (curItem == null)
                        {
                            throw new Exception("Failed to find LogicGate with id of " + (int)item.id);
                        }
                    }
                    else
                    {
                        curItem = this.FindByName(curName, false);
                        if (curItem != null)
                        {
                            throw new Exception("LogicGate with the name of " + (string)item.name + " already exists");
                        }
                    }

                    if (curItem == null)
                    {
                        curItem = new LogicNode();
                    }

                    if (!curItem.DeserializeDerived((object)item, false, lists, useGivenIDs))
                    {
                        throw new Exception("Failed to deserialize LogicGate List JSON");
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("On diagram named " + curName + ". " + e.Message);
            }
        }
Esempio n. 2
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            //construct all the objects
            this.allActions.DeserializeJSON(dynObj.ActionList, this, useGivenIDs);
            this.allDiagrams.DeserializeJSON(dynObj.DiagramList, this, useGivenIDs);
            this.allVariables.DeserializeJSON(dynObj.VariableList, this, useGivenIDs);
            var evs = dynObj.EventList;

            this.allEvents.DeserializeJSON(dynObj.EventList, this, useGivenIDs);
            var logic = dynObj.LogicNodeList;

            this.allLogicNodes.DeserializeJSON(dynObj.LogicNodeList, this, useGivenIDs);
            this.allStates.DeserializeJSON(dynObj.StateList, this, useGivenIDs);
            if (dynObj.ExtSimList != null)
            {
                this.allExtSims.DeserializeJSON(dynObj.ExtSimList, this, useGivenIDs);
            }

            //make the links to all the other objects
            this.allActions.LoadLinks(dynObj.ActionList, this);
            this.allDiagrams.LoadLinks(dynObj.DiagramList, this);
            this.allVariables.LoadLinks(dynObj.VariableList, this);
            this.allLogicNodes.LoadLinks(logic, this);
            this.allEvents.LoadLinks(dynObj.EventList, this);
            this.allStates.LoadLinks(dynObj.StateList, this);

            this.allActions.loaded    = true;
            this.allDiagrams.loaded   = true;
            this.allVariables.loaded  = true;
            this.allLogicNodes.loaded = true;
            this.allEvents.loaded     = true;
            this.allStates.loaded     = true;

            //compile codes
            this.allEvents.CompileCodes(this);
            this.allActions.CompileCodes(this);

            return(true);
        }
Esempio n. 3
0
        public override string GetDerivedJSON(EmraldModel lists)
        {
            string retStr = "," + Environment.NewLine + "\"singleStates\": [";

            for (int i = 0; i < this._singleStateGroup.Count; ++i)
            {
                retStr = retStr + Environment.NewLine + "{\"stateName\": \"" + lists.allStates[this._singleStateGroup[i]].name + "\"," +
                         "\"okState\":\"" + _okStates.Contains(this._singleStateGroup[i]).ToString() + "\"}";
                if (i < this._singleStateGroup.Count - 1)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
            }

            retStr = retStr + "]";

            return(retStr);
        }
Esempio n. 4
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.Diagram == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).Diagram;
            }

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            //Now done in LoadObjLinks()
            ////load the transition list
            //if (dynObj.okStates != null)
            //{
            //  _okStates.Clear();
            //  _singleStateGroup.Clear();

            //  foreach (dynamic curToObj in dynObj.okStates)
            //  {
            //    State curState = lists.allStates.FindByName((string)curToObj.stateName);
            //    if (curState == null)
            //      throw new Exception("Failed to locate ok state " + (string)curToObj.stateName + " in state list");

            //    _okStates.Add(curState.id);

            //    if (curToObj.inSingleStateGroup == true)
            //      _singleStateGroup.Add(curState.id);
            //  }
            //}

            processed = true;
            return(true);
        }
Esempio n. 5
0
        //public abstract bool LoadLinks(LookupLists list);
        //public abstract bool SavePrep(LookupLists lists);
        //public abstract bool SaveLinks(LookupLists lists);
        //public abstract bool DeleteFromDB(LookupLists lists);

        public virtual string GetJSON(bool incBrackets, EmraldModel lists)
        {
            string retStr = "";

            if (incBrackets)
            {
                retStr = "{";
            }

            string idStr = this.id.ToString();

            retStr = retStr + "\"id\": " + idStr + "," + Environment.NewLine +
                     "\"name\":\"" + name + "\"," + Environment.NewLine +
                     "\"desc\":\"" + desc + "\"";

            if (incBrackets)
            {
                retStr = retStr + Environment.NewLine + "}";
            }

            return(retStr);
        }
Esempio n. 6
0
        public override string GetJSON(bool incBrackets, EmraldModel lists)
        {
            //EnDiagramType enumTest = (EnDiagramType)Enum.Parse(typeof(EnDiagramType), "dtComponent", true);


            string retStr = "";

            if (incBrackets)
            {
                retStr = "{";
            }
            retStr = retStr + "\"Diagram\": {" + Environment.NewLine + base.GetJSON(false, lists);
            retStr = retStr + "," + Environment.NewLine + "\"diagramType\": \"" + diagType.ToString() + "\"";
            retStr = retStr + "," + Environment.NewLine + "\"states\": [";

            StateSort sorter = new StateSort();

            _States.Sort(sorter);
            //foreach (State curSt in this._States)
            for (int i = 0; i < this._States.Count; ++i)
            {
                retStr = retStr + Environment.NewLine + "\"" + this._States[i].name + "\"";

                if (i < this._States.Count - 1)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
            }

            retStr = retStr + "]" + Environment.NewLine;
            retStr = retStr + GetDerivedJSON(lists) + Environment.NewLine + "}";

            if (incBrackets)
            {
                retStr = retStr + Environment.NewLine + "}";
            }

            return(retStr);
        }
Esempio n. 7
0
        public string GetJSON(bool incBrackets, EmraldModel lists)
        {
            string retStr = "";

            if (incBrackets)
            {
                retStr = "{";
            }
            retStr = retStr + "\"DiagramList\": [";

            int i = 1;

            foreach (Diagram curItem in this.Values)
            {
                if (curItem is EvalDiagram)
                {
                    retStr = retStr + Environment.NewLine + ((EvalDiagram)curItem).GetJSON(true, lists);
                }
                else
                {
                    retStr = retStr + Environment.NewLine + curItem.GetJSON(true, lists);
                }

                if (i < this.Count)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
                ++i;
            }

            retStr = retStr + "]";

            if (incBrackets)
            {
                retStr = retStr + Environment.NewLine + "}";
            }

            return(retStr);
        }
Esempio n. 8
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.ExtSim == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).ExtSim;
            }

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            lists.allExtSims.Add(this);

            this.resourceName = (string)dynObj.resourceName;
            //this.modelRef = dynObj.modelRef;
            //this.configData = dynObj.configData;
            //try
            //{
            //  this.simMaxTime = XmlConvert.ToTimeSpan((string)dynObj.simMaxTime);
            //}
            //catch
            //{
            //  throw new Exception("Invalid Time format.");
            //}


            processed = true;
            return(true);
        }
Esempio n. 9
0
        public override bool LoadObjLinks(object obj, bool wrapped, EmraldModel lists)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.Diagram == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).Diagram;
            }

            //load the Event Items
            if (dynObj.states != null)
            {
                this._States.Clear();

                foreach (dynamic stateName in dynObj.states)
                {
                    State curState = lists.allStates.FindByName((string)stateName);
                    if (curState == null)
                    {
                        throw new Exception("Failed to find State - " + (string)stateName);
                    }

                    if (curState.diagram != this)
                    {
                        throw new Exception("State - " + (string)stateName + " does not have " + this.name + " listed as it's diagram.  Reference missing or trying to make a state belong to more than one diagram.");
                    }

                    this.AddState(curState);
                }
            }
            return(true);
        }
Esempio n. 10
0
        public virtual bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            if (wrapped)
            {
                throw new Exception("Deserialize of base object cannot be wrapped in an object."); //base class does not know how to handle
            }
            dynamic dynObj = (dynamic)obj;

            if (String.IsNullOrEmpty((string)dynObj.name) && (name == ""))
            {
                throw new Exception("All deserializing of JSON data objects must have a name");
            }

            if ((string)dynObj.name != "")
            {
                name = (string)dynObj.name;
                desc = (string)dynObj.desc;
            }
            if (useGivenIDs && (int)dynObj.id > 0)
            {
                this._id = (int)dynObj.id;
            }
            return(true);
        }
Esempio n. 11
0
        public override string GetJSON(bool incBrackets, EmraldModel lists)
        {
            string retStr = "";

            if (incBrackets)
            {
                retStr = "{";
            }
            retStr = retStr + base.GetJSON(false, lists);
            retStr = retStr + "," + this.allActions.GetJSON(false, lists);
            retStr = retStr + "," + this.allDiagrams.GetJSON(false, lists);
            retStr = retStr + "," + this.allEvents.GetJSON(false, lists);
            retStr = retStr + "," + this.allLogicNodes.GetJSON(false, lists);
            retStr = retStr + "," + this.allStates.GetJSON(false, lists);
            retStr = retStr + "," + this.allVariables.GetJSON(false, lists);
            retStr = retStr + "," + this.allExtSims.GetJSON(false, lists);

            if (incBrackets)
            {
                retStr = retStr + Environment.NewLine + "}";
            }

            return(retStr);
        }
Esempio n. 12
0
 public virtual void LookupRelatedItems(EmraldModel all, EmraldModel addToList)
 {
     //none
 }
Esempio n. 13
0
 public virtual string GetDerivedJSON(EmraldModel lists)
 {
     return("");
 }
Esempio n. 14
0
        public void AutoItemsForNewComponent(string compName,
                                             string desc,
                                             string[] demandNames,
                                             double[] demandFailProbs,
                                             SimVariable[] demandFailVars,
                                             string[] rateNames,
                                             double[] runningFailRates,
                                             string[] startStates,
                                             string[] turnOffStates,
                                             string sim3DComp      = "",
                                             bool sepFailStates    = false,
                                             EmraldModel refLookup = null) //only have this not null if trying to get the JSON for this.
        {
            if (refLookup == null)
            {
                refLookup = this;
            }

            if (demandNames.Count() != demandFailProbs.Count())
            {
                throw new Exception("Not equal Demand names and prob list");
            }

            if (rateNames.Count() != runningFailRates.Count())
            {
                throw new Exception("Not equal Demand names and prob list");
            }

            CompDiagram addComp = new CompDiagram(compName);

            addComp.desc = desc;
            allDiagrams.Add(addComp);

            //Action addAct;
            //Event addEv;

            //all items going to have active state and failed state
            State standbyState = new State(compName + "_Standby", EnStateType.stStandard, addComp);
            State activeState  = new State(compName + "_Active", EnStateType.stStandard, addComp);

            allStates.Add(standbyState);
            allStates.Add(activeState);
            List <State> failStates = new List <State>();

            State failedState = null;

            if (!sepFailStates)
            {
                failedState = new State(compName + "_Failed", EnStateType.stStandard, addComp);
                allStates.Add(failedState);
                addComp.AddEvalVal(failedState.id, false);
                failStates.Add(failedState);
            }

            addComp.AddEvalVal(activeState.id, true);

            //add event for a demand
            TransitionAct gotoDemandEv = new TransitionAct("Start_" + compName + "_Demand");

            gotoDemandEv.AddToState(standbyState);
            allActions.Add(gotoDemandEv);
            //add all the start states to the related items
            foreach (string sName in startStates)
            {
                State stState = refLookup.allStates.FindByName(sName);
                if (stState != null)
                {
                    stState.AddImmediateAction(gotoDemandEv);
                }
                else
                {
                    throw new Exception("Failed to find start system State named " + stState);
                }
            }


            //add action to move from off to on or failed for the demand
            TransitionAct demandAct = new TransitionAct("From_" + compName + "_Demand");
            NowTimerEvent demandEv  = new NowTimerEvent(compName + "_Demand");

            if (demandFailProbs.Count() > 0)
            {
                for (int i = 0; i < demandFailProbs.Count(); ++i)
                {
                    if (sepFailStates)
                    {
                        failedState = new State(compName + "_Failed" + demandNames[i], EnStateType.stStandard, addComp);
                        allStates.Add(failedState);
                        addComp.AddEvalVal(failedState.id, false);
                        failStates.Add(failedState);
                    }

                    //setup the probability of failure on demand
                    //TODO : Add the demandNames[i] somehow to the path data when moving to the failed state.
                    if ((demandFailVars != null) && (demandFailVars.Count() > 0) && (demandFailVars[i] != null))
                    {
                        demandAct.AddToState(failedState, demandFailVars[i], demandNames[i]);
                    }
                    else
                    {
                        demandAct.AddToState(failedState, demandFailProbs[i], demandNames[i]);
                    }
                }

                demandAct.AddToState(activeState);
                allActions.Add(demandAct);
                //add the events and movement to the standbyState
                standbyState.AddEvent(demandEv, true, demandAct);
                //standbyState.AddImmediateAction(demandAct);
            }
            else
            {
                //add the action to move to the active state automatically on start request when no fails to start.
                demandAct.AddToState(activeState);
                allActions.Add(demandAct);
                //add the events and movement to the standbyState
                standbyState.AddEvent(demandEv, true, demandAct);
                //standbyState.AddImmediateAction(demandAct);
            }

            //add event for a shutoff request
            StateCngEvent offEv = new StateCngEvent(compName + "_Stop", false);

            foreach (string sName in turnOffStates)
            {
                State endState = refLookup.allStates.FindByName(sName);
                if (endState != null)
                {
                    offEv.AddRelatedItem(endState.id);
                }
            }
            allEvents.Add(offEv);

            //add action to move from off to on or failed for the demand
            TransitionAct offAct = new TransitionAct("Goto_" + compName + "_Off");

            offAct.AddToState(standbyState);
            allActions.Add(offAct);

            //add the Events and movement back to the standby state
            activeState.AddEvent(offEv, true, offAct);
            foreach (State curSt in failStates)
            {
                curSt.AddEvent(offEv, true, offAct);
            }


            if ((runningFailRates.Count() > 0) || ((sim3DComp != null) && (sim3DComp != ""))) //add the fail to run links
            {
                //add transition leading from active to failed for the event above
                //TransitionAct failAct = new TransitionAct("Goto_" + compName + "_Failed");
                //failAct.AddToState(failedState);
                //allActions.Add(failAct);

                for (int i = 0; i < runningFailRates.Count(); ++i)
                {
                    if (sepFailStates)
                    {
                        failedState = new State(compName + "_Failed" + rateNames[i], EnStateType.stStandard, addComp);
                        allStates.Add(failedState);
                        addComp.AddEvalVal(failedState.id, false);
                        failStates.Add(failedState);
                    }

                    TransitionAct failAct = new TransitionAct("Goto_" + compName + "_Had_" + rateNames[i] + "_Failure");
                    failAct.AddToState(failedState);
                    allActions.Add(failAct);

                    //add event leading from active to failed
                    FailProbEvent failEv = new FailProbEvent(compName + rateNames[i], runningFailRates[i], Globals.HourTimeSpan, Globals.DayTimeSpan);
                    allEvents.Add(failEv);

                    activeState.AddEvent(failEv, true, failAct);
                }

                if ((sim3DComp != null) && (sim3DComp != ""))
                {
                    if (sepFailStates)
                    {
                        failedState = new State(compName + "_Failed_3D", EnStateType.stStandard, addComp);
                        allStates.Add(failedState);
                        addComp.AddEvalVal(failedState.id, false);
                        failStates.Add(failedState);
                    }

                    TransitionAct failAct = new TransitionAct("Goto_" + compName + "_Had_3D" + "_Failure");
                    failAct.AddToState(failedState);
                    allActions.Add(failAct);

                    Sim3DVariable simVar  = (Sim3DVariable)refLookup.allVariables.FindByName(sim3DComp);
                    VariableList  varList = new VariableList();
                    varList.Add(simVar);

                    EvalVarEvent sim3DEvent = (EvalVarEvent)allEvents.FindByName(sim3DComp, false);
                    if (sim3DEvent == null)
                    {
                        sim3DEvent = new EvalVarEvent(sim3DComp, "if (" + simVar.name + " > 0) return true; else return false;", varList, simVar);
                        allEvents.Add(sim3DEvent);
                    }
                    activeState.AddEvent(sim3DEvent, true, failAct);
                }
            }
        }
Esempio n. 15
0
        public override bool LoadObjLinks(object obj, bool wrapped, EmraldModel lists)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.LogicNode == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).LogicNode;
            }


            //load the root obj info
            if (dynObj.rootName != null)
            {
                _rootParent = lists.allLogicNodes.FindByName((string)dynObj.rootName);
                if (_rootParent == null)
                {
                    throw new Exception("Root node " + (string)dynObj.rootName + " not found.");
                }
            }

            //load the gate children
            if (dynObj.gateChildren != null)
            {
                _subGates.Clear();
                foreach (var gateName in dynObj.gateChildren)
                {
                    LogicNode curChildGate = lists.allLogicNodes.FindByName((string)gateName);
                    if (curChildGate == null)
                    {
                        throw new Exception("Deserialize Logic failed to find child gate - " + gateName);
                    }

                    if (!_subGates.Contains(curChildGate))
                    {
                        _subGates.Add(curChildGate);
                    }
                }
            }

            //load the component children
            if (dynObj.compChildren != null)
            {
                _compChildren.Clear();
                foreach (var stateName in dynObj.compChildren)
                {
                    EvalDiagram curChildComp = (EvalDiagram)lists.allDiagrams.FindByName((string)stateName);
                    if (curChildComp == null)
                    {
                        throw new Exception("Deserialize Logic gate Failed to find child state - " + stateName);
                    }

                    _compChildren.Add(curChildComp);
                }
            }
            return(true);
        }
Esempio n. 16
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.LogicNode == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).LogicNode;
            }

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            lists.allLogicNodes.Add(this);

            gateType = (EnGateType)Enum.Parse(typeof(EnGateType), (string)dynObj.gateType, true);

            //Now done in LoadObjLinks()
            ////load the root obj info
            //if (dynObj.rootName != null)
            //{
            //  _rootParent = lists.allLogicNodes.FindByName((string)dynObj.rootName);
            //  if (_rootParent == null)
            //  {
            //    throw new Exception("Root node " + (string)dynObj.rootName + " not found.");
            //  }
            //}

            ////load the gate children
            //if (dynObj.gateChildren != null)
            //{
            //  _subGates.Clear();
            //  foreach (dynamic gateName in dynObj.gateChildren)
            //  {
            //    LogicNode curChildGate = lists.allLogicNodes.FindByName(gateName);
            //    if (curChildGate == null)
            //    {
            //      throw new Exception("Deserialize Logic failed to find child gate - " + gateName);

            //    }

            //    if (!_subGates.Contains(curChildGate))
            //      _subGates.Add(curChildGate);
            //  }
            //}

            ////load the component children
            //if (dynObj.compChildren != null)
            //{
            //  _compChildren.Clear();
            //  foreach (dynamic stateName in dynObj.compChildren)
            //  {
            //    EvalDiagram curChildComp = lists.allDiagrams.FindByName(stateName);
            //    if (curChildComp == null)
            //    {
            //      throw new Exception("Deserialize Logic gate Failed to find child state - " + stateName);
            //    }

            //    _compChildren.Add(curChildComp);
            //  }

            //}

            processed = true;
            return(true);
        }
Esempio n. 17
0
 public virtual bool LoadObjLinks(object obj, bool wrapped, EmraldModel lists)
 {
     //override this for the items that need to load links after initial deserializeDerived of each list is done.
     return(true);
 }
Esempio n. 18
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.State == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).State;
            }

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            lists.allStates.Add(this, false);

            this.stateType = (EnStateType)Enum.Parse(typeof(EnStateType), (string)dynObj.stateType, true);

            this._Diagram = lists.allDiagrams.FindByName((string)dynObj.diagramName);
            if (this._Diagram == null)
            {
                //Instead of throwing exception, create a new diagram to add state to?
                //this._Diagram = new Diagram(null);
                throw new Exception("State must have a valid diagram ");
            }

            this._Diagram.AddState(this);

            this.geometry = (string)dynObj.geometry;

            if ((dynObj.immediateActions == null) || (dynObj.events == null) || (dynObj.eventActions == null))
            {
                throw new Exception("Deserialize State, missing immediateActions, events, or eventActions.");
            }

            //Now done in LoadObjLinks()
            ////load the Immediate Actions
            //this._immediateActions.Clear();
            //foreach (dynamic actName in dynObj.immediateActions)
            //{
            //  Action curAct = lists.allActions.FindByName(actName);
            //  if (curAct == null)
            //  {
            //    throw new Exception("Deserialize State, failed to find immediateAction - " + actName);
            //  }

            //  _immediateActions.Add(curAct);
            //}

            ////load the Event Items
            //foreach (dynamic eventName in dynObj.events)
            //{
            //  Event curEv = lists.allEvents.FindByName(eventName);
            //  if (curEv == null)
            //  {
            //    throw new Exception("Deserialize State, failed to find event - " + eventName);
            //  }
            //  _events.Add(curEv);
            //}

            ////load the Event Actions
            //if (dynObj.eventActions != null)
            //{
            //  this._evActions.Clear();

            //  foreach (dynamic curToObj in dynObj.eventActions)
            //  {
            //    ActionList curEvActList = new ActionList();
            //    curEvActList.DeserializeJSON(curToObj, lists);
            //    this._evActions.Add(curEvActList);
            //  }
            //}

            processed = true;
            return(true);
        }
Esempio n. 19
0
        public override string GetJSON(bool incBrackets, EmraldModel lists)
        {
            string retStr = "";

            if (incBrackets)
            {
                retStr = "{";
            }
            retStr = retStr + "\"State\": {" + Environment.NewLine + base.GetJSON(false, lists) + "," + Environment.NewLine;

            //add derived items
            retStr = retStr + "\"stateType\": \"" + this.stateType.ToString() + "\"," + Environment.NewLine +
                     "\"diagramName\": \"" + this._Diagram.name.ToString() + "\"," + Environment.NewLine +
                     "\"geometry\": \"" + this.geometry + "\"";


            //add immediate action array items
            retStr = retStr + "," + Environment.NewLine + "\"immediateActions\": [";
            for (int i = 0; i < this._immediateActions.Count; ++i)
            {
                retStr = retStr + "\"" + this._immediateActions[i].name + "\"";

                if (i < this._immediateActions.Count - 1)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
            }

            retStr = retStr + "]";



            //add Event items
            retStr = retStr + "," + Environment.NewLine + "\"events\": [";
            for (int i = 0; i < this._events.Count; ++i)
            {
                retStr = retStr + "\"" + this._events[i].name + "\"";

                if (i < this._events.Count - 1)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
            }

            retStr = retStr + "]";


            //add Event Actions
            retStr = retStr + "," + Environment.NewLine + "\"eventActions\": [";
            for (int i = 0; i < this._evActions.Count; ++i)
            {
                retStr = retStr + Environment.NewLine + this._evActions[i].GetJSON(true, lists);

                if (i < this._evActions.Count - 1)
                {
                    retStr = retStr + "," + Environment.NewLine;
                }
            }

            retStr = retStr + "]";



            retStr = retStr + Environment.NewLine + "}";

            if (incBrackets)
            {
                retStr = retStr + Environment.NewLine + "}";
            }

            return(retStr);
        }
Esempio n. 20
0
 public override bool LoadObjLinks(object obj, bool wrapped, EmraldModel lists)
 {
     //TODO :
     return(true);
 }
Esempio n. 21
0
 public bool LoadLinks(object obj, EmraldModel lists)
 {
     return(true);
 }