Exemplo n.º 1
0
  private void parseCoordinates(Element element) {

    if (element.getName().equalsIgnoreCase(KMLCoordinates.COORDINATES)) {
      String value = element.getTextTrim();
      StringTokenizer st1 = new StringTokenizer(value, KMLCoordinates.POINT_SEPARATORS);
      int count = st1.countTokens();
      //            System.out.println(count + " tokens");

      point2Ds = new ArrayList<Point2D>(count);
      for (int i = 0; i < count; i++) {
        String line = st1.nextToken();
        StringTokenizer st2 = new StringTokenizer(line, KMLCoordinates.SEPARATOR);
        if (st2.countTokens() < 2 || st2.countTokens() > 3)
          throw new IllegalArgumentException(
              "All KML coordinates must contain (X,Y) or (X,Y,Z) values.  Error in element '"
                  + line
                  + "'");
        final double x = Double.valueOf(st2.nextToken());
        final double y = Double.valueOf(st2.nextToken());
        point2Ds.add(new Point2D.Double(x, y));
      }
      convertPointsToArrays();
      length = point2Ds.size() - 1;
    } else {
      for (Object child : element.getChildren()) {

        if (child instanceof Element) {
          parseCoordinates((Element) child);
        }
      }
    }
  }
Exemplo n.º 2
0
  public void workOutMinsAndMaxs() {
    StringTokenizer tokens = new StringTokenizer(getRenderString(), "\n");

    int noLines = tokens.countTokens();

    double height = (theFont.getSize2D() * noLines) + 5;
    double width = 0;

    while (tokens.hasMoreTokens()) {
      double l = theFont.getSize2D() * tokens.nextToken().length() * (5.0 / 8.0);
      if (l > width) width = l;
    }

    double parX;
    double parY;
    if (parent instanceof State) {
      parX = ((State) parent).getX();
      parY = ((State) parent).getY();
    } else if (parent instanceof Transition) {
      parX = ((Transition) parent).getMiddle().getX(); // dummy
      parY = ((Transition) parent).getMiddle().getY(); // dummy
    } else {
      parX = 0;
      parY = 0;
    }

    minX = parX + offsetX - 5;
    minY = parY + offsetY - 25;

    maxX = parX + width + offsetX + 5;
    maxY = parY + height + offsetY - 5;
  }
Exemplo n.º 3
0
  public Rectangle2D getBounds2D() {
    StringTokenizer tokens = new StringTokenizer(getRenderString(), "\n");

    int noLines = tokens.countTokens();

    double height = (theFont.getSize2D() * noLines) + 5;
    double width = 0;

    while (tokens.hasMoreTokens()) {
      double l = theFont.getSize2D() * tokens.nextToken().length() * (5.0 / 8.0);
      if (l > width) width = l;
    }

    double parX;
    double parY;
    if (parent instanceof State) {
      parX = ((State) parent).getX();
      parY = ((State) parent).getY();
    } else if (parent instanceof Transition) {
      parX = ((Transition) parent).getMiddle().getX(); // dummy
      parY = ((Transition) parent).getMiddle().getY(); // dummy
    } else {
      parX = 0;
      parY = 0;
    }

    double mx = parX + offsetX;
    double my = parY + offsetY - 10;

    double tx = parX + width + offsetX;
    double ty = parY + height + offsetY - 10;

    return new Rectangle2D.Double(mx, my, tx - mx, ty - my);
  }
Exemplo n.º 4
0
 private void newLabel(String s) {
   StringTokenizer tkn = new StringTokenizer(s, "\n");
   num_lines = tkn.countTokens();
   lines = new String[num_lines];
   line_widths = new int[num_lines];
   for (int i = 0; i < num_lines; i++) {
     lines[i] = tkn.nextToken();
   }
 }
