private void matchTriangular(double mean, Triangular t) {
    double c2v = 0.0;
    double var = 0.0;
    int i = (int) myTriangCasesCDF.getValue();

    switch (i) {
      case 1: // symmetric
        myC2vCDF.setRange(0.0, 1.0 / 6.0);
        c2v = myC2vCDF.getValue();
        var = c2v * mean * mean;
        triangSymmetric(mean, var, t);
        break;
      case 2: // positive skew
        myC2vCDF.setRange(0.0, 1.0 / 8.0);
        c2v = myC2vCDF.getValue();
        var = c2v * mean * mean;
        triangPositiveSkew(mean, var, t);
        break;
      case 3: // negative skew
        myC2vCDF.setRange(0.0, 1.0 / 2.0);
        c2v = myC2vCDF.getValue();
        var = c2v * mean * mean;
        triangNegativeSkew(mean, var, t);
        break;
    }
  }
  public QParameterSet generateQParameterSet() {
    QParameterSet q = new QParameterSet();

    q.mtba = myMTBACDF.getValue();
    q.numServers = (int) myServerCDF.getValue();
    q.rho = myRhoCDF.getValue();
    q.mst = q.rho * q.mtba * q.numServers;

    matchDistribution(q, ARRIVAL);
    matchDistribution(q, SERVICE);

    return (q);
  }
  private void matchDistribution(QParameterSet q, int processType) {
    double mean = 0.0;
    double p1 = 0.0;
    double p2 = 0.0;
    double p3 = 0.0;
    double[] param = new double[3];

    Distribution d;

    int type = (int) myDCDF.getValue();

    if (processType == ARRIVAL) {
      q.acdfType = type;
      q.acdf = (Distribution) myArrivalCDFs.get(q.acdfType - 1);
      d = q.acdf;
      mean = q.mtba;
    } else {
      q.scdfType = type;
      q.scdf = (Distribution) myServiceCDFs.get(q.scdfType - 1);
      d = q.scdf;
      mean = q.mst;
    }

    switch (type) {
      case EXPONENTIAL:
        matchExponential(mean, (Exponential) d);
        param = d.getParameters();
        p1 = param[0];
        break;
      case UNIFORM:
        matchUniform(mean, (Uniform) d);
        param = d.getParameters();
        p1 = param[0];
        p2 = param[1];
        break;
      case GAMMA:
        matchGamma(mean, (Gamma) d);
        param = d.getParameters();
        p1 = param[0];
        p2 = param[1];
        break;
      case WEIBULL:
        matchWeibull(mean, (Weibull) d);
        param = d.getParameters();
        p1 = param[0];
        p2 = param[1];
        break;
      case TRIANGULAR:
        matchTriangular(mean, (Triangular) d);
        param = d.getParameters();
        p1 = param[0];
        p2 = param[1];
        p3 = param[2];
        break;
      case LOGNORMAL:
        matchLognormal(mean, (Lognormal) d);
        param = d.getParameters();
        p1 = param[0];
        p2 = param[1];
        break;
    }

    double var = d.getVariance();
    double cv2 = var / (mean * mean);
    if (processType == ARRIVAL) {
      q.c2va = cv2;
      q.aP1 = p1;
      q.aP2 = p2;
      q.aP3 = p3;
    } else {
      q.c2vs = cv2;
      q.sP1 = p1;
      q.sP2 = p2;
      q.sP3 = p3;
    }
  }