Exemple #1
0
        public AbstractNetwork(Random rand, int stateGenNumber, string statePrefix, int sh_width, int sh_height)
        {
            this.rand = rand;
            this.items = new List<AbstractNetworkItem>();
            this.selectedItems = new List<AbstractItem>();
            this.edges = new List<AbstractEdge>();
            this.visualSettings = new NetworkVisualSettings();
            this.visibleSettings = new NetworkVisibleSettings();
            this.stateMatrix = new List<StateVector>();
            this.stateHierarchy = new StateHierarchy(this.rand, sh_width, sh_height);

            this.unidGenNumber = 0;
            this.stateGenNumber = stateGenNumber;
            this.statePrefix = statePrefix;
            this.events = new EventTrunk();
            this.transitionHistory = new List<TransitionHistoryItem>();
        }
Exemple #2
0
 private void init(string name, long unid, PointF origo, float radius)
 {
     this.name = name;
     this.unid = unid;
     this.origo = origo;
     this.radius = radius;
     this.statistics = new GeneralStatistics();
     this.events = new EventTrunk();
 }
 private void init(PointF origo)
 {
     this.labelOffset = new PointF(0, 0);
     this.statistics = new GeneralStatistics();
     this.events = new EventTrunk();
     this.origo = origo;
 }
Exemple #4
0
 public static PetriNetwork openSettingsFromXml(Random rand, XmlNodeList root, string fileName)
 {
     int tokenGenNumber = 0;
     int positionGenNumber = 0;
     int transitionGenNumber = 0;
     int noteGenNumber = 0;
     int stateGenNumber = 0;
     string tokenPrefix = "";
     string positionPrefix = "P";
     string transitionPrefix = "T";
     string notePrefix = "N";
     string statePrefix = "S";
     int defaultEdgeWeight = 1;
     string name = "new";
     string certificateSubject = "";
     DateTime lastModificationDate = DateTime.Now;
     string description = "";
     int width = 640;
     int height = 480;
     int sh_width = 320;
     int sh_height = 240;
     int simulationTimeout = PetriNetwork.DEF_TIMEOUT;
     FireRule fireRule = FireRule.getDefault();
     EventTrunk events = new EventTrunk();
     foreach (XmlNode node in root)
     {
         string namespaceUri = node.NamespaceURI;
         string localName = node.LocalName;
         switch (namespaceUri)
         {
             case PetriXmlHelper.XML_SETTINGS_NAMESPACE:
                 switch (localName)
                 {
                     case "Name":
                         name = PetriNetwork.openStringData(node);
                         break;
                     case "CertificateSubject":
                         certificateSubject = PetriNetwork.openStringData(node);
                         break;
                     case "LastModificationDate":
                         lastModificationDate = PetriNetwork.openDateTimeData(node);
                         break;
                     case "Description":
                         description = PetriNetwork.openStringData(node);
                         break;
                     case "Width":
                         width = PetriNetwork.openIntData(node);
                         break;
                     case "Height":
                         height = PetriNetwork.openIntData(node);
                         break;
                     case "StateHierarchyWidth":
                         sh_width = PetriNetwork.openIntData(node);
                         break;
                     case "StateHierarchyHeight":
                         sh_height = PetriNetwork.openIntData(node);
                         break;
                     case "TokenGenNumber":
                         tokenGenNumber = PetriNetwork.openIntData(node);
                         break;
                     case "PositionGenNumber":
                         positionGenNumber = PetriNetwork.openIntData(node);
                         break;
                     case "TransitionGenNumber":
                         transitionGenNumber = PetriNetwork.openIntData(node);
                         break;
                     case "NoteGenNumber":
                         noteGenNumber = PetriNetwork.openIntData(node);
                         break;
                     case "StateGenNumber":
                         stateGenNumber = PetriNetwork.openIntData(node);
                         break;
                     case "TokenPrefix":
                         tokenPrefix = PetriNetwork.openStringData(node);
                         break;
                     case "PositionPrefix":
                         positionPrefix = PetriNetwork.openStringData(node);
                         break;
                     case "TransitionPrefix":
                         transitionPrefix = PetriNetwork.openStringData(node);
                         break;
                     case "NotePrefix":
                         notePrefix = PetriNetwork.openStringData(node);
                         break;
                     case "StatePrefix":
                         statePrefix = PetriNetwork.openStringData(node);
                         break;
                     case "DefaultEdgeWeight":
                         defaultEdgeWeight = PetriNetwork.openIntData(node);
                         break;
                     case "FireRule":
                         fireRule = FireRule.getEnumByValue(PetriNetwork.openStringData(node));
                         break;
                     case "SimulationTimeout":
                         simulationTimeout = PetriNetwork.openIntData(node);
                         break;
                 }
                 break;
         }
     }
     IdentityProvider identityProvider = new IdentityProvider(positionPrefix, transitionPrefix, tokenPrefix, notePrefix,tokenGenNumber, positionGenNumber, transitionGenNumber, noteGenNumber);
     return new PetriNetwork(rand, name, description, width, height, sh_width, sh_height, identityProvider, statePrefix, defaultEdgeWeight, stateGenNumber, fileName, fireRule, simulationTimeout, certificateSubject, lastModificationDate);
 }