• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DiagnosticCommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sun.hotspot.parser.DiagnosticCommand的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticCommand类的具体用法?Java DiagnosticCommand怎么用?Java DiagnosticCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DiagnosticCommand类属于sun.hotspot.parser包,在下文中一共展示了DiagnosticCommand类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testQuotes

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testQuotes() throws Exception {
    String name = "name";
    DiagnosticCommand arg1 = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.STRING,
            false, null);
    DiagnosticCommand arg2 = new DiagnosticCommand("arg",
            "desc", DiagnosticArgumentType.STRING,
            false, null);
    DiagnosticCommand[] args = {arg1, arg2};

    // try with a quoted value
    parse(name, "Recording 1", name + "=\"Recording 1\"", args);
    // try with a quoted argument
    parse(name, "myrec", "\"" + name + "\"" + "=myrec", args);
    // try with both a quoted value and a quoted argument
    parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\"", args);

    // now the same thing but with other arguments after

    // try with a quoted value
    parse(name, "Recording 1", name + "=\"Recording 1\",arg=value", args);
    // try with a quoted argument
    parse(name, "myrec", "\"" + name + "\"" + "=myrec,arg=value", args);
    // try with both a quoted value and a quoted argument
    parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:27,代码来源:ParserTest.java


示例2: testMemorySize

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testMemorySize() throws Exception {
    String name = "name";
    String defaultValue = "1024";
    DiagnosticCommand arg = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.MEMORYSIZE,
            false, defaultValue);
    DiagnosticCommand[] args = {arg};

    BigInteger bi = new BigInteger("7");
    parse(name, bi.toString(), name + "=7b", args);

    bi = bi.multiply(BigInteger.valueOf(1024));
    parse(name, bi.toString(), name + "=7k", args);

    bi = bi.multiply(BigInteger.valueOf(1024));
    parse(name, bi.toString(), name + "=7m", args);

    bi = bi.multiply(BigInteger.valueOf(1024));
    parse(name, bi.toString(), name + "=7g", args);
    parse(name, defaultValue, "", args);

    //shouldFail(name + "=7gg", args); <---- should fail, doesn't
    //shouldFail(name + "=7t", args);  <----- should fail, doesn't
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:25,代码来源:ParserTest.java


