001 /**
002 * Jetrix TetriNET Server
003 * Copyright (C) 2003-2004 Emmanuel Bourg
004 *
005 * This program is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU General Public License
007 * as published by the Free Software Foundation; either version 2
008 * of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program; if not, write to the Free Software
017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
018 */
019
020 package net.jetrix.winlist;
021
022 import java.util.*;
023
024 import net.jetrix.config.*;
025
026 /**
027 * A winlist ranking players and teams.
028 *
029 * @since 0.1.2
030 *
031 * @author Emmanuel Bourg
032 * @version $Revision: 794 $, $Date: 2009-02-17 20:08:39 +0100 (Tue, 17 Feb 2009) $
033 */
034 public interface Winlist
035 {
036 /**
037 * Return the id for this winlist.
038 */
039 String getId();
040
041 /**
042 * Set the id for this winlist.
043 */
044 void setId(String id);
045
046 /**
047 * Initialize the winlist.
048 *
049 * @param config the winlist configuration
050 */
051 void init(WinlistConfig config);
052
053 /**
054 * Return the configuration necessary to create the same winlist
055 *
056 * @since 0.2
057 */
058 WinlistConfig getConfig();
059
060 /**
061 * Return the score of the specified player or team
062 *
063 * @param name the name of the player or team
064 * @param type the score type (0: player, 1: team)
065 */
066 Score getScore(String name, int type);
067
068 /**
069 * Return the score list in the specified range.
070 *
071 * @param offset the beginning of the range
072 * @param length the length of the range
073 */
074 List<Score> getScores(long offset, long length);
075
076 /**
077 * Update the winlist with the specified game result.
078 */
079 void saveGameResult(GameResult result);
080
081 /**
082 * Remove all entries in the winlist
083 *
084 * @since 0.2
085 */
086 void clear();
087
088 /**
089 * Return the number of entries in the winlist
090 *
091 * @since 0.2
092 */
093 int size();
094
095 }