示例#1
0
 private static String getNextToken(StringTokenizer st) {
   while (st.hasMoreTokens()) {
     String tok = st.nextToken().trim();
     if (tok.length() > 0) return tok;
   }
   return null;
 }
示例#2
0
 private static Object parseValue(String value, Prop p, Class type) {
   Object v = value;
   if (type.isArray()) {
     StringTokenizer st = new StringTokenizer(value, ",");
     Class ctype = type.getComponentType();
     v = Array.newInstance(ctype, st.countTokens());
     for (int i = 0; st.hasMoreTokens(); i++)
       Array.set(v, i, parseValue(st.nextToken(), p, ctype));
   } else if (type == boolean.class) {
     v = Boolean.valueOf(value);
   } else if (type == double.class) {
     v = Double.valueOf(value);
   } else if (type == int.class) {
     v = Integer.valueOf(value);
   } else if (p.field.isAnnotationPresent(TimeIntervalProp.class)) {
     if (value.endsWith("s")) {
       v = (long) (Double.parseDouble(value.substring(0, value.length() - 1)) * SEC);
     } else if (value.endsWith("m")) {
       v = (long) (Double.parseDouble(value.substring(0, value.length() - 1)) * MIN);
     } else {
       v = Long.valueOf(value);
     }
   }
   return v;
 }
    /**
     * Create an EmitterDescriptor for the given methodName. This conmstructor creates a descriptor
     * that represents explicitly the types and size of the operands of the given emit* method. This
     * constructor encapsulate the logic to parse the given method name into the appropriate
     * explicit representation.
     */
    EmitterDescriptor(String methodName, Class<?>[] argTypes) {
      StringTokenizer toks = new StringTokenizer(methodName, "_");
      toks.nextElement(); // first element is emitXXX;
      args = new ArgumentType[toks.countTokens()];
      ArgumentType size = null;
      int count = 0;
      int argTypeNum = 0;
      for (int i = 0; i < args.length; i++) {
        String cs = toks.nextToken();
        ArgumentType code;
        if (argTypeNum < argTypes.length) {
          code = getEncoding(cs, argTypes[argTypeNum]);
        } else {
          code = getEncoding(cs, null);
        }
        argTypeNum += code.getParameters();
        if (DEBUG) {
          System.err.println(methodName + "[" + i + "] is " + code + " for " + cs);
        }

        args[count] = code;
        count++;
        if (code.isSize()) {
          size = code;
          count--;
        }
      }
      this.size = size;
      this.count = count;
    }
示例#4
0
  // See comment in createericlist regarding HandleViewParams
  private /*synchronized*/ String HandleViewParams(
      String tempString, LinkedList tempList, StringTokenizer st) throws VisualizerLoadException {
    while (tempString.toUpperCase().startsWith("VIEW")) {
      StringTokenizer t = new StringTokenizer(tempString, " \t");
      String s1 = t.nextToken().toUpperCase();
      String s2 = t.nextToken().toUpperCase();
      String s3 = t.nextToken();

      // HERE PROCESS URL's AS YOU DID QUESTIONS

      if (s2.compareTo("ALGO") == 0) {
        add_a_pseudocode_URL(s3);
        // System.out.println("Adding to urls: "+Snaps+":"+s3);
        //                 urlList.append(Snaps+1 +":"+s3);
      } else if (s2.compareTo("DOCS") == 0) {
        add_a_documentation_URL(s3);
        // System.out.println("Adding to urls: "+Snaps+":"+s3);
        //                 if (debug) System.out.println("Adding to urlList: "+Snaps+1+":"+s3);
        //                 urlList.append(Snaps+1 +":"+s3);
      } else if (s2.compareTo("SCALE") == 0) {
        GKS.scale(Format.atof(s3.toUpperCase()), tempList, this);
      } else if (s2.compareTo("WINDOWS") == 0) {
        GKS.windows(Format.atoi(s3.toUpperCase()), tempList, this);
      } else if (s2.compareTo("JUMP") == 0) {
        GKS.jump(Format.atoi(s3.toUpperCase()), tempList, this);
      } else throw (new VisualizerLoadException(s2 + " is invalid VIEW parameter"));
      tempString = st.nextToken();
    }
    //         if (urlList.size() == 0)
    //             urlList.append("**");
    return (tempString);
  }
