Beispiel #1
0
  public void deltext(double e, message x) {
    Continue(e);

    if (phaseIs("waitTN")) {
      for (int i = 0; i < x.size(); i++)
        if (messageOnPort(x, "getTN", i)) {
          entity ent = x.getValOnPort("getTN", i);
          doubleEnt tEnt = (doubleEnt) ent;
          double t = tEnt.getv();
          if (t < tN) tN = t;
        }

    } else if (phaseIs("waitOut")) {
      for (int i = 0; i < x.size(); i++)
        if (messageOnPort(x, "getOutFromG", i)) {
          entity ent = x.getValOnPort("getOutFromG", i);
          message m = (message) ent;
          entity mEnt = m.read(0);

          content con = (content) mEnt;
          if (con.getPort().equals("out")) { // use g to p and t coupling
            pMail.add(makeContent("in", (entity) con.getValue()));
            tMail.add(makeContent("ariv", (entity) con.getValue()));
          }
        } else if (messageOnPort(x, "getOutFromP", i)) {
          entity ent = x.getValOnPort("getOutFromP", i);
          message m = (message) ent;
          for (int j = 0; j < m.size(); j++)
            if (messageOnPort(m, "out", j)) {
              entity val = m.getValOnPort("out", j);
              // use p to  t coupling
              tMail.add(makeContent("solved", val));
            }

        } else if (messageOnPort(x, "getOutFromT", i)) {
          entity ent = x.getValOnPort("getOutFromT", i);
          message m = (message) ent;
          for (int j = 0; j < m.size(); j++)
            if (true) // (messageOnPort(m,"out",j))
            {
              // use t to  g coupling
              gMail.add(makeContent("stop", new entity()));
            }
        }
    }
  }
Beispiel #2
0
  public void deltext(double e, message x) {
    Continue(e);

    if (phaseIs("passive")) {

      for (int i = 0; i < x.getLength(); i++)
        if (messageOnPort(x, "in", i)) {
          job = x.getValOnPort("in", i);
          input = "in";
          holdIn("busy", processing_time);
        }
      for (int i = 0; i < x.getLength(); i++)
        if (messageOnPort(x, "in1", i)) {
          job = x.getValOnPort("in1", i);
          input = "in1";
          holdIn("busy", processing_time);
        }
    }
    sw = !sw;
  }