Package jmt.gui.common.serviceStrategies

Examples of jmt.gui.common.serviceStrategies.LDStrategy$Range


        distrParams[i] = new XMLParameter("ZeroTimeServiceStrategy",
            ZeroStrategy.getEngineClassPath(),
            model.getClassName(currentClass), (String) null, true);
      } else {
        // Load dependent Service Time Strategy --- Bertoli Marco
        LDStrategy strategy = (LDStrategy) serviceDistribution;
        XMLParameter[] ranges = new XMLParameter[strategy
            .getRangeNumber()];
        Object[] rangeKeys = strategy.getAllRanges();

        for (int j = 0; j < ranges.length; j++) {
          // Creates "from" parameter
          XMLParameter from = new XMLParameter("from",
              Integer.class.getName(), null,
              Integer.toString(strategy
                  .getRangeFrom(rangeKeys[j])), true);
          // Creates "distribution" parameter
          XMLParameter[] distribution = DistributionWriter
              .getDistributionParameter(strategy
                  .getRangeDistribution(rangeKeys[j]));
          // Creates "function" parameter (mean value of the
          // distribution)
          XMLParameter function = new XMLParameter("function",
              String.class.getName(), null,
              strategy.getRangeDistributionMean(rangeKeys[j]),
              true);
          ranges[j] = new XMLParameter("LDParameter",
              strategiesClasspathBase + serviceStrategiesSuffix
                  + "LDParameter", null, new XMLParameter[] {
                  from, distribution[0], distribution[1],
View Full Code Here


          key = output.addStation(name, CommonConstants.STATION_TYPE_SERVER);
          output.setStationNumberOfServers(new Integer(servers), key);
          output.setStationQueueStrategy(key, CommonConstants.QUEUE_STRATEGY_STATION_PS);
          // Sets distribution for each class
          for (int j = 0; j < classKeys.length; j++) {
            LDStrategy lds = new LDStrategy();
            Object rangeKey = lds.getAllRanges()[0];
            for (int range = 0; range < serviceTimes[j].length; range++) {
              // First range is already available
              if (range > 0) {
                rangeKey = lds.addRange();
              }
              Exponential ex = new Exponential();
              ex.setMean(serviceTimes[j][range]);
              lds.setRangeDistribution(rangeKey, ex);
              lds.setRangeDistributionMean(rangeKey, Double.toString(serviceTimes[j][range]));
            }
            output.setServiceTimeDistribution(key, classKeys[j], lds);
          }
          break;
      }
View Full Code Here

          }
        } else if (serv instanceof ZeroStrategy) {
          serviceTimes[st][cl] = new double[1];
          serviceTimes[st][cl][0] = 0;
        } else if (serv instanceof LDStrategy) {
          LDStrategy lds = (LDStrategy) serv;
          if (output.isClosed() && !output.isMultiClass()) {
            int pop = input.getClassPopulation(classKeys.get(cl)).intValue();
            serviceTimes[st][cl] = new double[pop]; // This is load dependent
            stationTypes[st] = ExactConstants.STATION_LD;
            for (int i = 0; i < pop; i++) {
              serviceTimes[st][cl][i] = lds.getMeanValue(i);
            }
          } else {
            serviceTimes[st][cl] = new double[1]; // This is not load dependent
            serviceTimes[st][cl][0] = lds.getMeanValue(1);
            res.add("LD stations are supported only if model is closed and " + "single class. " + stationNames[st]
                + " was converted to a LI station.");
          }
        }
      }