示例#5
0
  static String replaceUrlSymbol(JopSession session, String url) {
    Gdh gdh = session.getGdh();

    CdhrObjid webConfig = gdh.getClassList(Pwrb.cClass_WebBrowserConfig);
    if (webConfig.evenSts()) return url;

    CdhrString webName = gdh.objidToName(webConfig.objid, Cdh.mName_volumeStrict);
    if (webConfig.evenSts()) return url;

    for (int i = 0; i < 10; i++) {
      String attr = webName.str + ".URL_Symbols[" + i + "]";
      CdhrString attrValue = gdh.getObjectInfoString(attr);
      if (attrValue.evenSts()) return url;

      if (attrValue.str.equals("")) continue;

      StringTokenizer token = new StringTokenizer(attrValue.str);
      String symbol = "$" + token.nextToken();
      if (!token.hasMoreTokens()) continue;

      String value = token.nextToken();

      int idx = url.lastIndexOf(symbol);
      while (idx != -1) {
        url = url.substring(0, idx) + value + url.substring(idx + symbol.length());
        idx = url.lastIndexOf(symbol);
      }
    }
    return url;
  }
示例#6
0
文件: Dom.java 项目: hk2-project/hk2
 /**
  * Obtains the plural attribute value. Values are separate by ',' and surrounding whitespaces are
  * ignored.
  *
  * @return null if the attribute doesn't exist. This is a distinct state from the empty list,
  *     which indicates that the attribute was there but no values were found.
  */
 public List<String> attributes(String name) {
   String v = attribute(name);
   if (v == null) return null;
   List<String> r = new ArrayList<String>();
   StringTokenizer tokens = new StringTokenizer(v, ",");
   while (tokens.hasMoreTokens()) r.add(tokens.nextToken().trim());
   return r;
 }
示例#7
0
  // createericlist with a String signature is used to process a String
  // containing a sequence of GAIGS structures
  // createericlist creates the list of graphics primitives for these snapshot(s).
  // After creating these lists, that are then appended to l, the list of snapshots,
  // Also must return the number of snapshots loaded from the string
  public /*synchronized*/ int createericlist(String structString) {
    int numsnaps = 0;
    if (debug) System.out.println("In create eric " + structString);
    StringTokenizer st = new StringTokenizer(structString, "\r\n");
    while (st.hasMoreTokens()) {
      numsnaps++; // ??
      String tempString;
      LinkedList tempList = new LinkedList();
      StructureType strct;
      tempString = st.nextToken();
      try {
        boolean headers = true;
        while (headers) {
          headers = false;
          if (tempString.toUpperCase().startsWith("VIEW")) {
            tempString = HandleViewParams(tempString, tempList, st);
            headers = true;
          }
          if (tempString.toUpperCase().startsWith("FIBQUESTION ")
              || tempString.toUpperCase().startsWith("MCQUESTION ")
              || tempString.toUpperCase().startsWith("MSQUESTION ")
              || tempString.toUpperCase().startsWith("TFQUESTION ")) {
            tempString = add_a_question(tempString, st);
            headers = true;
          }
        }

        if (tempString.toUpperCase().equals("STARTQUESTIONS")) {
          numsnaps--; // questions don't count as snapshots
          readQuestions(st);
          break;
        }
        // After returning from HandleViewParams, tempString should now contain
        // the line with the structure type and possible additional text height info
        StringTokenizer structLine = new StringTokenizer(tempString, " \t");
        String structType = structLine.nextToken();
        if (debug) System.out.println("About to assign structure" + structType);
        strct = assignStructureType(structType);
        strct.loadTextHeights(structLine, tempList, this);
        strct.loadLinesPerNodeInfo(st, tempList, this);

        strct.loadTitle(st, tempList, this);
        strct.loadStructure(st, tempList, this);
        strct.calcDimsAndStartPts(tempList, this);
        strct.drawTitle(tempList, this);
        strct.drawStructure(tempList, this);
      } catch (VisualizerLoadException e) {
        System.out.println(e.toString());
      }
      //             // You've just created a snapshot.  Need to insure that "**" is appended
      //             // to the URLList for this snapshot IF no VIEW ALGO line was parsed in the
      //             // string for the snapshot.  This could probably best be done in the
      //             // HandleViewParams method
      list_of_snapshots.append(tempList);
      Snaps++;
    }
    return (numsnaps);
  } // createericlist(string)
 protected void addPathFile(final File pathComponent) throws IOException {
   if (!this.pathComponents.contains(pathComponent)) {
     this.pathComponents.addElement(pathComponent);
   }
   if (pathComponent.isDirectory()) {
     return;
   }
   final String absPathPlusTimeAndLength =
       pathComponent.getAbsolutePath()
           + pathComponent.lastModified()
           + "-"
           + pathComponent.length();
   String classpath = AntClassLoader.pathMap.get(absPathPlusTimeAndLength);
   if (classpath == null) {
     JarFile jarFile = null;
     try {
       jarFile = new JarFile(pathComponent);
       final Manifest manifest = jarFile.getManifest();
       if (manifest == null) {
         return;
       }
       classpath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
     } finally {
       if (jarFile != null) {
         jarFile.close();
       }
     }
     if (classpath == null) {
       classpath = "";
     }
     AntClassLoader.pathMap.put(absPathPlusTimeAndLength, classpath);
   }
   if (!"".equals(classpath)) {
     final URL baseURL = AntClassLoader.FILE_UTILS.getFileURL(pathComponent);
     final StringTokenizer st = new StringTokenizer(classpath);
     while (st.hasMoreTokens()) {
       final String classpathElement = st.nextToken();
       final URL libraryURL = new URL(baseURL, classpathElement);
       if (!libraryURL.getProtocol().equals("file")) {
         this.log(
             "Skipping jar library "
                 + classpathElement
                 + " since only relative URLs are supported by this"
                 + " loader",
             3);
       } else {
         final String decodedPath = Locator.decodeUri(libraryURL.getFile());
         final File libraryFile = new File(decodedPath);
         if (!libraryFile.exists() || this.isInPath(libraryFile)) {
           continue;
         }
         this.addPathFile(libraryFile);
       }
     }
   }
 }
