當前位置: 首頁>>代碼示例>>Java>>正文


Java Config類代碼示例

本文整理匯總了Java中battlecode.server.Config的典型用法代碼示例。如果您正苦於以下問題:Java Config類的具體用法?Java Config怎麽用?Java Config使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Config類屬於battlecode.server包,在下文中一共展示了Config類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import battlecode.server.Config; //導入依賴的package包/類
public static boolean run(Config options) {
    if (options.get("bc.client.match") != null && !options.get("bc.client" +
            ".match").trim().equals("")) {
        ClientProxy theProxy;
        try {
            theProxy = new StreamClientProxy(options.get("bc.client" +
                    ".match"));
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        Main.showViewer(createFrame(), new MatchViewer(theProxy, true));
        return true;
    }
    if (options.get("bc.server.mode").equalsIgnoreCase("LOCAL")) {
        runLocal(options);
        return true;
    }
    return battlecode.server.Main.run(options);
}
 
開發者ID:battlecode,項目名稱:battlecode-client-2016,代碼行數:21,代碼來源:Main.java

示例2: main

import battlecode.server.Config; //導入依賴的package包/類
/**
 * Checks a set of maps for legality. It will search in bc.game.map-path
 * for the maps, and use the maps whose names are passed in as runtime
 * arguments.
 *
 * @param args names of maps to use.
 */
public static void main(String[] args) {
    System.out.println("Checking maps for tournament legality...");
    File mapPath = new File(Config.getGlobalConfig().get("bc.game.map-path"));
    for (String map : args) {
        try {
            if (!loadMap(map, mapPath).isTournamentLegal()) {
                System.err.println("Illegal map: " + map);
            }
        } catch (Exception e) {
            System.err.println("Couldn't load map: "+map);
            e.printStackTrace();
        }
    }
}
 
開發者ID:battlecode,項目名稱:battlecode-server-2016,代碼行數:22,代碼來源:GameMapIO.java

示例3: getOut

import battlecode.server.Config; //導入依賴的package包/類
/**
 * Create a new System.out for this robot and round.
 * @return a stream to use for System.out in the sandboxed player
 */
private PrintStream getOut() {
    //TODO move this logic?

    Config options = Config.getGlobalConfig();

    if (robotController.getTeam() == Team.A
            && options.getBoolean("bc.engine.silence-a")
            || robotController.getTeam() == Team.B
            && options.getBoolean("bc.engine.silence-b")) {
        if (!(cachedOut instanceof SilencedPrintStream)) {
            cachedOut = SilencedPrintStream.theInstance();
        }
        // Modifying Systems specific to this robot.
    } else {
        if (!(cachedOut instanceof RoboPrintStream)) {
            cachedOut = new RoboPrintStream();
        }

        ((RoboPrintStream) cachedOut).updateHeader(
                    robotController.getTeam(),
                    robotController.getType(),
                    robotController.getID(),
                    robotController.getRoundNum()
        );

    }

    return cachedOut;
}
 
開發者ID:battlecode,項目名稱:battlecode-server-2016,代碼行數:34,代碼來源:SandboxedRobotPlayer.java

示例4: testBcTesting

import battlecode.server.Config; //導入依賴的package包/類
@Test
public void testBcTesting() throws Exception {
    Config.getGlobalConfig().set("bc.testing.should.terminate", "true");

    SandboxedRobotPlayer player = new SandboxedRobotPlayer("testplayersystem", rc, 0, cache);
    player.setBytecodeLimit(200);

    player.step();
    assertTrue(player.getTerminated());
}
 
開發者ID:battlecode,項目名稱:battlecode-server-2016,代碼行數:11,代碼來源:SandboxedRobotPlayerTest.java

示例5: testDebugMethodsEnabled

import battlecode.server.Config; //導入依賴的package包/類
@Test
public void testDebugMethodsEnabled() throws Exception {
    Config.getGlobalConfig().set("bc.engine.debug-methods", "true");

    SandboxedRobotPlayer player = new SandboxedRobotPlayer("testplayerdebug", rc, 0, cache);
    player.setBytecodeLimit(100);

    player.step();
    assertTrue(player.getTerminated());
}
 
開發者ID:battlecode,項目名稱:battlecode-server-2016,代碼行數:11,代碼來源:SandboxedRobotPlayerTest.java

示例6: testDebugMethodsDisabled

import battlecode.server.Config; //導入依賴的package包/類
@Test
public void testDebugMethodsDisabled() throws Exception {
    Config.getGlobalConfig().set("bc.engine.debug-methods", "false");

    SandboxedRobotPlayer player = new SandboxedRobotPlayer("testplayernodebug", rc, 0, cache);
    player.setBytecodeLimit(200);

    player.step();
    assertTrue(player.getTerminated());
}
 
開發者ID:battlecode,項目名稱:battlecode-server-2016,代碼行數:11,代碼來源:SandboxedRobotPlayerTest.java

示例7: StreamClientProxy

import battlecode.server.Config; //導入依賴的package包/類
public StreamClientProxy(InputStream stream) throws IOException {
    debug = false;
    if (Config.getGlobalConfig().getBoolean("bc.server.output-xml")) {
        serializer = new XStreamSerializerFactory().createSerializer
                (null, stream, ServerEvent.class);
    } else {
        serializer = new JavaSerializerFactory().createSerializer(null,
                stream, ServerEvent.class);
    }
}
 
開發者ID:battlecode,項目名稱:battlecode-client-2016,代碼行數:11,代碼來源:StreamClientProxy.java

示例8: main

import battlecode.server.Config; //導入依賴的package包/類
public static void main(String[] args) {
    final Config options = battlecode.server.Main.setupConfig(args);
    if (!run(options)) {
        System.err.println("invalid bc.server.mode");
        System.exit(64);
    }
}
 
開發者ID:battlecode,項目名稱:battlecode-client-2016,代碼行數:8,代碼來源:Main.java

示例9: populateParameters

import battlecode.server.Config; //導入依賴的package包/類
/**
 * Fills the dropdown match input boxes with available team and map
 * choices. Either does so locally, if local is selected, or uses an RPC
 * to determine the choices available on the remote host.
 */
private void populateParameters() {
    String[] matchInputs = finder.findMatchInputsLocally();

    if (matchInputs != null) {
        Arrays.sort(matchInputs);

        // Clear dropdowns.
        for (Map.Entry<Parameter, JComboBox> entries : parameters
                .entrySet())
            entries.getValue().removeAllItems();

        Set<String> items = new HashSet<>();

        // Add items.
        for (String s : matchInputs) {
            if (items.contains(s))
                continue;
            items.add(s);
            parameters.get(Parameter.TEAM_A).addItem(s);
            parameters.get(Parameter.TEAM_B).addItem(s);
        }

        items.clear();

        for (String map : GameMapIO.getAvailableMaps(Config.getGlobalConfig().get("bc.game.map-path"))) {
            parameters.get(Parameter.MAP).addItem(map);
        }
    }
}
 
開發者ID:battlecode,項目名稱:battlecode-client-2016,代碼行數:35,代碼來源:MatchDialog.java

示例10: loadPrefs

import battlecode.server.Config; //導入依賴的package包/類
public void loadPrefs() {
    if (!loadedPrefsAlready) {
        for (char ch : Config.getGlobalConfig().get("bc.client" +
                ".renderprefs2d").toCharArray()) {
            handleAction(ch);
        }
        loadedPrefsAlready = true;
    }
}
 
開發者ID:battlecode,項目名稱:battlecode-client-2016,代碼行數:10,代碼來源:GameRenderer.java

示例11: checkSettings

import battlecode.server.Config; //導入依賴的package包/類
protected static void checkSettings() {
    if (!checkedSettings) {
        checkedSettings = true;
        Config config = Config.getGlobalConfig();
        lazy = config.getBoolean("bc.engine.lazy-instrumenter");
        fastHash = config.getBoolean("bc.engine.fast-hash");
    }
}
 
開發者ID:jaaso,項目名稱:battlecode-2013-server,代碼行數:9,代碼來源:InstrumentingClassLoader.java

示例12: init

import battlecode.server.Config; //導入依賴的package包/類
private static void init() {
    robotsToKill.clear();
    Config options = Config.getGlobalConfig();
    silenced[0] = options.getBoolean("bc.engine.silence-a");
    silenced[1] = options.getBoolean("bc.engine.silence-b");
    DEBUG_BYTECODES = options.getInt("bc.engine.debug-max-bytecodes");
}
 
開發者ID:jaaso,項目名稱:battlecode-2013-server,代碼行數:8,代碼來源:RobotMonitor.java

示例13: createTCPController

import battlecode.server.Config; //導入依賴的package包/類
/**
 * Creates a controller that operates over a socket.
 *
 * @return a Controller instance for handling data from the socket source
 */
public static Controller createTCPController(InputStream input, Config options) throws IOException {
    if (Boolean.parseBoolean(options.get("bc.server.output-xml")))
        return new TCPController(XStreamProxy.getXStream().createObjectInputStream(input));
    else
        return new TCPController(new ObjectInputStream(input));
}
 
開發者ID:jaaso,項目名稱:battlecode-2013-server,代碼行數:12,代碼來源:ControllerFactory.java

示例14: HeadlessController

import battlecode.server.Config; //導入依賴的package包/類
/**
 * Creates a headless controller using config/command-line properties.
 *
 * @param options the properties to use for getting the map and teams.
 */
HeadlessController(Config options) {

    configInfo = new MatchInfo(
            options.get("bc.game.team-a"),
            options.get("bc.game.team-b"),
            options.get("bc.game.maps").split(",")
    );
}
 
開發者ID:jaaso,項目名稱:battlecode-2013-server,代碼行數:14,代碼來源:HeadlessController.java

示例15: createProxy

import battlecode.server.Config; //導入依賴的package包/類
public static Proxy createProxy(final OutputStream stream)
        throws IOException {
    if (Boolean.parseBoolean(Config.getGlobalConfig().get("bc.server.output-xml")))
        return new XStreamProxy(stream);
    else
        return new Proxy() {
            protected OutputStream getOutputStream() throws IOException {
                return stream;
            }
        };
}
 
開發者ID:jaaso,項目名稱:battlecode-2013-server,代碼行數:12,代碼來源:ProxyFactory.java


注:本文中的battlecode.server.Config類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。