Exemplo n.º 1
0
  public void activeHighlight(Xmas xnet, VisualXmas vnet) {
    QueueComponent qc;
    SyncComponent sc;
    VisualQueueComponent vqc;
    VisualSyncComponent vsc;

    for (Qslist ql : qslist) {
      if (ql.chk == 0) {
        for (Node node : vnet.getNodes()) {
          if (node instanceof VisualQueueComponent) {
            vqc = (VisualQueueComponent) node;
            qc = vqc.getReferencedQueueComponent();
            String rstr;
            rstr = xnet.getName(qc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(ql.name)) {
              vqc.setForegroundColor(Color.green);
            }
          } else if (node instanceof VisualSyncComponent) {
            vsc = (VisualSyncComponent) node;
            sc = vsc.getReferencedSyncComponent();
            String rstr;
            rstr = xnet.getName(sc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(ql.name)) {
              vsc.setForegroundColor(Color.green);
            }
          }
        }
      }
    }
  }
Exemplo n.º 2
0
  public void initHighlight(Xmas xnet, VisualXmas vnet) {
    VisualQueueComponent vqc;
    VisualSyncComponent vsc;

    for (Node node : vnet.getNodes()) {
      if (node instanceof VisualQueueComponent) {
        vqc = (VisualQueueComponent) node;
        vqc.setForegroundColor(Color.black);
      } else if (node instanceof VisualSyncComponent) {
        vsc = (VisualSyncComponent) node;
        vsc.setForegroundColor(Color.black);
      }
    }
  }
Exemplo n.º 3
0
  public void localHighlight(String s, Xmas xnet, VisualXmas vnet) {
    QueueComponent qc;
    SyncComponent sc;
    VisualQueueComponent vqc;
    VisualSyncComponent vsc;

    // System.out.println("s=" + s);
    for (String st : s.split(" |\n")) {
      if (st.startsWith("Q") || st.startsWith("S")) {
        System.out.println(st);
        for (Node node : vnet.getNodes()) {
          if (node instanceof VisualQueueComponent) {
            vqc = (VisualQueueComponent) node;
            qc = vqc.getReferencedQueueComponent();
            // if (xnet.getName(qc).contains(st)) {
            String rstr;
            rstr = xnet.getName(qc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(st)) {
              vqc.setForegroundColor(Color.red);
            }
          } else if (node instanceof VisualSyncComponent) {
            vsc = (VisualSyncComponent) node;
            sc = vsc.getReferencedSyncComponent();
            // if (xnet.getName(qc).contains(st)) {
            String rstr;
            rstr = xnet.getName(sc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(st)) {
              vsc.setForegroundColor(Color.red);
            }
          }
        }
      }
    }
  }
Exemplo n.º 4
0
  public void relHighlight(String s, Xmas xnet, VisualXmas vnet) {
    int typ = 0;
    String str = "";
    QueueComponent qc;
    SyncComponent sc;
    VisualQueueComponent vqc;
    VisualSyncComponent vsc;

    for (String st : s.split(" |;|\n")) {
      // if (st.startsWith("Q")) {
      if (st.contains("->")) {
        // System.out.println("testst" + st);
        typ = 0;
        for (String st2 : st.split("->")) {
          str = st2;
          // System.out.println("str===" + str);
          for (Node node : vnet.getNodes()) {
            if (node instanceof VisualQueueComponent) {
              vqc = (VisualQueueComponent) node;
              qc = vqc.getReferencedQueueComponent();
              // System.out.println("x===" + xnet.getName(qc));
              String rstr;
              rstr = xnet.getName(qc);
              rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
              if (rstr.equals(str) && typ == 0) {
                vqc.setForegroundColor(Color.pink);
              }
            } else if (node instanceof VisualSyncComponent) {
              vsc = (VisualSyncComponent) node;
              sc = vsc.getReferencedSyncComponent();
              // System.out.println("strrr===" + str + ' ' + xnet.getName(sc));
              String rstr;
              rstr = xnet.getName(sc);
              rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
              if (rstr.equals(str) && typ == 0) {
                vsc.setForegroundColor(Color.pink);
              }
            }
          }
        }
      } else if (st.contains("<-")) {
        // System.out.println("testst_" + st);
        typ = 1;
        for (String st2 : st.split("<-")) {
          str = st2;
          // System.out.println("str===" + str);
          for (Node node : vnet.getNodes()) {
            if (node instanceof VisualQueueComponent) {
              vqc = (VisualQueueComponent) node;
              qc = vqc.getReferencedQueueComponent();
              String rstr;
              rstr = xnet.getName(qc);
              rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
              if (rstr.equals(str) && typ == 1) {
                vqc.setForegroundColor(Color.red);
              }
            } else if (node instanceof VisualSyncComponent) {
              vsc = (VisualSyncComponent) node;
              sc = vsc.getReferencedSyncComponent();
              String rstr;
              rstr = xnet.getName(sc);
              rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
              if (rstr.equals(str) && typ == 1) {
                vsc.setForegroundColor(Color.red);
              }
            }
          }
        }
      }

      // }
    }
  }