示例#9
0
  public static boolean readParam(String xNomeFile) {

    boolean ret = true;
    String xline;
    IOseq xFile;
    StringTokenizer st;
    String s1;
    String s2;
    Object m1;

    xFile = new IOseq("parameters.ne");
    ret = xFile.IOseqOpenR();
    if (ret) {
      try {
        Class c = Class.forName("jneat.Neat");
        Field[] fieldlist = c.getDeclaredFields();

        int number_params = fieldlist.length / 2;

        for (int i = 0; i < number_params; i++) {
          Field f1 = fieldlist[i];
          String x1 = f1.getName();
          Object x2 = f1.getType();
          xline = xFile.IOseqRead();

          st = new StringTokenizer(xline);
          // skip comment

          s1 = st.nextToken();
          // real value
          s1 = st.nextToken();

          if (x1.startsWith("p_")) {
            if (x2.toString().equals("double")) {
              double n1 = Double.parseDouble(s1);
              f1.set(c, (new Double(n1)));
            }
            if (x2.toString().equals("int")) {
              int n1 = Integer.parseInt(s1);
              f1.set(c, (new Integer(n1)));
            }
          }
        }

      } catch (Throwable e) {
        System.err.println(e);
      }

      xFile.IOseqCloseR();

    } else System.err.print("\n : error during open " + xNomeFile);

    return ret;
  }
示例#10
0
 private static Method findMethodWithParam(
     Class<?> parentDestClass, String methodName, String params) throws NoSuchMethodException {
   List<Class<?>> list = new ArrayList<Class<?>>();
   if (params != null) {
     StringTokenizer tokenizer = new StringTokenizer(params, ",");
     while (tokenizer.hasMoreTokens()) {
       String token = tokenizer.nextToken();
       list.add(MappingUtils.loadClass(token));
     }
   }
   return getMethod(parentDestClass, methodName, list.toArray(new Class[list.size()]));
 }
示例#11
0
  /** do some pre-computation parsing to a formula */
  public static String preParse(String f, FormulaManager fm) {
    // remove spaces
    StringTokenizer t = new StringTokenizer(f, " ", false);
    String s = "";
    while (t.hasMoreTokens()) s = s + t.nextToken();
    if (s.equals("")) return s;

    // multi-pass pre-parse sequence
    String os;
    do {
      os = s;
      s = preParseOnce(os, fm);
    } while (!s.equals(os));
    return s;
  }
示例#12
0
 private /*synchronized*/ String add_a_question(String tmpStr, StringTokenizer st)
     throws VisualizerLoadException {
   try {
     StringTokenizer tokzer = new StringTokenizer(tmpStr);
     String idTok = tokzer.nextToken();
     idTok = tokzer.nextToken(); // what we really want is the id
     //             FIBQuestion q = new FIBQuestion(idTok);
     //             qTable.put(idTok, q);                   //add map id -> q
     GaigsAV.qCtlTable.put(new Integer(Snaps), idTok); // add map snap -> q (assumes <= 1 q/snap)
     if (debug) System.out.println("Adding question for snap " + Snaps);
     return st.nextToken();
   } catch (Exception e) {
     throw new VisualizerLoadException("Aieee... bad SHO file");
   }
 }
示例#13
0
  /** Splits into */
  public static String[] split(String input, String delimiters) {
    if (input == null || input.equals("")) {
      return new String[] {""};
    }

    if (delimiters == null || delimiters.equals("")) {
      return new String[] {input};
    }

    StringTokenizer tokenizer = new StringTokenizer(input, delimiters);
    ArrayList<String> values = new ArrayList<String>();

    while (tokenizer.hasMoreTokens()) values.add(tokenizer.nextToken());

    String[] array = new String[values.size()];

    return values.toArray(array);
  }
示例#14
0
    /** Constructs a VerifyClassLoader. It scans the class path and the excluded package paths */
    public VerifyClassLoader() {
      super();
      String classPath = System.getProperty("java.class.path");
      String separator = System.getProperty("path.separator");

      // first pass: count elements
      StringTokenizer st = new StringTokenizer(classPath, separator);
      int i = 0;
      while (st.hasMoreTokens()) {
        st.nextToken();
        i++;
      }
      // second pass: split
      fPathItems = new String[i];
      st = new StringTokenizer(classPath, separator);
      i = 0;
      while (st.hasMoreTokens()) {
        fPathItems[i++] = st.nextToken();
      }
    }
示例#15
0
 public void applyString(String string) {
   if (string == null) return;
   StringTokenizer st = new StringTokenizer(string, ":");
   while (st.hasMoreTokens()) {
     String t = st.nextToken().trim();
     int i = t.indexOf('=');
     String name;
     String value;
     if (i >= 0) {
       name = t.substring(0, i).toLowerCase(Locale.US);
       value = t.substring(i + 1);
     } else if (t.startsWith("+")) {
       name = t.substring(1);
       value = "true";
     } else if (t.startsWith("-")) {
       name = t.substring(1);
       value = "false";
     } else if (t.endsWith("+")) {
       name = t.substring(0, t.length() - 1);
       value = "true";
     } else if (t.endsWith("-")) {
       name = t.substring(0, t.length() - 1);
       value = "false";
     } else {
       throw new IllegalArgumentException("Missing '=' for argument: " + t);
     }
     name = name.trim();
     value = value.trim();
     Prop p = PROPS.get(name);
     if (p == null) throw new IllegalArgumentException("Unknown argument: " + name);
     try {
       p.field.set(this, parseValue(value, p));
     } catch (IllegalAccessException e) {
       throw new IllegalArgumentException(e);
     }
   }
   filecount = Math.max(0, filecount);
   Arrays.sort(histogram);
 }
示例#16
0
  public /*synchronized*/ Color colorSet(String values) {
    String temp;
    int x;
    Color c = Color.black;

    StringTokenizer st = new StringTokenizer(values);
    x = Format.atoi(st.nextToken());
    if (x == 1) c = Color.black;
    else if (x == 2) c = Color.blue;
    else if (x == 6) c = Color.cyan;
    else if (x == 13) c = Color.darkGray;
    else if (x == 11) c = Color.gray;
    else if (x == 3) c = Color.green;
    else if (x == 9) c = Color.lightGray;
    else if (x == 5) c = Color.magenta;
    else if (x == 10) c = Color.orange;
    else if (x == 12) c = Color.pink;
    else if (x == 4) c = Color.red;
    else if (x == 8) c = Color.white;
    else if (x == 7) c = Color.yellow;
    else if (x < 0) c = new Color(-x);
    return c;
  }
