Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2003, 2010 Albert P?z and RoboRumble contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://robocode.sourceforge.net/license/epl-v10.html * * Contributors: * Flemming N. Larsen * - Initial API and implementation *******************************************************************************/ public class Main { private static String[] excludes; /** * Checks if a participant is excluded. * * @param botNameVersion the name and version of the participant. * @return true if the participant is excluded; false otherwise. */ public static boolean isExcluded(String botNameVersion) { if (excludes == null) { return false; } // Check the name against all exclude filters for (int i = excludes.length - 1; i >= 0; i--) { try { if (botNameVersion.matches(excludes[i])) { return true; } } catch (java.util.regex.PatternSyntaxException e) { // Clear the current exclude if the syntax is illegal (for next time this method is called) excludes[i] = ""; } } // Not excluded return false; } }