示例3: parse

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void parse(String searchName, String expectedValue,
        String cmdLine, DiagnosticCommand[] argumentTypes) throws Exception {
    //parseCommandLine will return an object array that looks like
    //{<name of parsed object>, <of parsed object> ... }
    Object[] res = wb.parseCommandLine(cmdLine, argumentTypes);
    for (int i = 0; i < res.length-1; i+=2) {
        String parsedName = (String) res[i];
        if (searchName.equals(parsedName)) {
            String parsedValue = (String) res[i+1];
            if (expectedValue.equals(parsedValue)) {
                return;
            } else {
                throw new Exception("Parsing of cmdline '" + cmdLine + "' failed!\n"
                        + searchName + " parsed as " + parsedValue
                        + "! Expected: " + expectedValue);
            }
        }
    }
    throw new Exception(searchName + " not found as a parsed Argument!");
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:21,代码来源:ParserTest.java


示例4: parse

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void parse(String searchName, String expectedValue,
        String cmdLine, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
    //parseCommandLine will return an object array that looks like
    //{<name of parsed object>, <of parsed object> ... }
    Object[] res = wb.parseCommandLine(cmdLine, delim, argumentTypes);
    for (int i = 0; i < res.length-1; i+=2) {
        String parsedName = (String) res[i];
        if (searchName.equals(parsedName)) {
            String parsedValue = (String) res[i+1];
            if (expectedValue.equals(parsedValue)) {
                return;
            } else {
                throw new Exception("Parsing of cmdline '" + cmdLine + "' failed!\n"
                        + searchName + " parsed as " + parsedValue
                        + "! Expected: " + expectedValue);
            }
        }
    }
    throw new Exception(searchName + " not found as a parsed Argument!");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:ParserTest.java


示例5: testNanoTime

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testNanoTime() throws Exception {
    String name = "name";
    DiagnosticCommand arg = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.NANOTIME,
            false, "0");
    DiagnosticCommand[] args = {arg};

    BigInteger bi = new BigInteger("7");
    //These should work
    parse(name, bi.toString(), name + "=7ns", args);

    bi = bi.multiply(BigInteger.valueOf(1000));
    parse(name, bi.toString(), name + "=7us", args);

    bi = bi.multiply(BigInteger.valueOf(1000));
    parse(name, bi.toString(), name + "=7ms", args);

    bi = bi.multiply(BigInteger.valueOf(1000));
    parse(name, bi.toString(), name + "=7s", args);

    bi = bi.multiply(BigInteger.valueOf(60));
    parse(name, bi.toString() , name + "=7m", args);

    bi = bi.multiply(BigInteger.valueOf(60));
    parse(name, bi.toString() , name + "=7h", args);

    bi = bi.multiply(BigInteger.valueOf(24));
    parse(name, bi.toString() , name + "=7d", args);

    parse(name, "0", name + "=0", args);

    shouldFail(name + "=7xs", args);
    shouldFail(name + "=7mms", args);
    shouldFail(name + "=7f", args);
    //Currently, only value 0 is allowed without unit
    shouldFail(name + "=7", args);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:38,代码来源:ParserTest.java


示例6: testJLong

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testJLong() throws Exception {
    String name = "name";
    DiagnosticCommand arg = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.JLONG,
            false, "0");
    DiagnosticCommand[] args = {arg};

    wb.parseCommandLine(name + "=10", args);
    parse(name, "10", name + "=10", args);
    parse(name, "-5", name + "=-5", args);

    //shouldFail(name + "=12m", args); <-- should fail, doesn't
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:14,代码来源:ParserTest.java


示例7: testBool

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testBool() throws Exception {
    String name = "name";
    DiagnosticCommand arg = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.BOOLEAN,
            false, "false");
    DiagnosticCommand[] args = {arg};

    parse(name, "true", name + "=true", args);
    parse(name, "false", name + "=false", args);
    parse(name, "true", name, args);

    //Empty commandline to parse, tests default value
    //of the parameter "name"
    parse(name, "false", "", args);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:16,代码来源:ParserTest.java


示例8: shouldFail

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
private void shouldFail(String argument, DiagnosticCommand[] argumentTypes) throws Exception {
    try {
        wb.parseCommandLine(argument, argumentTypes);
        throw new Exception("Parser accepted argument: " + argument);
    } catch (IllegalArgumentException e) {
        //expected
    }
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:9,代码来源:ParserTest.java


示例9: testJLong

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testJLong() throws Exception {
    String name = "name";
    DiagnosticCommand arg = new DiagnosticCommand(name,
            "desc", DiagnosticArgumentType.JLONG,
            false, "0");
    DiagnosticCommand[] args = {arg};

    wb.parseCommandLine(name + "=10", ',', args);
    parse(name, "10", name + "=10", args);
    parse(name, "-5", name + "=-5", args);

    //shouldFail(name + "=12m", args); <-- should fail, doesn't
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ParserTest.java


示例10: testSingleLetterArg

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
public void testSingleLetterArg() throws Exception {
    DiagnosticCommand[] args = new DiagnosticCommand[]{
        new DiagnosticCommand("flag", "desc", DiagnosticArgumentType.STRING, true, false, null),
        new DiagnosticCommand("value", "desc", DiagnosticArgumentType.STRING, true, false, null)
    };
    parse("flag", "flag", "flag v", ' ', args);
    parse("value", "v", "flag v", ' ', args);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ParserTest.java


示例11: shouldFail

import sun.hotspot.parser.DiagnosticCommand; //导入依赖的package包/类
private void shouldFail(String argument, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
    try {
        wb.parseCommandLine(argument, delim, argumentTypes);
        throw new Exception("Parser accepted argument: " + argument);
    } catch (IllegalArgumentException e) {
        //expected
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ParserTest.java



注:本文中的sun.hotspot.parser.DiagnosticCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Button类代码示例发布时间:2022-05-23
下一篇:
Java ZonedDateTimeToDateConverter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap