test_class.file: smart-common/src/test/java/org/smartdata/utils/TestStringUtil.java
test_class.identifier: TestStringUtil
test_case.body: @Test
    public void testCmdletString() throws Exception {
      Map<String, Integer> strs = new HashMap<>();
      strs.put("int a b -c d -e f \"gg ' kk ' ff\" \" mn \"", 9);
      strs.put("cat /dir/file ", 2);
  
      List<String> items;
      for (String str : strs.keySet()) {
        items = StringUtil.parseCmdletString(str);
        Assert.assertTrue(strs.get(str) == items.size());
        System.out.println(items.size() + " -> " + str);
      }
    }
test_case.class_method_signature: TestStringUtil.testCmdletString()
test_case.full_signature: @Test public void testCmdletString()
test_case.identifier: testCmdletString
test_case.invocations: put put keySet parseCmdletString assertTrue get size println size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCmdletString()
focal_class.declarator: DIR_SEP = "/"
focal_class.modifier: private static final
focal_class.original_string: private static final String DIR_SEP = "/";
focal_class.type: String
focal_class.var_name: DIR_SEP
focal_class.declarator: GLOBS = new String[]{
        "*", "?"
    }
focal_class.modifier: private static final
focal_class.original_string: private static final String[] GLOBS = new String[]{
        "*", "?"
    };
focal_class.type: String[]
focal_class.var_name: GLOBS
focal_class.file: smart-common/src/main/java/org/smartdata/utils/StringUtil.java
focal_class.identifier: StringUtil
focal_class.class_method_signature: StringUtil.join(CharSequence delimiter,
                              Iterable<? extends CharSequence> elements)
focal_class.full_signature: public static String join(CharSequence delimiter,
                              Iterable<? extends CharSequence> elements)
focal_class.identifier: join
focal_class.modifiers: public static
focal_class.parameters: (CharSequence delimiter,
                              Iterable<? extends CharSequence> elements)
focal_class.return: String
focal_class.signature: String join(CharSequence delimiter,
                              Iterable<? extends CharSequence> elements)
focal_class.class_method_signature: StringUtil.getBaseDir(String path)
focal_class.full_signature: public static String getBaseDir(String path)
focal_class.identifier: getBaseDir
focal_class.modifiers: public static
focal_class.parameters: (String path)
focal_class.return: String
focal_class.signature: String getBaseDir(String path)
focal_class.class_method_signature: StringUtil.globString2SqlLike(String str)
focal_class.full_signature: public static String globString2SqlLike(String str)
focal_class.identifier: globString2SqlLike
focal_class.modifiers: public static
focal_class.parameters: (String str)
focal_class.return: String
focal_class.signature: String globString2SqlLike(String str)
focal_class.class_method_signature: StringUtil.pharseTimeString(String str)
focal_class.full_signature: public static long pharseTimeString(String str)
focal_class.identifier: pharseTimeString
focal_class.modifiers: public static
focal_class.parameters: (String str)
focal_class.return: long
focal_class.signature: long pharseTimeString(String str)
focal_class.class_method_signature: StringUtil.parseCmdletString(String cmdlet)
focal_class.full_signature: public static List<String> parseCmdletString(String cmdlet)
focal_class.identifier: parseCmdletString
focal_class.modifiers: public static
focal_class.parameters: (String cmdlet)
focal_class.return: List<String>
focal_class.signature: List<String> parseCmdletString(String cmdlet)
focal_class.class_method_signature: StringUtil.parseToByte(String size)
focal_class.full_signature: public static long parseToByte(String size)
focal_class.identifier: parseToByte
focal_class.modifiers: public static
focal_class.parameters: (String size)
focal_class.return: long
focal_class.signature: long parseToByte(String size)
focal_class.class_method_signature: StringUtil.toSHA512String(String password)
focal_class.full_signature: public static String toSHA512String(String password)
focal_class.identifier: toSHA512String
focal_class.modifiers: public static
focal_class.parameters: (String password)
focal_class.return: String
focal_class.signature: String toSHA512String(String password)
focal_method.body: public static List<String> parseCmdletString(String cmdlet)
        throws ParseException {
      if (cmdlet == null || cmdlet.length() == 0) {
        return new ArrayList<>();
      }
  
      char[] chars = (cmdlet + " ").toCharArray();
      List<String> blocks = new ArrayList<String>();
      char c;
      char[] token = new char[chars.length];
      int tokenlen = 0;
      boolean sucing = false;
      boolean string = false;
      for (int idx = 0; idx < chars.length; idx++) {
        c = chars[idx];
        if (c == ' ' || c == '\t') {
          if (string) {
            token[tokenlen++] = c;
          }
          if (sucing) {
            blocks.add(String.valueOf(token, 0, tokenlen));
            tokenlen = 0;
            sucing = false;
          }
        } else if (c == ';') {
          if (string) {
            throw new ParseException("Unexpected break of string", idx);
          }
  
          if (sucing) {
            blocks.add(String.valueOf(token, 0, tokenlen));
            tokenlen = 0;
            sucing = false;
          }
        } else if (c == '\\') {
          boolean tempAdded = false;
          if (sucing || string) {
            token[tokenlen++] = chars[++idx];
            tempAdded = true;
          }
  
          if (!tempAdded && !sucing) {
            sucing = true;
            token[tokenlen++] = chars[++idx];
          }
        } else if (c == '"') {
          if (sucing) {
            throw new ParseException("Unexpected \"", idx);
          }
  
          if (string) {
            if (chars[idx + 1] != '"') {
              string = false;
              blocks.add(String.valueOf(token, 0, tokenlen));
              tokenlen = 0;
            } else {
              idx++;
            }
          } else {
            string = true;
          }
        } else if (c == '\r' || c == '\n') {
          if (sucing) {
            sucing = false;
            blocks.add(String.valueOf(token, 0, tokenlen));
            tokenlen = 0;
          }
  
          if (string) {
            throw new ParseException("String cannot in more than one line", idx);
          }
        } else {
          if (string) {
            token[tokenlen++] = chars[idx];
          } else {
            sucing = true;
            token[tokenlen++] = chars[idx];
          }
        }
      }
  
      if (string) {
        throw new ParseException("Unexpected tail of string", chars.length);
      }
      return blocks;
    }
focal_method.class_method_signature: StringUtil.parseCmdletString(String cmdlet)
focal_method.full_signature: public static List<String> parseCmdletString(String cmdlet)
focal_method.identifier: parseCmdletString
focal_method.invocations: length toCharArray add valueOf add valueOf add valueOf add valueOf
focal_method.modifiers: public static
focal_method.parameters: (String cmdlet)
focal_method.return: List<String>
focal_method.signature: List<String> parseCmdletString(String cmdlet)