Package org.woped.pnml

Examples of org.woped.pnml.OccuredtransitionType


           
            // Simulations
            SimulationsType iNetSimulations = iNetToolSpec.addNewSimulations();
            SimulationType iSimulation;
            TransitionsequenceType iTransitionsequence;
            OccuredtransitionType iOccuredTransition;
            for (Iterator<SimulationModel> iter = petrinetModel.getSimulations().iterator();iter.hasNext();)
            {
              SimulationModel currSimulation = iter.next();
             
              // check if current fingerprint of the net equals the imported one
            // if not ask the user if he want's to keep the simulation
            //
            // this check is performed as well on:
            // - fileixport
            // - loading a simulation
            // when you change it here please do at those locations as well
              int answer = 0;
              Date simulationCreationDate = currSimulation.getSavedDate();
              if(!petrinetModel.isLogicalFingerprintEqual(currSimulation.getFingerprint()))
              {
                Object[] options = {Messages.getString("Tokengame.ChangedNetDialog.ButtonKeep"),Messages.getString("Tokengame.ChangedNetDialog.ButtonDelete")};
                // get the localized message text
                String message = Messages.getString("Tokengame.ChangedNetDialog.Export.Message");
              // fill the message text dynamically with the simulationname and simulationdate
                message = message.replaceAll("##SIMULATIONNAME##", currSimulation.getName());
                message = message.replaceAll("##SIMULATIONDATE##", DateFormat.getDateInstance().format(currSimulation.getSavedDate()));
              answer = JOptionPane.showOptionDialog(null, message, Messages.getString("Tokengame.ChangedNetDialog.Title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
              // if the user didn't choose one of the buttons but closed the OptionDialog don't drop the simulation
              if(answer == -1)
              {
                answer = 0;
              }
              }
              if(answer == 0)
              {
                  iSimulation = iNetSimulations.addNewSimulation();
                  iSimulation.setId(currSimulation.getId());
                  iSimulation.setSimulationname(currSimulation.getName());
                  Calendar cal = Calendar.getInstance();
                  cal.setTime(simulationCreationDate);
                  iSimulation.setSimulationdate(cal);
                  iTransitionsequence = iSimulation.addNewTransitionsequence();
                  for(Iterator<TransitionModel> iterator = currSimulation.getOccuredTransitions().iterator();iterator.hasNext();)
                  {
                    iOccuredTransition = iTransitionsequence.addNewOccuredtransition();
                    iOccuredTransition.setTransitionID((iterator.next()).getId());
                  }
                  iSimulation.setNetFingerprint(currSimulation.getFingerprint());
                  LoggerManager.debug(Constants.FILE_LOGGER, "   ... Simulation (ID:" + currSimulation.getId() + ") set");
              }
              else
View Full Code Here

TOP

Related Classes of org.woped.pnml.OccuredtransitionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.