示例#17
0
  private /*synchronized*/ void readQuestions(StringTokenizer st) throws VisualizerLoadException {
    String tmpStr =
        "STARTQUESTIONS\n"; // When CG's QuestionFactory parses from a string, it looks for
    // a line with STARTQUESTIONS -- hence we add it artificially here
    try { // Build the string for the QuestionFactory
      while (st.hasMoreTokens()) {
        tmpStr += st.nextToken() + "\n";
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new VisualizerLoadException("Ooof!  bad question format");
    }

    try {
      // System.out.println(tmpStr);
      // Problem -- must make this be line oriented
      GaigsAV.questionCollection = QuestionFactory.parseScript(tmpStr);
    } catch (QuestionParseException e) {
      e.printStackTrace();
      System.out.println("Error parsing questions.");
      throw new VisualizerLoadException("Ooof!  bad question format");
      // throw new IOException();
    }
  } // readQuestions(st)
示例#18
0
 public static Method findAMethod(Class<?> clazz, String methodName) throws NoSuchMethodException {
   StringTokenizer tokenizer = new StringTokenizer(methodName, "(");
   String m = tokenizer.nextToken();
   Method result;
   // If tokenizer has more elements, it mean that parameters may have been specified
   if (tokenizer.hasMoreElements()) {
     StringTokenizer tokens = new StringTokenizer(tokenizer.nextToken(), ")");
     String params = (tokens.hasMoreTokens() ? tokens.nextToken() : null);
     result = findMethodWithParam(clazz, m, params);
   } else {
     result = findMethod(clazz, methodName);
   }
   if (result == null) {
     throw new NoSuchMethodException(clazz.getName() + "." + methodName);
   }
   return result;
 }
示例#19
0
  // creates the list of snapshots
  public /*synchronized*/ obj dothis(String inputString) {
    /* Snapshot codes

    29 - rectangle draw
    2 - oval draw
    5 - fill oval
    6 - string
    7 - line & text color
    8 - fill color
    9 - text color (possible to ignore)
    10 - text height
    11 - polydraw
    4 - fill poly
    14 - arc draw
    30 - fill arc
    12 - text style, centered horizontal/vertical
    ???? 45 - url.  Note, when bring up multiple algorithms, the URL's for the most recently
    run algorithm are posted in the upper browser frame
    THE CODE BELOW WOULD INDICATE THIS IS 54, NOT 45 ????

    20 - number of windows.  For static algorithms, 1, 2, 3, 4 have the obvious meaning.
    21 - scale factor
    22 - jump factor

    For 20, 21, 22, the last factor loaded is the one that will affect all snapshots in
    the show

     */

    obj temp = new rectDraw("0 0 0 0", lineC);
    Object urlTest;
    String arrg;

    int graphic_obj_code = Format.atoi(inputString.substring(0, 3));
    StringTokenizer tmp = null;

    switch (graphic_obj_code) {
      case 29:
        temp = new rectDraw(inputString.substring(3, (inputString.length())), lineC);
        break;
      case 2:
        temp = new ovalDraw(inputString.substring(3, (inputString.length())), lineC);
        break;
      case 5:
        temp = new fillOvalDraw(inputString.substring(3, (inputString.length())), fillC);
        break;
      case 6:
        temp =
            new stringDraw(
                inputString.substring(3, (inputString.length())), textC, LineH, LineV, fontMult);
        // 		System.out.println(" printing " + inputString);
        break;
      case 7:
        lineC = colorSet(inputString.substring(3, (inputString.length())));
        textC = lineC;
        break;
      case 8:
        tmp = new StringTokenizer(inputString.substring(2, (inputString.length())));
        fillC = colorSet(tmp.nextToken());
        break;
      case 9:
        textC = colorSet(inputString.substring(3, (inputString.length())));
        break;
      case 10:
        StringTokenizer st = new StringTokenizer(inputString.substring(3, (inputString.length())));
        fontMult = Format.atof(st.nextToken());
        // 		System.out.println("setting fontMult= " + fontMult);
        break;
        // TLN changed on 10/14/97 to accomodate condensed prm files
        // temp=new textHeight(inputString.substring(3,(inputString.length())));
      case 11:
        temp = new polyDraw(inputString.substring(3, (inputString.length())), lineC);
        break;
      case 4:
        temp = new fillPolyDraw(inputString.substring(3, (inputString.length())), fillC);
        break;
      case 64:
        temp = new animated_fillPolyDraw(inputString.substring(3, (inputString.length())), fillC);
        break;
      case 14:
        temp = new arcDraw(inputString.substring(3, (inputString.length())), lineC);
        break;
      case 30:
        temp = new fillArcDraw(inputString.substring(3, (inputString.length())), fillC);
        break;
      case 12:
        tmp = new StringTokenizer(inputString.substring(3, (inputString.length())));
        LineH = Format.atoi(tmp.nextToken());
        LineV = Format.atoi(tmp.nextToken());
        break;
      case 20:
        tmp = new StringTokenizer(inputString.substring(3, (inputString.length())));
        // graphWin.setNumViews(Format.atoi(tmp.nextToken()));
        // multiTrigger=true;
        break;
      case 21:
        tmp = new StringTokenizer(inputString.substring(3, (inputString.length())));
        double tempFloat = Format.atof(tmp.nextToken());
        zoom = tempFloat;
        break;
      case 22:
        tmp = new StringTokenizer(inputString.substring(3, (inputString.length())));
        //            graphWin.setJump(Format.atoi(tmp.nextToken()));  // This is now a noop in
        // gaigs2
        break;
      case 54:
        tmp = new StringTokenizer(inputString.substring(3, (inputString.length())));
        //             if (tmp.hasMoreElements()){
        //                 urlTest=tmp.nextToken();
        //                 urlList.append(urlTest);
        //             }
        //             else{
        //                 tmp=new StringTokenizer("**");
        //                 urlTest=tmp.nextToken();
        //                 urlList.append(urlTest);
        //             }
        break;
    } // end switch

    return (temp);
  }
示例#20
0
  public static DeepHierarchyElement[] getDeepFieldHierarchy(
      Class<?> parentClass, String field, HintContainer deepIndexHintContainer) {
    if (!MappingUtils.isDeepMapping(field)) {
      MappingUtils.throwMappingException("Field does not contain deep field delimitor");
    }

    StringTokenizer toks = new StringTokenizer(field, DozerConstants.DEEP_FIELD_DELIMITER);
    Class<?> latestClass = parentClass;
    DeepHierarchyElement[] hierarchy = new DeepHierarchyElement[toks.countTokens()];
    int index = 0;
    int hintIndex = 0;
    while (toks.hasMoreTokens()) {
      String aFieldName = toks.nextToken();
      String theFieldName = aFieldName;
      int collectionIndex = -1;

      if (aFieldName.contains("[")) {
        theFieldName = aFieldName.substring(0, aFieldName.indexOf("["));
        collectionIndex =
            Integer.parseInt(
                aFieldName.substring(aFieldName.indexOf("[") + 1, aFieldName.indexOf("]")));
      }

      PropertyDescriptor propDescriptor =
          findPropertyDescriptor(latestClass, theFieldName, deepIndexHintContainer);
      DeepHierarchyElement r = new DeepHierarchyElement(propDescriptor, collectionIndex);

      if (propDescriptor == null) {
        MappingUtils.throwMappingException(
            "Exception occurred determining deep field hierarchy for Class --> "
                + parentClass.getName()
                + ", Field --> "
                + field
                + ".  Unable to determine property descriptor for Class --> "
                + latestClass.getName()
                + ", Field Name: "
                + aFieldName);
      }

      latestClass = propDescriptor.getPropertyType();
      if (toks.hasMoreTokens()) {
        if (latestClass.isArray()) {
          latestClass = latestClass.getComponentType();
        } else if (Collection.class.isAssignableFrom(latestClass)) {
          Class<?> genericType = determineGenericsType(propDescriptor);

          if (genericType == null && deepIndexHintContainer == null) {
            MappingUtils.throwMappingException(
                "Hint(s) or Generics not specified.  Hint(s) or Generics must be specified for deep mapping with indexed field(s). Exception occurred determining deep field hierarchy for Class --> "
                    + parentClass.getName()
                    + ", Field --> "
                    + field
                    + ".  Unable to determine property descriptor for Class --> "
                    + latestClass.getName()
                    + ", Field Name: "
                    + aFieldName);
          }
          if (genericType != null) {
            latestClass = genericType;
          } else {
            latestClass = deepIndexHintContainer.getHint(hintIndex);
            hintIndex += 1;
          }
        }
      }
      hierarchy[index++] = r;
    }

    return hierarchy;
  }
示例#21
0
  /** used by preParse */
  private static String preParseOnce(String s, FormulaManager fm) {
    // convert to lower case
    String l = s.toLowerCase();

    // scan entire string
    int len = l.length();
    boolean letter = false;
    String ns = "";
    for (int i = 0; i < len; i++) {
      if (!letter && i < len - 1 && l.substring(i, i + 2).equals("d(")) {
        // convert d(x)/d(y) notation to standard derive(x, y) notation
        i += 2;
        int s1 = i;
        for (int paren = 1; paren > 0; i++) {
          // check for correct syntax
          if (i >= len) return s;
          char c = l.charAt(i);
          if (c == '(') paren++;
          if (c == ')') paren--;
        }
        int e1 = i - 1;
        // check for correct syntax
        if (i > len - 3 || !l.substring(i, i + 3).equals("/d(")) return s;
        i += 3;
        int s2 = i;
        for (int paren = 1; paren > 0; i++) {
          // check for correct syntax
          if (i >= len) return s;
          char c = l.charAt(i);
          if (c == '(') paren++;
          if (c == ')') paren--;
        }
        int e2 = i - 1;
        ns = ns + "derive(" + s.substring(s1, e1) + "," + s.substring(s2, e2) + ")";
        i--;
      } else if (!letter && i < len - 4 && l.substring(i, i + 5).equals("link(")) {
        // evaluate link(code) notation and replace with link variable
        i += 5;
        int s1 = i;
        try {
          while (l.charAt(i) != '(') i++;
        } catch (ArrayIndexOutOfBoundsException exc) {
          // incorrect syntax
          return s;
        }
        i++;
        int e1 = i - 1;
        int s2 = i;
        for (int paren = 2; paren > 1; i++) {
          // check for correct syntax
          if (i >= len) return s;
          char c = l.charAt(i);
          if (c == '(') paren++;
          if (c == ')') paren--;
        }
        int e2 = i - 1;
        // check for correct syntax
        if (i >= len || l.charAt(i) != ')') return s;
        String prestr = s.substring(s1, e1) + "(";
        String str = prestr;

        // parse method's arguments; determine if they are Data or RealType
        String sub = s.substring(s2, e2);
        StringTokenizer st = new StringTokenizer(sub, ",", false);
        boolean first = true;
        Vector v = new Vector();
        while (st.hasMoreTokens()) {
          String token = st.nextToken();
          if (first) first = false;
          else str = str + ",";
          RealType rt = RealType.getRealTypeByName(token);
          String sv = (rt == null ? "visad.Data" : "visad.RealType");
          v.add(sv);
          str = str + sv;
        }
        str = str + ")";

        // obtain Method object
        Method[] meths = FormulaUtil.stringsToMethods(new String[] {str});

        if (meths[0] == null) {
          // attempt to identify any matching methods by compressing
          // some or all of the arguments into array form
          int vlen = v.size();
          Vector vstrs = new Vector();
          for (int iv = 0; iv < vlen; iv++) {
            String si = (String) v.elementAt(iv);
            int lv = iv;
            String sl;
            while (lv < vlen) {
              sl = (String) v.elementAt(lv++);
              if (!sl.equals(si)) {
                break;
              }
              str = prestr;
              first = true;
              for (int j = 0; j < vlen; j++) {
                if (first) first = false;
                else str = str + ",";
                String sj = (String) v.elementAt(j);
                str = str + sj;
                if (iv == j) {
                  str = str + "[]";
                  j = lv - 1;
                }
              }
              str = str + ")";
              vstrs.add(str);
            }
          }
          String[] strlist = new String[vstrs.size()];
          vstrs.toArray(strlist);
          meths = FormulaUtil.stringsToMethods(strlist);
          int found = -1;
          for (int j = 0; j < meths.length && found < 0; j++) {
            if (meths[j] != null) found = j;
          }
          if (found >= 0) meths[0] = meths[found];
          else {
            // could not find a matching method
            return s;
          }
        }

        // store method object in a link variable
        String link = "link" + (++linkNum);
        try {
          fm.setThing(link, new VMethod(meths[0]));
        }
        // catch any errors setting the link variable
        catch (FormulaException exc) {
          return s;
        } catch (VisADException exc) {
          return s;
        } catch (RemoteException exc) {
          return s;
        }
        ns = ns + "linkx(" + link + "," + s.substring(s2, e2) + ")";
      } else if (!letter) {
        int j = i;
        char c = l.charAt(j++);
        while (j < len && ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))) {
          c = l.charAt(j++);
        }
        // check for end-of-string
        if (j == len) return ns + s.substring(i, len);
        if (c == '[') {
          // convert x[y] notation to standard getSample(x, y) notation
          int k = j;
          for (int paren = 1; paren > 0; k++) {
            // check for correct syntax
            if (k >= len) return s;
            c = l.charAt(k);
            if (c == '[') paren++;
            if (c == ']') paren--;
          }
          ns = ns + "getSample(" + s.substring(i, j - 1) + "," + s.substring(j, k - 1) + ")";
          i = k - 1;
        } else ns = ns + s.charAt(i);
      } else {
        // append character to new string
        ns = ns + s.charAt(i);
      }
      char c = (i < len) ? l.charAt(i) : '\0';
      letter = (c >= 'a' && c <= 'z');
    }
    return ns;
  }