View Full Code Here

              warnings[BCMP_FCFS_EXPONENTIAL_WARNING] = true;
              BCMPserversFCFSWithoutExponential.add(thisServer);
              break;
            }
          } else if (service instanceof LDStrategy) {
            LDStrategy ld = (LDStrategy) service;
            Object[] ranges = ld.getAllRanges();
            for (Object range : ranges) {
              Distribution d = ld.getRangeDistribution(range);
              if (!d.getName().equals(CommonConstants.DISTRIBUTION_EXPONENTIAL)) {
                warnings[BCMP_FCFS_EXPONENTIAL_WARNING] = true;
                BCMPserversFCFSWithoutExponential.add(thisServer);
                ok = false;
                break;
View Full Code Here

                BCMPFcfsServersWithDifferentServiceTimes.add(thisServer);
                break;
              }
            }
          } else if (service instanceof LDStrategy) {
            LDStrategy ld = (LDStrategy) service;
            for (int j = 0; j < classes.size(); j++) {
              Object thisClass = classes.get(j);
              LDStrategy thisLd = (LDStrategy) station_def.getServiceTimeDistribution(thisServer, thisClass);
              if (!ld.isEquivalent(thisLd)) {
                warnings[BCMP_FCFS_DIFFERENT_SERVICE_TIMES_WARNING] = true;
                BCMPFcfsServersWithDifferentServiceTimes.add(thisServer);
                break;
              }
View Full Code Here

              warnings[BCMP_DELAY_WARNING] = true;
              BCMPdelaysWithNonRationalServiceDistribution.add(thisDelay);
              break;
            }
          } else if (service instanceof LDStrategy) {
            LDStrategy ld = (LDStrategy) service;
            Object[] ranges = ld.getAllRanges();
            for (Object range : ranges) {
              if (ld.getRangeDistribution(range).getName().equals(CommonConstants.DISTRIBUTION_PARETO)) {
                warnings[BCMP_DELAY_WARNING] = true;
                BCMPdelaysWithNonRationalServiceDistribution.add(thisDelay);
                break;
              }
            }
View Full Code Here

        // Load dependency
        case (1):
          if (SERVICE_LOAD_DEPENDENT.equals(aValue)) {
            // Puts a LDService strategy only if previously it was different
            if (!(data.getServiceTimeDistribution(stationKey, classKey) instanceof LDStrategy)) {
              data.setServiceTimeDistribution(stationKey, classKey, new LDStrategy());
            }
          } else if (SERVICE_ZERO.equals(aValue)) {
            data.setServiceTimeDistribution(stationKey, classKey, new ZeroStrategy());
          } else {
            // Puts default service strategy, only if previously a load dependent was chosen
View Full Code Here

      // Zero service time strategy
      return new ZeroStrategy();
    } else if (serviceClassPath.equals(LDStrategy.getEngineClassPath())) {
      // Load dependent Service Strategy
      Element LDParameterArray = (Element) serviceTimeStrategy.getElementsByTagName(XML_E_SUBPARAMETER).item(0);
      LDStrategy strategy = new LDStrategy();
      // Now parses LDStrategy ranges
      Vector<Node> ranges = parseParameterArray(LDParameterArray);
      for (int i = 0; i < ranges.size(); i++) {
        Vector<Node> parameters = parseParameterArray((Element) ranges.get(i));
        int from = Integer.parseInt(findText(((Element) parameters.get(0)).getElementsByTagName(XML_E_SUBPARAMETER_VALUE).item(0)));
        Distribution distr = parseDistribution((Element) parameters.get(1), (Element) parameters.get(2));
        String mean = findText(((Element) parameters.get(3)).getElementsByTagName(XML_E_SUBPARAMETER_VALUE).item(0));
        Object key;
        if (from == 1) {
          // If this is first range
          key = strategy.getAllRanges()[0];
        } else {
          // next ranges
          key = strategy.addRange();
          strategy.setRangeFrom(key, from);
          // This is needed as key will change
          key = strategy.getAllRanges()[strategy.getRangeNumber() - 1];
        }
        strategy.setRangeDistributionNoCheck(key, distr);
        strategy.setRangeDistributionMeanNoCheck(key, mean);
      }
      return strategy;
    } else {

      //use the parseParameterArray function to return only DIRECT subparameters
View Full Code Here

    public static Link[] selectAlternate(Entry entry) {
        return selectAlternate(entry, Locale.getDefault());
    }

    public static Link[] selectAlternate(Source source, Locale locale) {
        return selectAlternate(source, new Range(Lang.fromLocale(locale), true));
    }
View Full Code Here

    public static Link[] selectAlternate(Source source, Locale locale) {
        return selectAlternate(source, new Range(Lang.fromLocale(locale), true));
    }

    public static Link[] selectAlternate(Entry entry, Locale locale) {
        return selectAlternate(entry, new Range(Lang.fromLocale(locale), true));
    }
View Full Code Here

TOP

Related Classes of jmt.gui.common.serviceStrategies.LDStrategy$Range

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.