001 ///////////////////////////////////////////////////////////////////////////////
002 // Copyright (c) 2006, Frank S. Nestel, All Rights Reserved.
003 //
004 // This library is free software; you can redistribute it and/or
005 // modify it under the terms of the GNU Lesser General Public
006 // License as published by the Free Software Foundation; either
007 // version 2.1 of the License, or (at your option) any later version.
008 //
009 // This library is distributed in the hope that it will be useful,
010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 // GNU General Public License for more details.
013 //
014 // You should have received a copy of the GNU Lesser General Public
015 // License along with this program; if not, write to the Free Software
016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017 ///////////////////////////////////////////////////////////////////////////////
018
019 package de.spieleck.app.turn;
020
021 /**
022 * Implementations of this are responsible for dividing the
023 * number of players into boards or tables.
024 * <br />
025 * A SplittingMode for chess tournaments will propose splitting the tourney
026 * into pairs of players. The same would happen for team bridge. For
027 * a individual bridge tournament however a splitter should suggest
028 * splitting players in quadruples.
029 * <br />
030 * Implementations of {@link PairingMode} should be able to handle
031 * the suggested splittings.
032 *
033 * <p><a href="$URL: https://svn.sourceforge.net/svnroot/jtourney/src/de/spieleck/app/turn/SplittingMode.java $">$URL: https://svn.sourceforge.net/svnroot/jtourney/src/de/spieleck/app/turn/SplittingMode.java $</a></p>
034 *
035 * @author Frank S. Nestel
036 * @author $Author: nestefan $
037 * @version $Revision: 2 $ $Date: 2006-03-20 14:33:27 +0100 (Mo, 20 Mrz 2006) $ $Author: nestefan $
038 */
039 public interface SplittingMode
040 extends LineSourceInited
041 {
042 /**
043 * Return optimal playing number.
044 * <br />
045 * This can be used e.g. for determining a final round of the top-n
046 * participants.
047 */
048 public int optimal();
049
050 /**
051 * Return a split.
052 * <br />
053 * That is a[i] is the number of groups of size i.
054 * This must satisfy the condition sum(a[i]*i) = total;
055 * Well actually sum(a[i]*i) < total is allowed and
056 * means that players have to sit out!
057 * <br />
058 * Example: Consider 25 players for a game which works
059 * with 4 or 5 players. The splitting might either be [0,0,0,0,0,5]
060 * suggesting 5 tables with 5 players. But if the game plays better
061 * with 4 players, the splitting might better be [0,0,0,0,5,1], that
062 * is suggest to distribute the 25 players to 5 tables of 4 players
063 * and to 1 table of 5 players.
064 */
065 public int[] split(int total);
066 }