示例#22
0
  /**
   * convert an array of strings of the form &quot;package.Class.method(Class, Class, ...)&quot; to
   * an array of Method objects
   */
  public static Method[] stringsToMethods(String[] strings) {
    int len = strings.length;
    Method[] methods = new Method[len];
    for (int j = 0; j < len; j++) {
      // remove spaces
      StringTokenizer t = new StringTokenizer(strings[j], " ", false);
      String s = "";
      while (t.hasMoreTokens()) s = s + t.nextToken();

      // separate into two strings
      t = new StringTokenizer(s, "(", false);
      String pre = t.nextToken();
      String post = t.nextToken();

      // separate first string into class and method strings
      t = new StringTokenizer(pre, ".", false);
      String c = t.nextToken();
      int count = t.countTokens();
      for (int i = 0; i < count - 1; i++) c = c + "." + t.nextToken();
      String m = t.nextToken();

      // get argument array of strings
      t = new StringTokenizer(post, ",)", false);
      count = t.countTokens();
      String[] a;
      if (count == 0) a = null;
      else a = new String[count];
      int x = 0;
      while (t.hasMoreTokens()) a[x++] = t.nextToken();

      // convert result to Method object
      Class clas = null;
      try {
        clas = Class.forName(c);
      } catch (ClassNotFoundException exc) {
        if (FormulaVar.DEBUG) {
          System.out.println("ERROR: Class " + c + " does not exist!");
        }
        methods[j] = null;
        continue;
      }
      Class[] param;
      if (a == null) param = null;
      else param = new Class[a.length];
      for (int i = 0; i < count; i++) {
        // hack to convert array arguments to correct form
        if (a[i].endsWith("[]")) {
          a[i] = "[L" + a[i].substring(0, a[i].length() - 2);
          while (a[i].endsWith("[]")) {
            a[i] = "[" + a[i].substring(0, a[i].length() - 2);
          }
          a[i] = a[i] + ";";
        }

        try {
          param[i] = Class.forName(a[i]);
        } catch (ClassNotFoundException exc) {
          if (FormulaVar.DEBUG) {
            System.out.println("ERROR: Class " + a[i] + " (" + i + ") does not exist!");
          }
          methods[j] = null;
          continue;
        }
      }
      Method method = null;
      try {
        method = clas.getMethod(m, param);
      } catch (NoSuchMethodException exc) {
        if (FormulaVar.DEBUG) {
          System.out.println("ERROR: Method " + m + " does not exist!");
        }
        methods[j] = null;
        continue;
      }
      methods[j] = method;
    }
    return methods;
  }
示例#23
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;
  }