Exemplo n.º 5
0
    protected void buildPanel(String strPath) {
      strPath = FileUtil.openPath(strPath);
      ArrayList aListPath = new ArrayList();
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      if (reader == null) return;

      String strLine;
      try {
        while ((strLine = reader.readLine()) != null) {
          StringTokenizer strTok = new StringTokenizer(strLine, ":");
          if (strTok.countTokens() < 4) continue;

          boolean bChecksum = false;
          boolean bShow = false;

          String strDir = strTok.nextToken();
          String strChecksum = strTok.nextToken();

          if (strChecksum.equalsIgnoreCase("checksum")) bChecksum = true;

          if (bChecksum && (strDir.equals("file") || strDir.equals("dir"))) {
            String strValue = strTok.nextToken();
            String strShow = strTok.nextToken();
            if (strShow.equalsIgnoreCase("yes")) bShow = true;

            if (bShow) aListPath.add(strValue);
          }
        }

        m_cmbPath = new JComboBox(aListPath.toArray());

        JPanel pnlDisplay = new JPanel(new GridBagLayout());
        GridBagConstraints gbc =
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                0.2,
                0.2,
                GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL,
                new Insets(0, 0, 0, 0),
                0,
                0);
        pnlDisplay.add(m_cmbPath, gbc);
        gbc.gridx = 1;
        pnlDisplay.add(m_cmbChecksum, gbc);
        add(pnlDisplay, BorderLayout.NORTH);
        add(m_txaChecksum, BorderLayout.CENTER);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Exemplo n.º 6
0
  // Method that draws all elements in each set starting with the root and then
  // calling traverse to get the rest of the tree
  void drawSets(LinkedList llist, draw d) {
    int temp;
    double stringLength = 0.0;
    String s = "";
    StringTokenizer getWeight;
    GTN gtn = new GTN();
    GTN TempChild;

    x = .0;
    y = TitleEndy - .24;

    nodelist.reset();
    while (nodelist.hasMoreElements()) {
      if (nodelist.hasMoreElements()) gtn = (GTN) (nodelist.nextElement());
      else gtn = (GTN) (nodelist.currentElement());

      // traverse down current tree
      s = traverse(gtn, s, llist, d, true);
      s += "}";

      BufferedImage buffer =
          new BufferedImage(
              GaigsAV.preferred_width, GaigsAV.preferred_height, BufferedImage.TYPE_BYTE_GRAY);

      temp = buffer.getGraphics().getFontMetrics(defaultFont).stringWidth(s);

      //		temp = d.getGraphics().getFontMetrics(defaultFont).stringWidth(s);

      stringLength = ((double) temp / (double) d.getSize().width);

      // gets the weight of the current set
      getWeight = new StringTokenizer(s, ",");
      LGKS.set_text_align(0, 2, llist, d);
      LGKS.text(gtn.Gx, (gtn.Gy + Lenx + .02), ("" + getWeight.countTokens()), llist, d);

      LGKS.set_text_align(1, 2, llist, d);
      // these checks insure that the set info will be drawn within
      // the bounds of the window
      if ((x + stringLength) >= 1.0) {
        x = 0;
        y -= .05;
        LGKS.text(x, y, s, llist, d);
        x = stringLength + .05;
      } else {
        LGKS.text(x, y, s, llist, d);
        x += stringLength + .05;
      }

      s = "";
    }
  }
Exemplo n.º 7
0
  public void setText(final String text) {
    String currentText = text;
    if (currentText == null) currentText = "";

    StringTokenizer tkn = new StringTokenizer(currentText, "\n");

    numLines = tkn.countTokens();
    lines = new String[numLines];
    lineWidths = new int[numLines];

    for (int i = 0; i < numLines; i++) lines[i] = tkn.nextToken();

    recalculateDimension();
    repaint();
  }
Exemplo n.º 8
0
  /** Set the matching descriptors. */
  private void setMatchingFileNames() {
    StringTokenizer st = new StringTokenizer(matchingTF.getText(), ",");

    int numTokens = st.countTokens();

    if (numTokens == 0) {
      descriptors = new String[1];
      descriptors[0] = "*";
      return;
    }

    descriptors = new String[numTokens];

    int i = 0;
    while (st.hasMoreElements()) {
      descriptors[i++] = st.nextToken().trim();
    }
  }
Exemplo n.º 9
0
  static int command(JopSession session, String cmd) {
    boolean local_cmd = false;
    Object root = session.getRoot();
    Gdh gdh = session.getEngine().gdh;

    System.out.println("JopSpider command : " + cmd);
    if (root instanceof JopApplet) {
      if (((JopApplet) root).engine.isInstance())
        cmd = RtUtilities.strReplace(cmd, "$object", ((JopApplet) root).engine.getInstance());
    }

    Cli cli = new Cli(cliTable);
    String command = cli.parse(cmd);
    if (cli.oddSts()) {
      System.out.println("JopSpider1 : " + command);
      if (command.equals("OPEN")) {
        if (cli.qualifierFound("cli_arg1")) {

          String jgraph = "JGRAPH";
          String graph = "GRAPH";
          String url = "URL";
          String trend = "TREND";
          String fast = "FAST";
          String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
          if (jgraph.length() >= cli_arg1.length()
              && jgraph.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "OPEN JGRAPH"

            boolean newFrame = cli.qualifierFound("/NEW");
            boolean scrollbar = cli.qualifierFound("/SCROLLBAR");

            if (!cli.qualifierFound("cli_arg2")) {
              System.out.println("Syntax error");
              return 0;
            }
            String frameName = cli.getQualValue("cli_arg2");
            String instance = cli.getQualValue("/INSTANCE");

            if (session.isOpWindowApplet()) {
              frameName = frameName.substring(0, 1).toUpperCase() + frameName.substring(1);
              System.out.println("Open frame " + frameName);
              session.openGraphFrame(frameName, instance, scrollbar, false);
            } else if (session.isApplet()) {
              System.out.println("Loading applet \"" + frameName + "\"");
              openURL(session, frameName, newFrame, null, null);
              local_cmd = true;
            } else {
              System.out.println("Loading frame \"" + frameName + "\"");
              try {
                loadFrame(session, frameName, instance, scrollbar);
              } catch (ClassNotFoundException e) {
              }
              local_cmd = true;
            }
          } else if (graph.length() >= cli_arg1.length()
              && graph.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "OPEN GRAPH"
            if (root instanceof JopApplet) {
              System.out.println("open graph for JopApplet");

              boolean newFrame = cli.qualifierFound("/NEW");
              boolean scrollbar = cli.qualifierFound("/SCROLLBAR");

              if (cli.qualifierFound("/OBJECT")) {
                String objectValue = cli.getQualValue("/OBJECT");
                String objectName;
                String appletName;
                String instance = null;

                // Replace * by node object
                if (objectValue.charAt(0) == '*') {
                  CdhrObjid cdhr_node = gdh.getNodeObject(0);
                  if (cdhr_node.evenSts()) return 0;
                  CdhrString cdhr_nodestr =
                      gdh.objidToName(cdhr_node.objid, Cdh.mName_volumeStrict);
                  objectName = cdhr_nodestr.str + objectValue.substring(1);
                } else objectName = objectValue;

                String attrName = objectName + ".Action";
                CdhrString cdhr = gdh.getObjectInfoString(attrName);
                if (cdhr.evenSts()) {
                  System.out.println("Object name error");
                  return 0;
                }
                int idx = cdhr.str.lastIndexOf(".pwg");
                if (idx != -1) {
                  // appletName = cdhr.str.substring(0, idx);
                  appletName = cdhr.str; // atest
                } else {
                  idx = cdhr.str.lastIndexOf(".class");
                  if (idx != -1) appletName = cdhr.str.substring(0, idx);
                  else {
                    // This is a command
                    return command(session, cdhr.str);
                  }
                }

                attrName = objectName + ".Object";
                cdhr = gdh.getObjectInfoString(attrName);
                if (cdhr.oddSts() && !cdhr.str.equals("")) instance = cdhr.str;

                if (session.isOpWindowApplet()) {
                  // atest  appletName = appletName.substring(0,1).toUpperCase() +
                  //       appletName.substring(1);
                  System.out.println("Open frame " + appletName);
                  session.openGraphFrame(appletName, instance, false, false);
                } else {
                  System.out.println("Loading applet \"" + appletName + "\"");
                  openURL(session, appletName, newFrame, null, null);
                }
                local_cmd = true;
              } else {
                if (true /* session.isOpWindowApplet() */) {
                  String frameName = null;
                  String instanceValue = null;
                  boolean classGraph = false;

                  if (cli.qualifierFound("/INSTANCE")) {
                    instanceValue = cli.getQualValue("/INSTANCE");
                    classGraph = cli.qualifierFound("/CLASSGRAPH");
                    boolean parent = cli.qualifierFound("/PARENT");
                    if (parent) {
                      int idx = instanceValue.lastIndexOf('.');
                      if (idx != -1 && idx != 0) instanceValue = instanceValue.substring(0, idx);
                      System.out.println("open graph /parent: " + instanceValue);
                    }
                  }
                  if (!classGraph) {
                    if (!cli.qualifierFound("cli_arg2")) {
                      System.out.println("Syntax error");
                      return 0;
                    }
                    frameName = cli.getQualValue("cli_arg2").toLowerCase();

                    frameName = frameName.substring(0, 1).toUpperCase() + frameName.substring(1);
                    System.out.println("Open frame " + frameName);
                  }
                  session.openGraphFrame(frameName, instanceValue, scrollbar, classGraph);
                }
                /**
                 * *********** else { String frameName = null; if ( !
                 * cli.qualifierFound("cli_arg2")) { System.out.println("Syntax error"); return 0; }
                 * frameName = cli.getQualValue("cli_arg2").toLowerCase();
                 *
                 * <p>if ( cli.qualifierFound("/INSTANCE")) { String instanceValue =
                 * cli.getQualValue("/INSTANCE").toLowerCase();
                 *
                 * <p>boolean parent = cli.qualifierFound("/PARENT"); if ( parent) { int idx =
                 * instanceValue.lastIndexOf( '.'); if ( idx != -1 && idx != 0) instanceValue =
                 * instanceValue.substring( 0, idx); System.out.println( "open graph /parent: " +
                 * instanceValue); }
                 *
                 * <p>String tempFile = frameName + "_" +
                 * instanceValue.replace('å','a').replace('ä','a').replace('ö','o'); PwrtStatus psts
                 * = gdh.createInstanceFile( "$pwrp_websrv/"+frameName+".html", tempFile+".html",
                 * instanceValue); if ( psts.evenSts()) { System.out.println("createInstanceFile
                 * error"); return 0; } frameName = tempFile; }
                 *
                 * <p>System.out.println( "Loading applet \"" + frameName + "\"");
                 *
                 * <p>openURL( session, frameName, newFrame, null, null); local_cmd = true; } *
                 */
              }
            } else {
              // Application
              boolean newFrame = cli.qualifierFound("/NEW");
              boolean scrollbar = cli.qualifierFound("/SCROLLBAR");
              String frameName = null;
              String instanceValue = null;
              boolean classGraph = false;
              if (cli.qualifierFound("/INSTANCE")) {
                instanceValue = cli.getQualValue("/INSTANCE");
                classGraph = cli.qualifierFound("/CLASSGRAPH");

                boolean parent = cli.qualifierFound("/PARENT");
                if (parent) {
                  int idx = instanceValue.lastIndexOf('.');
                  if (idx != -1 && idx != 0) instanceValue = instanceValue.substring(0, idx);
                  System.out.println("open graph /parent: " + instanceValue);
                }
              }
              if (cli.qualifierFound("/OBJECT")) {
                String objectValue = cli.getQualValue("/OBJECT");
                String objectName;
                String appletName;
                String instance = null;

                // Replace * by node object
                if (objectValue.charAt(0) == '*') {
                  CdhrObjid cdhr_node = gdh.getNodeObject(0);
                  if (cdhr_node.evenSts()) return 0;
                  CdhrString cdhr_nodestr =
                      gdh.objidToName(cdhr_node.objid, Cdh.mName_volumeStrict);
                  objectName = cdhr_nodestr.str + objectValue.substring(1);
                } else objectName = objectValue;

                String attrName = objectName + ".Action";
                CdhrString cdhr = gdh.getObjectInfoString(attrName);
                if (cdhr.evenSts()) {
                  System.out.println("Object name error");
                  return 0;
                }
                int idx = cdhr.str.lastIndexOf(".pwg");
                if (idx != -1) {
                  // appletName = cdhr.str.substring(0, idx);
                  appletName = cdhr.str; // atest
                } else {
                  idx = cdhr.str.lastIndexOf(".class");
                  if (idx != -1) appletName = cdhr.str.substring(0, idx);
                  else {
                    // This is a command
                    return command(session, cdhr.str);
                  }
                }

                attrName = objectName + ".Object";
                cdhr = gdh.getObjectInfoString(attrName);
                if (cdhr.oddSts() && !cdhr.str.equals("")) instance = cdhr.str;

                System.out.println("Open frame " + appletName);
                session.openGraphFrame(appletName, instance, false, false);
                local_cmd = true;
              }
              if (!classGraph) {
                if (cli.qualifierFound("/FILE")) {
                  frameName = cli.getQualValue("/FILE");
                  if (frameName.indexOf(".pwg") == -1) frameName = frameName + ".pwg";
                } else if (cli.qualifierFound("cli_arg2")) {
                  frameName = cli.getQualValue("cli_arg2").toLowerCase();

                  frameName = frameName.substring(0, 1).toUpperCase() + frameName.substring(1);
                } else {
                  System.out.println("Syntax error");
                  return 0;
                }

                System.out.println("Open frame " + frameName);
              }
              session.openGraphFrame(frameName, instanceValue, scrollbar, classGraph);
            }
          } else if (url.length() >= cli_arg1.length()
              && url.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "OPEN URL"
            if (root instanceof JopApplet) {
              if (cli.qualifierFound("cli_arg2")) {
                Boolean newFrame = true;
                String frameName = null;
                String urlValue = cli.getQualValue("cli_arg2");
                System.out.println("open url " + urlValue);
                if (urlValue.startsWith("pwrb_")
                    || urlValue.startsWith("pwrs_")
                    || urlValue.startsWith("nmps_")
                    || urlValue.startsWith("profibus_")
                    || urlValue.startsWith("otherio_")
                    || urlValue.startsWith("opc_")
                    || urlValue.startsWith("basecomponent_")
                    || urlValue.startsWith("abb_")
                    || urlValue.startsWith("siemens_")
                    || urlValue.startsWith("ssabox_"))
                  // Object reference manual
                  urlValue = "$pwr_doc/" + session.getLang() + "/orm/" + urlValue;

                if (cli.qualifierFound("/NAME")) {
                  frameName = cli.getQualValue("/NAME");
                  newFrame = false;
                }

                openURL(session, urlValue, newFrame, frameName, null);
              }
            }
          } else if (trend.length() >= cli_arg1.length()
              && trend.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "OPEN TREND"
            String name;

            if (cli.qualifierFound("cli_arg2")) name = cli.getQualValue("cli_arg2");
            else name = cli.getQualValue("/NAME");

            StringTokenizer tokens = new StringTokenizer(name, ",");
            int cnt = tokens.countTokens();
            String[] trendList = new String[cnt];

            for (int i = 0; i < cnt; i++) trendList[i] = tokens.nextToken();

            session.openTrend(trendList);
          } else if (fast.length() >= cli_arg1.length()
              && fast.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "OPEN FAST"
            String name;

            if (cli.qualifierFound("cli_arg2")) name = cli.getQualValue("cli_arg2");
            else name = cli.getQualValue("/NAME");

            session.openFast(name);
          } else {
            System.out.println("Unknown command");
          }
        }
      } else if (command.equals("HELP")) {
        if (root instanceof JopApplet) {
          String fileName = "xtt_help_";
          String bookmarkValue = null;

          if (cli.qualifierFound("/VERSION")) {
            openURL(session, "$pwr_doc/xtt_version_help_version.html", true, null, null);
          } else {
            if (cli.qualifierFound("/BASE"))
              // Not language dependent !! TODO
              fileName = "$pwr_doc/help/xtt_help_";

            if (cli.qualifierFound("cli_arg1"))
              fileName += cli.getQualValue("cli_arg1").toLowerCase();
            if (cli.qualifierFound("cli_arg2"))
              fileName += "_" + cli.getQualValue("cli_arg2").toLowerCase();
            if (cli.qualifierFound("cli_arg3"))
              fileName += "_" + cli.getQualValue("cli_arg3").toLowerCase();
            if (cli.qualifierFound("cli_arg4"))
              fileName += "_" + cli.getQualValue("cli_arg4").toLowerCase();

            if (fileName.startsWith("pwrb_")
                || fileName.startsWith("pwrs_")
                || fileName.startsWith("nmps_")
                || fileName.startsWith("profibus_")
                || fileName.startsWith("otherio_")
                || fileName.startsWith("opc_")
                || fileName.startsWith("basecomponent_")
                || fileName.startsWith("abb_")
                || fileName.startsWith("siemens_")
                || fileName.startsWith("ssabox_"))
              // Object reference manual
              fileName = "$pwr_doc/orm/" + fileName;

            if (cli.qualifierFound("/BOOKMARK")) bookmarkValue = cli.getQualValue("/BOOKMARK");

            System.out.println("Loading helpfile \"" + fileName + "\"");
            openURL(session, fileName, true, null, bookmarkValue);
          }
          local_cmd = true;
        }
      } else if (command.equals("SET")) {
        if (cli.qualifierFound("cli_arg1")) {

          String parameter = "PARAMETER";
          String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
          if (parameter.length() >= cli_arg1.length()
              && parameter.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "SET PARAMETER"
            if (root instanceof JopApplet) {
              String name;
              String value;
              PwrtStatus sts;

              local_cmd = true;
              if (cli.qualifierFound("/NAME")) name = cli.getQualValue("/NAME");
              else {
                System.out.println("Cmd: name is missing\n");
                return 0;
              }
              if (cli.qualifierFound("/VALUE")) value = cli.getQualValue("/VALUE");
              else {
                System.out.println("Cmd: value is missing\n");
                return 0;
              }
              boolean bypass = cli.qualifierFound("/BYPASS");
              if (!bypass) {
                // Need RtWrite or System to set attribute
                if (!gdh.isAuthorized(Pwr.mPrv_RtWrite | Pwr.mPrv_System)) {
                  System.out.println("No authorized");
                  return 0;
                }
              }

              // Get type of attribute
              GdhrGetAttributeChar ret = gdh.getAttributeChar(name);
              if (ret.evenSts()) return 0;

              if (ret.typeId == Pwr.eType_Float32) {
                float setValue = Float.parseFloat(value);
                sts = gdh.setObjectInfo(name, setValue);
              } else if (ret.typeId == Pwr.eType_Boolean) {
                boolean setValue = (Integer.parseInt(value, 10) != 0);
                sts = gdh.setObjectInfo(name, setValue);
              } else if (ret.typeId == Pwr.eType_Int32
                  || ret.typeId == Pwr.eType_UInt32
                  || ret.typeId == Pwr.eType_Int16
                  || ret.typeId == Pwr.eType_UInt16
                  || ret.typeId == Pwr.eType_Int8
                  || ret.typeId == Pwr.eType_UInt8
                  || ret.typeId == Pwr.eType_Mask
                  || ret.typeId == Pwr.eType_Enum) {
                int setValue = Integer.parseInt(value, 10);
                sts = gdh.setObjectInfo(name, setValue);
              } else if (ret.typeId == Pwr.eType_String) {
                sts = gdh.setObjectInfo(name, value);
              } else return 0;

              if (sts.evenSts()) System.out.println("setObjectInfoError " + sts);
            }
          }
        }
      } else if (command.equals("CHECK")) {
        if (cli.qualifierFound("cli_arg1")) {

          String methodstr = "METHOD";
          String isattributestr = "ISATTRIBUTE";
          String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
          if (methodstr.length() >= cli_arg1.length()
              && methodstr.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "CHECK METHOD"
            String method;
            String object;

            if (cli.qualifierFound("/METHOD")) method = cli.getQualValue("/METHOD");
            else {
              System.out.println("Cmd: Method is missing\n");
              return 0;
            }

            if (cli.qualifierFound("/OBJECT")) object = cli.getQualValue("/OBJECT");
            else {
              System.out.println("Cmd: Object is missing\n");
              return 0;
            }

            if (methObject == null || object.compareToIgnoreCase(methObject) != 0) {
              CdhrAttrRef oret = gdh.nameToAttrRef(object);
              if (oret.evenSts()) return 0;

              CdhrTypeId cret = gdh.getAttrRefTid(oret.aref);
              if (cret.evenSts()) return 0;

              methObject = object;
              methAref = oret.aref;
              methClassId = cret.typeId;
            }

            JopMethods methods =
                new JopMethods(session, methAref, methObject, methClassId, JopUtility.NO);

            boolean b = methods.callFilterMethod(method);
            System.out.println(
                "Cmd check method: " + method + " , Object: " + object + ", value: " + b);
            if (b) return 1;
            else return 0;
          } else if (isattributestr.length() >= cli_arg1.length()
              && isattributestr.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "CHECK ISATTRIBUTE"
            String method;
            String object;

            if (cli.qualifierFound("/OBJECT")) object = cli.getQualValue("/OBJECT");
            else {
              System.out.println("Cmd: Object is missing\n");
              return 0;
            }

            if (methObject == null || object.compareToIgnoreCase(methObject) != 0) {
              CdhrAttrRef oret = gdh.nameToAttrRef(object);
              if (oret.evenSts()) return 0;

              CdhrTypeId cret = gdh.getAttrRefTid(oret.aref);
              if (cret.evenSts()) return 0;

              methObject = object;
              methAref = oret.aref;
              methClassId = cret.typeId;
            }

            if ((methAref.flags & PwrtAttrRef.OBJECTATTR) != 0) return 1;
            else return 0;
          }
        }
      } else if (command.equals("CALL")) {
        if (cli.qualifierFound("cli_arg1")) {

          String parameter = "METHOD";
          String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
          if (parameter.length() >= cli_arg1.length()
              && parameter.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "CHECK METHOD"
            String method;
            String object;

            if (cli.qualifierFound("/METHOD")) method = cli.getQualValue("/METHOD");
            else {
              System.out.println("Cmd: Method is missing\n");
              return 0;
            }

            if (cli.qualifierFound("/OBJECT")) object = cli.getQualValue("/OBJECT");
            else {
              System.out.println("Cmd: Object is missing\n");
              return 0;
            }

            if (methObject == null || object.compareToIgnoreCase(methObject) != 0) {
              CdhrAttrRef oret = gdh.nameToAttrRef(object);
              if (oret.evenSts()) return 0;

              CdhrTypeId cret = gdh.getAttrRefTid(oret.aref);
              if (cret.evenSts()) return 0;

              methObject = object;
              methAref = oret.aref;
              methClassId = cret.typeId;
            }

            JopMethods methods =
                new JopMethods(session, methAref, methObject, methClassId, JopUtility.NO);

            methods.callMethod(method);
            System.out.println("Cmd call method: " + method + " , Object: " + object);
            return 1;
          }
        }
      } else if (command.equals("SET")) {
        if (cli.qualifierFound("cli_arg1")) {

          String parameter = "LANGUAGE";
          String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
          if (parameter.length() >= cli_arg1.length()
              && parameter.substring(0, cli_arg1.length()).equals(cli_arg1)) {
            // Command is "SET LANGUAGE"
            String cli_arg2;

            if (cli.qualifierFound("cli_arg2")) cli_arg2 = cli.getQualValue("cli_arg2");
            else {
              System.out.println("Cmd: Language is missing\n");
              return 0;
            }

            JopLang lng = new JopLang(session);
            lng.set(cli_arg2);
            JopLang.setDefault(lng);
            return 1;
          }
        }
      }
    } else {
      System.out.println("JopSpider: Parse error " + cli.getStsString());
      return 0;
    }

    if (!local_cmd) {
      // Send to xtt
      if (qcom != null) {
        PwrtStatus sts = qcom.put(op_qcom_qix, op_qcom_nid, cmd);
        System.out.println("Send " + cmd + "  sts: " + sts.getSts());
        if (sts.evenSts()) System.out.println("Qcom put error: " + sts.getSts());
      }
    }
    return 1;
  }